diff options
Diffstat (limited to 'fs/udf/ialloc.c')
-rw-r--r-- | fs/udf/ialloc.c | 94 |
1 files changed, 56 insertions, 38 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 636d8f61392..84360315aca 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c @@ -43,19 +43,21 @@ void udf_free_inode(struct inode *inode) clear_inode(inode); mutex_lock(&sbi->s_alloc_mutex); - if (sbi->s_lvidbh) { + if (sbi->s_lvid_bh) { + struct logicalVolIntegrityDescImpUse *lvidiu = + udf_sb_lvidiu(sbi); if (S_ISDIR(inode->i_mode)) - UDF_SB_LVIDIU(sb)->numDirs = - cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) - 1); + lvidiu->numDirs = + cpu_to_le32(le32_to_cpu(lvidiu->numDirs) - 1); else - UDF_SB_LVIDIU(sb)->numFiles = - cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1); + lvidiu->numFiles = + cpu_to_le32(le32_to_cpu(lvidiu->numFiles) - 1); - mark_buffer_dirty(sbi->s_lvidbh); + mark_buffer_dirty(sbi->s_lvid_bh); } mutex_unlock(&sbi->s_alloc_mutex); - udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1); + udf_free_blocks(sb, NULL, UDF_I(inode)->i_location, 0, 1); } struct inode *udf_new_inode(struct inode *dir, int mode, int *err) @@ -64,7 +66,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) struct udf_sb_info *sbi = UDF_SB(sb); struct inode *inode; int block; - uint32_t start = UDF_I_LOCATION(dir).logicalBlockNum; + uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; + struct udf_inode_info *iinfo; + struct udf_inode_info *dinfo = UDF_I(dir); inode = new_inode(sb); @@ -74,13 +78,15 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) } *err = -ENOSPC; - UDF_I_UNIQUE(inode) = 0; - UDF_I_LENEXTENTS(inode) = 0; - UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; - UDF_I_NEXT_ALLOC_GOAL(inode) = 0; - UDF_I_STRAT4096(inode) = 0; + iinfo = UDF_I(inode); + iinfo->i_unique = 0; + iinfo->i_lenExtents = 0; + iinfo->i_next_alloc_block = 0; + iinfo->i_next_alloc_goal = 0; + iinfo->i_strat4096 = 0; - block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, + block = udf_new_block(dir->i_sb, NULL, + dinfo->i_location.partitionReferenceNum, start, err); if (*err) { iput(inode); @@ -88,21 +94,27 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) } mutex_lock(&sbi->s_alloc_mutex); - if (UDF_SB_LVIDBH(sb)) { + if (sbi->s_lvid_bh) { + struct logicalVolIntegrityDesc *lvid = + (struct logicalVolIntegrityDesc *) + sbi->s_lvid_bh->b_data; + struct logicalVolIntegrityDescImpUse *lvidiu = + udf_sb_lvidiu(sbi); struct logicalVolHeaderDesc *lvhd; uint64_t uniqueID; - lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse); + lvhd = (struct logicalVolHeaderDesc *) + (lvid->logicalVolContentsUse); if (S_ISDIR(mode)) - UDF_SB_LVIDIU(sb)->numDirs = - cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) + 1); + lvidiu->numDirs = + cpu_to_le32(le32_to_cpu(lvidiu->numDirs) + 1); else - UDF_SB_LVIDIU(sb)->numFiles = - cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) + 1); - UDF_I_UNIQUE(inode) = uniqueID = le64_to_cpu(lvhd->uniqueID); + lvidiu->numFiles = + cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1); + iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); if (!(++uniqueID & 0x00000000FFFFFFFFUL)) uniqueID += 16; lvhd->uniqueID = cpu_to_le64(uniqueID); - mark_buffer_dirty(UDF_SB_LVIDBH(sb)); + mark_buffer_dirty(sbi->s_lvid_bh); } inode->i_mode = mode; inode->i_uid = current->fsuid; @@ -114,35 +126,41 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) inode->i_gid = current->fsgid; } - UDF_I_LOCATION(inode).logicalBlockNum = block; - UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; - inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0); + iinfo->i_location.logicalBlockNum = block; + iinfo->i_location.partitionReferenceNum = + dinfo->i_location.partitionReferenceNum; + inode->i_ino = udf_get_lb_pblock(sb, iinfo->i_location, 0); inode->i_blocks = 0; - UDF_I_LENEATTR(inode) = 0; - UDF_I_LENALLOC(inode) = 0; - UDF_I_USE(inode) = 0; + iinfo->i_lenEAttr = 0; + iinfo->i_lenAlloc = 0; + iinfo->i_use = 0; if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { - UDF_I_EFE(inode) = 1; - UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); - UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); + iinfo->i_efe = 1; + if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev) + sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE; + iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - + sizeof(struct extendedFileEntry), + GFP_KERNEL); } else { - UDF_I_EFE(inode) = 0; - UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); + iinfo->i_efe = 0; + iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize - + sizeof(struct fileEntry), + GFP_KERNEL); } - if (!UDF_I_DATA(inode)) { + if (!iinfo->i_ext.i_data) { iput(inode); *err = -ENOMEM; mutex_unlock(&sbi->s_alloc_mutex); return NULL; } if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) - UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) - UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; else - UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; + iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; inode->i_mtime = inode->i_atime = inode->i_ctime = - UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb); + iinfo->i_crtime = current_fs_time(inode->i_sb); insert_inode_hash(inode); mark_inode_dirty(inode); mutex_unlock(&sbi->s_alloc_mutex); |