diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-10 09:26:05 +0900 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2012-12-11 13:43:45 +0900 |
commit | 3cd8a23948b29301f8f67b8d70c5c18fabbc05e1 (patch) | |
tree | e4d9c11d55446e547b4a7830d733126f17ef3e37 /fs/f2fs/data.c | |
parent | 457d08ee4fd91c8df17917ff2d32565e6adacbfc (diff) | |
download | op-kernel-dev-3cd8a23948b29301f8f67b8d70c5c18fabbc05e1.zip op-kernel-dev-3cd8a23948b29301f8f67b8d70c5c18fabbc05e1.tar.gz |
f2fs: cleanup the f2fs_bio_alloc routine
Do cleanup more for better code readability.
- Change the parameter set of f2fs_bio_alloc()
This function should allocate a bio only since it is not something like
f2fs_bio_init(). Instead, the caller should initialize the allocated bio.
- Introduce SECTOR_FROM_BLOCK
This macro translates a block address to its sector address.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r-- | fs/f2fs/data.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 444c2a6..655aeab 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -343,11 +343,12 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page, down_read(&sbi->bio_sem); /* Allocate a new bio */ - bio = f2fs_bio_alloc(bdev, blk_addr << (sbi->log_blocksize - 9), - 1, GFP_NOFS | __GFP_HIGH); + bio = f2fs_bio_alloc(bdev, 1); /* Initialize the bio */ + bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr); bio->bi_end_io = read_end_io; + if (bio_add_page(bio, page, PAGE_CACHE_SIZE, 0) < PAGE_CACHE_SIZE) { kfree(bio->bi_private); bio_put(bio); |