diff options
Diffstat (limited to 'fs/udf/ialloc.c')
-rw-r--r-- | fs/udf/ialloc.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 7e5aae4bf46f..6eaf5edf1ea1 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -30,18 +30,17 @@ void udf_free_inode(struct inode *inode) | |||
30 | { | 30 | { |
31 | struct super_block *sb = inode->i_sb; | 31 | struct super_block *sb = inode->i_sb; |
32 | struct udf_sb_info *sbi = UDF_SB(sb); | 32 | struct udf_sb_info *sbi = UDF_SB(sb); |
33 | struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sb); | ||
33 | 34 | ||
34 | mutex_lock(&sbi->s_alloc_mutex); | 35 | if (lvidiu) { |
35 | if (sbi->s_lvid_bh) { | 36 | mutex_lock(&sbi->s_alloc_mutex); |
36 | struct logicalVolIntegrityDescImpUse *lvidiu = | ||
37 | udf_sb_lvidiu(sbi); | ||
38 | if (S_ISDIR(inode->i_mode)) | 37 | if (S_ISDIR(inode->i_mode)) |
39 | le32_add_cpu(&lvidiu->numDirs, -1); | 38 | le32_add_cpu(&lvidiu->numDirs, -1); |
40 | else | 39 | else |
41 | le32_add_cpu(&lvidiu->numFiles, -1); | 40 | le32_add_cpu(&lvidiu->numFiles, -1); |
42 | udf_updated_lvid(sb); | 41 | udf_updated_lvid(sb); |
42 | mutex_unlock(&sbi->s_alloc_mutex); | ||
43 | } | 43 | } |
44 | mutex_unlock(&sbi->s_alloc_mutex); | ||
45 | 44 | ||
46 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); | 45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
47 | } | 46 | } |
@@ -55,6 +54,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
55 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; | 54 | uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; |
56 | struct udf_inode_info *iinfo; | 55 | struct udf_inode_info *iinfo; |
57 | struct udf_inode_info *dinfo = UDF_I(dir); | 56 | struct udf_inode_info *dinfo = UDF_I(dir); |
57 | struct logicalVolIntegrityDescImpUse *lvidiu; | ||
58 | 58 | ||
59 | inode = new_inode(sb); | 59 | inode = new_inode(sb); |
60 | 60 | ||
@@ -92,12 +92,10 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
92 | return NULL; | 92 | return NULL; |
93 | } | 93 | } |
94 | 94 | ||
95 | if (sbi->s_lvid_bh) { | 95 | lvidiu = udf_sb_lvidiu(sb); |
96 | struct logicalVolIntegrityDescImpUse *lvidiu; | 96 | if (lvidiu) { |
97 | |||
98 | iinfo->i_unique = lvid_get_unique_id(sb); | 97 | iinfo->i_unique = lvid_get_unique_id(sb); |
99 | mutex_lock(&sbi->s_alloc_mutex); | 98 | mutex_lock(&sbi->s_alloc_mutex); |
100 | lvidiu = udf_sb_lvidiu(sbi); | ||
101 | if (S_ISDIR(mode)) | 99 | if (S_ISDIR(mode)) |
102 | le32_add_cpu(&lvidiu->numDirs, 1); | 100 | le32_add_cpu(&lvidiu->numDirs, 1); |
103 | else | 101 | else |