Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/ext2fs/ext2_alloc.c
Context not available. | |||||
static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); | static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); | ||||
static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); | static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); | ||||
static u_long ext2_dirpref(struct inode *); | static u_long ext2_dirpref(struct inode *); | ||||
static void ext2_fserr(struct m_ext2fs *, uid_t, char *); | |||||
static u_long ext2_hashalloc(struct inode *, int, long, int, | static u_long ext2_hashalloc(struct inode *, int, long, int, | ||||
daddr_t (*)(struct inode *, int, daddr_t, | daddr_t (*)(struct inode *, int, daddr_t, | ||||
int)); | int)); | ||||
Context not available. | |||||
* Allocate EA's block for inode. | * Allocate EA's block for inode. | ||||
*/ | */ | ||||
daddr_t | daddr_t | ||||
ext2_allocfacl(struct inode *ip) | ext2_allocmeta(struct inode *ip) | ||||
{ | { | ||||
struct m_ext2fs *fs; | struct m_ext2fs *fs; | ||||
daddr_t facl; | daddr_t blk; | ||||
fs = ip->i_e2fs; | fs = ip->i_e2fs; | ||||
EXT2_LOCK(ip->i_ump); | EXT2_LOCK(ip->i_ump); | ||||
facl = ext2_alloccg(ip, ino_to_cg(fs, ip->i_number), 0, fs->e2fs_bsize); | blk = ext2_hashalloc(ip, ino_to_cg(fs, ip->i_number), 0, fs->e2fs_bsize, | ||||
if (0 == facl) | ext2_alloccg); | ||||
if (0 == blk) | |||||
EXT2_UNLOCK(ip->i_ump); | EXT2_UNLOCK(ip->i_ump); | ||||
return (facl); | return (blk); | ||||
} | } | ||||
/* | /* | ||||
Context not available. | |||||
fs = ip->i_e2fs; | fs = ip->i_e2fs; | ||||
ump = ip->i_ump; | ump = ip->i_ump; | ||||
if (fs->e2fs_contigsumsize <= 0) | if (fs->e2fs_contigsumsize <= 0 || ip->i_flag & IN_E4EXTENTS) | ||||
return (ENOSPC); | return (ENOSPC); | ||||
buflist = ap->a_buflist; | buflist = ap->a_buflist; | ||||
Context not available. | |||||
struct inode *ip; | struct inode *ip; | ||||
struct ext2mount *ump; | struct ext2mount *ump; | ||||
ino_t ino, ipref; | ino_t ino, ipref; | ||||
int i, error, cg; | int error, cg; | ||||
*vpp = NULL; | *vpp = NULL; | ||||
pip = VTOI(pvp); | pip = VTOI(pvp); | ||||
Context not available. | |||||
ip->i_blocks = 0; | ip->i_blocks = 0; | ||||
ip->i_mode = 0; | ip->i_mode = 0; | ||||
ip->i_flags = 0; | ip->i_flags = 0; | ||||
/* now we want to make sure that the block pointers are zeroed out */ | if (EXT2_HAS_INCOMPAT_FEATURE(fs, EXT2F_INCOMPAT_EXTENTS) | ||||
for (i = 0; i < EXT2_NDADDR; i++) | && (S_ISREG(mode) || S_ISDIR(mode))) | ||||
ip->i_db[i] = 0; | ext4_ext_tree_init(ip); | ||||
for (i = 0; i < EXT2_NIADDR; i++) | else | ||||
ip->i_ib[i] = 0; | memset(ip->i_data, 0, sizeof(ip->i_data)); | ||||
/* | /* | ||||
* Set up a new generation number for this inode. | * Set up a new generation number for this inode. | ||||
Context not available. | |||||
ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, | ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int indx, e2fs_daddr_t *bap, | ||||
e2fs_daddr_t blocknr) | e2fs_daddr_t blocknr) | ||||
{ | { | ||||
struct m_ext2fs *fs; | |||||
int tmp; | int tmp; | ||||
fs = ip->i_e2fs; | |||||
mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); | mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); | ||||
/* | /* | ||||
Context not available. | |||||
* Else lets fall back to the blocknr or, if there is none, follow | * Else lets fall back to the blocknr or, if there is none, follow | ||||
* the rule that a block should be allocated near its inode. | * the rule that a block should be allocated near its inode. | ||||
*/ | */ | ||||
return blocknr ? blocknr : | return (blocknr ? blocknr : | ||||
(e2fs_daddr_t)(ip->i_block_group * | (e2fs_daddr_t)(ip->i_block_group * | ||||
EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) + | EXT2_BLOCKS_PER_GROUP(fs)) + fs->e2fs->e2fs_first_dblock); | ||||
ip->i_e2fs->e2fs->e2fs_first_dblock; | |||||
} | } | ||||
/* | /* | ||||
Context not available. | |||||
* The form of the error message is: | * The form of the error message is: | ||||
* fs: error message | * fs: error message | ||||
*/ | */ | ||||
static void | void | ||||
ext2_fserr(struct m_ext2fs *fs, uid_t uid, char *cp) | ext2_fserr(struct m_ext2fs *fs, uid_t uid, char *cp) | ||||
{ | { | ||||
Context not available. |