Skip to content

Commit

Permalink
f2fs: clean up __bio_alloc()'s parameter
Browse files Browse the repository at this point in the history
Just cleanup, no logic change.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Sep 6, 2019
1 parent 9ea2f0b commit b757f6e
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,26 +259,25 @@ static bool __same_bdev(struct f2fs_sb_info *sbi,
/*
* Low-level block read/write IO operations.
*/
static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
struct writeback_control *wbc,
int npages, bool is_read,
enum page_type type, enum temp_type temp)
static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
{
struct f2fs_sb_info *sbi = fio->sbi;
struct bio *bio;

bio = f2fs_bio_alloc(sbi, npages, true);

f2fs_target_device(sbi, blk_addr, bio);
if (is_read) {
f2fs_target_device(sbi, fio->new_blkaddr, bio);
if (is_read_io(fio->op)) {
bio->bi_end_io = f2fs_read_end_io;
bio->bi_private = NULL;
} else {
bio->bi_end_io = f2fs_write_end_io;
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)
wbc_init_bio(wbc, bio);
if (fio->io_wbc)
wbc_init_bio(fio->io_wbc, bio);

return bio;
}
Expand Down Expand Up @@ -461,8 +460,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
f2fs_trace_ios(fio, 0);

/* Allocate a new bio */
bio = __bio_alloc(fio->sbi, fio->new_blkaddr, fio->io_wbc,
1, is_read_io(fio->op), fio->type, fio->temp);
bio = __bio_alloc(fio, 1);

if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
bio_put(bio);
Expand Down Expand Up @@ -538,8 +536,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
}
alloc_new:
if (!bio) {
bio = __bio_alloc(fio->sbi, fio->new_blkaddr, fio->io_wbc,
BIO_MAX_PAGES, false, fio->type, fio->temp);
bio = __bio_alloc(fio, BIO_MAX_PAGES);
bio_set_op_attrs(bio, fio->op, fio->op_flags);
}

Expand Down Expand Up @@ -616,9 +613,7 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
fio->retry = true;
goto skip;
}
io->bio = __bio_alloc(sbi, fio->new_blkaddr, fio->io_wbc,
BIO_MAX_PAGES, false,
fio->type, fio->temp);
io->bio = __bio_alloc(fio, BIO_MAX_PAGES);
io->fio = *fio;
}

Expand Down

0 comments on commit b757f6e

Please sign in to comment.