diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-03-24 13:08:05 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-10 15:08:55 -0700 |
commit | 1b3e27a92ab60452b8fbb35e3ba691ac34f2c0fb (patch) | |
tree | 3c79a6bbc301de662b17b82b22969a927dd8fd17 /fs/f2fs/data.c | |
parent | 30c62fdb25cc0c55fa442245f7aaab074d2e701a (diff) |
f2fs: limit b_size of mapped bh in f2fs_map_bh
Map bh over max size which caller defined is not needed, limit it in
f2fs_map_bh.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 614e444e5297..93aae548cf80 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -255,15 +255,13 @@ static void f2fs_map_bh(struct super_block *sb, pgoff_t pgofs, struct extent_info *ei, struct buffer_head *bh_result) { unsigned int blkbits = sb->s_blocksize_bits; - size_t count; + size_t max_size = bh_result->b_size; + size_t mapped_size; clear_buffer_new(bh_result); map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs); - count = ei->fofs + ei->len - pgofs; - if (count < (UINT_MAX >> blkbits)) - bh_result->b_size = (count << blkbits); - else - bh_result->b_size = UINT_MAX; + mapped_size = (ei->fofs + ei->len - pgofs) << blkbits; + bh_result->b_size = min(max_size, mapped_size); } static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs, |