diff options
Diffstat (limited to 'fs/udf/ialloc.c')
-rw-r--r-- | fs/udf/ialloc.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 2eb503806bce..636d8f613929 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -46,12 +46,10 @@ void udf_free_inode(struct inode *inode) | |||
46 | if (sbi->s_lvidbh) { | 46 | if (sbi->s_lvidbh) { |
47 | if (S_ISDIR(inode->i_mode)) | 47 | if (S_ISDIR(inode->i_mode)) |
48 | UDF_SB_LVIDIU(sb)->numDirs = | 48 | UDF_SB_LVIDIU(sb)->numDirs = |
49 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) | 49 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) - 1); |
50 | - 1); | ||
51 | else | 50 | else |
52 | UDF_SB_LVIDIU(sb)->numFiles = | 51 | UDF_SB_LVIDIU(sb)->numFiles = |
53 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) | 52 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1); |
54 | - 1); | ||
55 | 53 | ||
56 | mark_buffer_dirty(sbi->s_lvidbh); | 54 | mark_buffer_dirty(sbi->s_lvidbh); |
57 | } | 55 | } |
@@ -82,10 +80,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
82 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | 80 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; |
83 | UDF_I_STRAT4096(inode) = 0; | 81 | UDF_I_STRAT4096(inode) = 0; |
84 | 82 | ||
85 | block = | 83 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, |
86 | udf_new_block(dir->i_sb, NULL, | 84 | start, err); |
87 | UDF_I_LOCATION(dir).partitionReferenceNum, start, | ||
88 | err); | ||
89 | if (*err) { | 85 | if (*err) { |
90 | iput(inode); | 86 | iput(inode); |
91 | return NULL; | 87 | return NULL; |
@@ -95,17 +91,13 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
95 | if (UDF_SB_LVIDBH(sb)) { | 91 | if (UDF_SB_LVIDBH(sb)) { |
96 | struct logicalVolHeaderDesc *lvhd; | 92 | struct logicalVolHeaderDesc *lvhd; |
97 | uint64_t uniqueID; | 93 | uint64_t uniqueID; |
98 | lvhd = | 94 | lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse); |
99 | (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)-> | ||
100 | logicalVolContentsUse); | ||
101 | if (S_ISDIR(mode)) | 95 | if (S_ISDIR(mode)) |
102 | UDF_SB_LVIDIU(sb)->numDirs = | 96 | UDF_SB_LVIDIU(sb)->numDirs = |
103 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) | 97 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) + 1); |
104 | + 1); | ||
105 | else | 98 | else |
106 | UDF_SB_LVIDIU(sb)->numFiles = | 99 | UDF_SB_LVIDIU(sb)->numFiles = |
107 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) | 100 | cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) + 1); |
108 | + 1); | ||
109 | UDF_I_UNIQUE(inode) = uniqueID = le64_to_cpu(lvhd->uniqueID); | 101 | UDF_I_UNIQUE(inode) = uniqueID = le64_to_cpu(lvhd->uniqueID); |
110 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) | 102 | if (!(++uniqueID & 0x00000000FFFFFFFFUL)) |
111 | uniqueID += 16; | 103 | uniqueID += 16; |
@@ -118,12 +110,12 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
118 | inode->i_gid = dir->i_gid; | 110 | inode->i_gid = dir->i_gid; |
119 | if (S_ISDIR(mode)) | 111 | if (S_ISDIR(mode)) |
120 | mode |= S_ISGID; | 112 | mode |= S_ISGID; |
121 | } else | 113 | } else { |
122 | inode->i_gid = current->fsgid; | 114 | inode->i_gid = current->fsgid; |
115 | } | ||
123 | 116 | ||
124 | UDF_I_LOCATION(inode).logicalBlockNum = block; | 117 | UDF_I_LOCATION(inode).logicalBlockNum = block; |
125 | UDF_I_LOCATION(inode).partitionReferenceNum = | 118 | UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum; |
126 | UDF_I_LOCATION(dir).partitionReferenceNum; | ||
127 | inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0); | 119 | inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0); |
128 | inode->i_blocks = 0; | 120 | inode->i_blocks = 0; |
129 | UDF_I_LENEATTR(inode) = 0; | 121 | UDF_I_LENEATTR(inode) = 0; |
@@ -132,14 +124,10 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
132 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { | 124 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { |
133 | UDF_I_EFE(inode) = 1; | 125 | UDF_I_EFE(inode) = 1; |
134 | UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); | 126 | UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE); |
135 | UDF_I_DATA(inode) = | 127 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL); |
136 | kzalloc(inode->i_sb->s_blocksize - | ||
137 | sizeof(struct extendedFileEntry), GFP_KERNEL); | ||
138 | } else { | 128 | } else { |
139 | UDF_I_EFE(inode) = 0; | 129 | UDF_I_EFE(inode) = 0; |
140 | UDF_I_DATA(inode) = | 130 | UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL); |
141 | kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), | ||
142 | GFP_KERNEL); | ||
143 | } | 131 | } |
144 | if (!UDF_I_DATA(inode)) { | 132 | if (!UDF_I_DATA(inode)) { |
145 | iput(inode); | 133 | iput(inode); |
@@ -154,7 +142,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | |||
154 | else | 142 | else |
155 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; | 143 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; |
156 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 144 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
157 | UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb); | 145 | UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb); |
158 | insert_inode_hash(inode); | 146 | insert_inode_hash(inode); |
159 | mark_inode_dirty(inode); | 147 | mark_inode_dirty(inode); |
160 | mutex_unlock(&sbi->s_alloc_mutex); | 148 | mutex_unlock(&sbi->s_alloc_mutex); |