diff options
author | Steve French <sfrench@us.ibm.com> | 2008-02-15 16:06:08 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-02-15 16:06:08 -0500 |
commit | 0a3abcf75bf391fec4e32356ab5ddb8f5d2e6b41 (patch) | |
tree | b80b1d344ec24cad28b057ef803cebac9434be01 /fs/ext2/inode.c | |
parent | 70eff55d2d979cca700aa6906494f0c474f3f7ff (diff) | |
parent | 101142c37be8e5af9b847860219217e6b958c739 (diff) |
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r-- | fs/ext2/inode.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index b1ab32ab5a77..c62006805427 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -286,15 +286,12 @@ static unsigned long ext2_find_near(struct inode *inode, Indirect *ind) | |||
286 | * ext2_find_goal - find a prefered place for allocation. | 286 | * ext2_find_goal - find a prefered place for allocation. |
287 | * @inode: owner | 287 | * @inode: owner |
288 | * @block: block we want | 288 | * @block: block we want |
289 | * @chain: chain of indirect blocks | ||
290 | * @partial: pointer to the last triple within a chain | 289 | * @partial: pointer to the last triple within a chain |
291 | * | 290 | * |
292 | * Returns preferred place for a block (the goal). | 291 | * Returns preferred place for a block (the goal). |
293 | */ | 292 | */ |
294 | 293 | ||
295 | static inline int ext2_find_goal(struct inode *inode, | 294 | static inline int ext2_find_goal(struct inode *inode, long block, |
296 | long block, | ||
297 | Indirect chain[4], | ||
298 | Indirect *partial) | 295 | Indirect *partial) |
299 | { | 296 | { |
300 | struct ext2_block_alloc_info *block_i; | 297 | struct ext2_block_alloc_info *block_i; |
@@ -569,7 +566,6 @@ static void ext2_splice_branch(struct inode *inode, | |||
569 | * | 566 | * |
570 | * `handle' can be NULL if create == 0. | 567 | * `handle' can be NULL if create == 0. |
571 | * | 568 | * |
572 | * The BKL may not be held on entry here. Be sure to take it early. | ||
573 | * return > 0, # of blocks mapped or allocated. | 569 | * return > 0, # of blocks mapped or allocated. |
574 | * return = 0, if plain lookup failed. | 570 | * return = 0, if plain lookup failed. |
575 | * return < 0, error case. | 571 | * return < 0, error case. |
@@ -639,7 +635,7 @@ reread: | |||
639 | if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info)) | 635 | if (S_ISREG(inode->i_mode) && (!ei->i_block_alloc_info)) |
640 | ext2_init_block_alloc_info(inode); | 636 | ext2_init_block_alloc_info(inode); |
641 | 637 | ||
642 | goal = ext2_find_goal(inode, iblock, chain, partial); | 638 | goal = ext2_find_goal(inode, iblock, partial); |
643 | 639 | ||
644 | /* the number of blocks need to allocate for [d,t]indirect blocks */ | 640 | /* the number of blocks need to allocate for [d,t]indirect blocks */ |
645 | indirect_blks = (chain + depth) - partial - 1; | 641 | indirect_blks = (chain + depth) - partial - 1; |
@@ -1185,22 +1181,33 @@ void ext2_get_inode_flags(struct ext2_inode_info *ei) | |||
1185 | ei->i_flags |= EXT2_DIRSYNC_FL; | 1181 | ei->i_flags |= EXT2_DIRSYNC_FL; |
1186 | } | 1182 | } |
1187 | 1183 | ||
1188 | void ext2_read_inode (struct inode * inode) | 1184 | struct inode *ext2_iget (struct super_block *sb, unsigned long ino) |
1189 | { | 1185 | { |
1190 | struct ext2_inode_info *ei = EXT2_I(inode); | 1186 | struct ext2_inode_info *ei; |
1191 | ino_t ino = inode->i_ino; | ||
1192 | struct buffer_head * bh; | 1187 | struct buffer_head * bh; |
1193 | struct ext2_inode * raw_inode = ext2_get_inode(inode->i_sb, ino, &bh); | 1188 | struct ext2_inode *raw_inode; |
1189 | struct inode *inode; | ||
1190 | long ret = -EIO; | ||
1194 | int n; | 1191 | int n; |
1195 | 1192 | ||
1193 | inode = iget_locked(sb, ino); | ||
1194 | if (!inode) | ||
1195 | return ERR_PTR(-ENOMEM); | ||
1196 | if (!(inode->i_state & I_NEW)) | ||
1197 | return inode; | ||
1198 | |||
1199 | ei = EXT2_I(inode); | ||
1196 | #ifdef CONFIG_EXT2_FS_POSIX_ACL | 1200 | #ifdef CONFIG_EXT2_FS_POSIX_ACL |
1197 | ei->i_acl = EXT2_ACL_NOT_CACHED; | 1201 | ei->i_acl = EXT2_ACL_NOT_CACHED; |
1198 | ei->i_default_acl = EXT2_ACL_NOT_CACHED; | 1202 | ei->i_default_acl = EXT2_ACL_NOT_CACHED; |
1199 | #endif | 1203 | #endif |
1200 | ei->i_block_alloc_info = NULL; | 1204 | ei->i_block_alloc_info = NULL; |
1201 | 1205 | ||
1202 | if (IS_ERR(raw_inode)) | 1206 | raw_inode = ext2_get_inode(inode->i_sb, ino, &bh); |
1207 | if (IS_ERR(raw_inode)) { | ||
1208 | ret = PTR_ERR(raw_inode); | ||
1203 | goto bad_inode; | 1209 | goto bad_inode; |
1210 | } | ||
1204 | 1211 | ||
1205 | inode->i_mode = le16_to_cpu(raw_inode->i_mode); | 1212 | inode->i_mode = le16_to_cpu(raw_inode->i_mode); |
1206 | inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); | 1213 | inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low); |
@@ -1224,6 +1231,7 @@ void ext2_read_inode (struct inode * inode) | |||
1224 | if (inode->i_nlink == 0 && (inode->i_mode == 0 || ei->i_dtime)) { | 1231 | if (inode->i_nlink == 0 && (inode->i_mode == 0 || ei->i_dtime)) { |
1225 | /* this inode is deleted */ | 1232 | /* this inode is deleted */ |
1226 | brelse (bh); | 1233 | brelse (bh); |
1234 | ret = -ESTALE; | ||
1227 | goto bad_inode; | 1235 | goto bad_inode; |
1228 | } | 1236 | } |
1229 | inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); | 1237 | inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); |
@@ -1290,11 +1298,12 @@ void ext2_read_inode (struct inode * inode) | |||
1290 | } | 1298 | } |
1291 | brelse (bh); | 1299 | brelse (bh); |
1292 | ext2_set_inode_flags(inode); | 1300 | ext2_set_inode_flags(inode); |
1293 | return; | 1301 | unlock_new_inode(inode); |
1302 | return inode; | ||
1294 | 1303 | ||
1295 | bad_inode: | 1304 | bad_inode: |
1296 | make_bad_inode(inode); | 1305 | iget_failed(inode); |
1297 | return; | 1306 | return ERR_PTR(ret); |
1298 | } | 1307 | } |
1299 | 1308 | ||
1300 | static int ext2_update_inode(struct inode * inode, int do_sync) | 1309 | static int ext2_update_inode(struct inode * inode, int do_sync) |