Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/ext2fs/ext2_alloc.c
Show First 20 Lines • Show All 451 Lines • ▼ Show 20 Lines | noinodes: | ||||
ext2_fserr(fs, cred->cr_uid, "out of inodes"); | ext2_fserr(fs, cred->cr_uid, "out of inodes"); | ||||
uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt); | uprintf("\n%s: create/symlink failed, no inodes free\n", fs->e2fs_fsmnt); | ||||
return (ENOSPC); | return (ENOSPC); | ||||
} | } | ||||
/* | /* | ||||
* 64-bit compatible getters and setters for struct ext2_gd from ext2fs.h | * 64-bit compatible getters and setters for struct ext2_gd from ext2fs.h | ||||
*/ | */ | ||||
static uint64_t | uint64_t | ||||
e2fs_gd_get_b_bitmap(struct ext2_gd *gd) | e2fs_gd_get_b_bitmap(struct ext2_gd *gd) | ||||
{ | { | ||||
return (((uint64_t)(gd->ext4bgd_b_bitmap_hi) << 32) | | return (((uint64_t)(gd->ext4bgd_b_bitmap_hi) << 32) | | ||||
gd->ext2bgd_b_bitmap); | gd->ext2bgd_b_bitmap); | ||||
} | } | ||||
static uint64_t | uint64_t | ||||
e2fs_gd_get_i_bitmap(struct ext2_gd *gd) | e2fs_gd_get_i_bitmap(struct ext2_gd *gd) | ||||
{ | { | ||||
return (((uint64_t)(gd->ext4bgd_i_bitmap_hi) << 32) | | return (((uint64_t)(gd->ext4bgd_i_bitmap_hi) << 32) | | ||||
gd->ext2bgd_i_bitmap); | gd->ext2bgd_i_bitmap); | ||||
} | } | ||||
uint64_t | uint64_t | ||||
▲ Show 20 Lines • Show All 272 Lines • ▼ Show 20 Lines | if (result) | ||||
return (result); | return (result); | ||||
cg++; | cg++; | ||||
if (cg == fs->e2fs_gcount) | if (cg == fs->e2fs_gcount) | ||||
cg = 0; | cg = 0; | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static unsigned long | static uint64_t | ||||
ext2_cg_number_gdb_nometa(struct m_ext2fs *fs, int cg) | ext2_cg_number_gdb_nometa(struct m_ext2fs *fs, int cg) | ||||
{ | { | ||||
if (!ext2_cg_has_sb(fs, cg)) | if (!ext2_cg_has_sb(fs, cg)) | ||||
return (0); | return (0); | ||||
if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG)) | if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG)) | ||||
return (fs->e2fs->e3fs_first_meta_bg); | return (fs->e2fs->e3fs_first_meta_bg); | ||||
return ((fs->e2fs_gcount + EXT2_DESCS_PER_BLOCK(fs) - 1) / | return ((fs->e2fs_gcount + EXT2_DESCS_PER_BLOCK(fs) - 1) / | ||||
EXT2_DESCS_PER_BLOCK(fs)); | EXT2_DESCS_PER_BLOCK(fs)); | ||||
} | } | ||||
static unsigned long | static uint64_t | ||||
ext2_cg_number_gdb_meta(struct m_ext2fs *fs, int cg) | ext2_cg_number_gdb_meta(struct m_ext2fs *fs, int cg) | ||||
{ | { | ||||
unsigned long metagroup; | unsigned long metagroup; | ||||
int first, last; | int first, last; | ||||
metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); | metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); | ||||
first = metagroup * EXT2_DESCS_PER_BLOCK(fs); | first = metagroup * EXT2_DESCS_PER_BLOCK(fs); | ||||
last = first + EXT2_DESCS_PER_BLOCK(fs) - 1; | last = first + EXT2_DESCS_PER_BLOCK(fs) - 1; | ||||
if (cg == first || cg == first + 1 || cg == last) | if (cg == first || cg == first + 1 || cg == last) | ||||
return (1); | return (1); | ||||
return (0); | return (0); | ||||
} | } | ||||
static unsigned long | uint64_t | ||||
ext2_cg_number_gdb(struct m_ext2fs *fs, int cg) | ext2_cg_number_gdb(struct m_ext2fs *fs, int cg) | ||||
{ | { | ||||
unsigned long first_meta_bg, metagroup; | unsigned long first_meta_bg, metagroup; | ||||
first_meta_bg = fs->e2fs->e3fs_first_meta_bg; | first_meta_bg = fs->e2fs->e3fs_first_meta_bg; | ||||
metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); | metagroup = cg / EXT2_DESCS_PER_BLOCK(fs); | ||||
if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || | if (!EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_META_BG) || | ||||
▲ Show 20 Lines • Show All 691 Lines • Show Last 20 Lines |