aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-06-27 19:16:02 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-06-27 19:16:02 -0400
commit1f7d1e77419050831a905353683807fa69a26625 (patch)
tree0f32626160b1ecab1e6067ff0e94746c3da068c4 /fs/ext4/inode.c
parent8bb2b247124ba6093455d4aef26743b1bef27bc5 (diff)
ext4: move __ext4_check_blockref to block_validity.c
In preparation for moving the indirect functions to a separate file, move __ext4_check_blockref() to block_validity.c and rename it to ext4_check_blockref() which is exported as globally visible function. Also, rename the cpp macro ext4_check_inode_blockref() to ext4_ind_check_inode(), to make it clear that it is only valid for use with non-extent mapped inodes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6c1d28e37235..3dca5264ccff 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -360,39 +360,6 @@ static int ext4_block_to_path(struct inode *inode,
360 return n; 360 return n;
361} 361}
362 362
363static int __ext4_check_blockref(const char *function, unsigned int line,
364 struct inode *inode,
365 __le32 *p, unsigned int max)
366{
367 struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
368 __le32 *bref = p;
369 unsigned int blk;
370
371 while (bref < p+max) {
372 blk = le32_to_cpu(*bref++);
373 if (blk &&
374 unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb),
375 blk, 1))) {
376 es->s_last_error_block = cpu_to_le64(blk);
377 ext4_error_inode(inode, function, line, blk,
378 "invalid block");
379 return -EIO;
380 }
381 }
382 return 0;
383}
384
385
386#define ext4_check_indirect_blockref(inode, bh) \
387 __ext4_check_blockref(__func__, __LINE__, inode, \
388 (__le32 *)(bh)->b_data, \
389 EXT4_ADDR_PER_BLOCK((inode)->i_sb))
390
391#define ext4_check_inode_blockref(inode) \
392 __ext4_check_blockref(__func__, __LINE__, inode, \
393 EXT4_I(inode)->i_data, \
394 EXT4_NDIR_BLOCKS)
395
396/** 363/**
397 * ext4_get_branch - read the chain of indirect blocks leading to data 364 * ext4_get_branch - read the chain of indirect blocks leading to data
398 * @inode: inode in question 365 * @inode: inode in question
@@ -5010,7 +4977,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
5010 (S_ISLNK(inode->i_mode) && 4977 (S_ISLNK(inode->i_mode) &&
5011 !ext4_inode_is_fast_symlink(inode))) { 4978 !ext4_inode_is_fast_symlink(inode))) {
5012 /* Validate block references which are part of inode */ 4979 /* Validate block references which are part of inode */
5013 ret = ext4_check_inode_blockref(inode); 4980 ret = ext4_ind_check_inode(inode);
5014 } 4981 }
5015 if (ret) 4982 if (ret)
5016 goto bad_inode; 4983 goto bad_inode;