Commit b757f6ed authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: clean up __bio_alloc()'s parameter

Just cleanup, no logic change.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 9ea2f0be
...@@ -259,26 +259,25 @@ static bool __same_bdev(struct f2fs_sb_info *sbi, ...@@ -259,26 +259,25 @@ static bool __same_bdev(struct f2fs_sb_info *sbi,
/* /*
* Low-level block read/write IO operations. * Low-level block read/write IO operations.
*/ */
static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr, static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
struct writeback_control *wbc,
int npages, bool is_read,
enum page_type type, enum temp_type temp)
{ {
struct f2fs_sb_info *sbi = fio->sbi;
struct bio *bio; struct bio *bio;
bio = f2fs_bio_alloc(sbi, npages, true); bio = f2fs_bio_alloc(sbi, npages, true);
f2fs_target_device(sbi, blk_addr, bio); f2fs_target_device(sbi, fio->new_blkaddr, bio);
if (is_read) { if (is_read_io(fio->op)) {
bio->bi_end_io = f2fs_read_end_io; bio->bi_end_io = f2fs_read_end_io;
bio->bi_private = NULL; bio->bi_private = NULL;
} else { } else {
bio->bi_end_io = f2fs_write_end_io; bio->bi_end_io = f2fs_write_end_io;
bio->bi_private = sbi; bio->bi_private = sbi;
bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi, type, temp); bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi,
fio->type, fio->temp);
} }
if (wbc) if (fio->io_wbc)
wbc_init_bio(wbc, bio); wbc_init_bio(fio->io_wbc, bio);
return bio; return bio;
} }
...@@ -461,8 +460,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) ...@@ -461,8 +460,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
f2fs_trace_ios(fio, 0); f2fs_trace_ios(fio, 0);
/* Allocate a new bio */ /* Allocate a new bio */
bio = __bio_alloc(fio->sbi, fio->new_blkaddr, fio->io_wbc, bio = __bio_alloc(fio, 1);
1, is_read_io(fio->op), fio->type, fio->temp);
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
bio_put(bio); bio_put(bio);
...@@ -538,8 +536,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) ...@@ -538,8 +536,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
} }
alloc_new: alloc_new:
if (!bio) { if (!bio) {
bio = __bio_alloc(fio->sbi, fio->new_blkaddr, fio->io_wbc, bio = __bio_alloc(fio, BIO_MAX_PAGES);
BIO_MAX_PAGES, false, fio->type, fio->temp);
bio_set_op_attrs(bio, fio->op, fio->op_flags); bio_set_op_attrs(bio, fio->op, fio->op_flags);
} }
...@@ -616,9 +613,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio) ...@@ -616,9 +613,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
fio->retry = true; fio->retry = true;
goto skip; goto skip;
} }
io->bio = __bio_alloc(sbi, fio->new_blkaddr, fio->io_wbc, io->bio = __bio_alloc(fio, BIO_MAX_PAGES);
BIO_MAX_PAGES, false,
fio->type, fio->temp);
io->fio = *fio; io->fio = *fio;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment