OSDN Git Service

f2fs: clean up __bio_alloc()'s parameter
authorChao Yu <yuchao0@huawei.com>
Fri, 23 Aug 2019 09:58:35 +0000 (17:58 +0800)
committer0ranko0P <ranko0p@outlook.com>
Tue, 24 Dec 2019 20:42:25 +0000 (04:42 +0800)
Just cleanup, no logic change.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index f198ea9..6b38437 100644 (file)
@@ -266,26 +266,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;
 }
@@ -495,8 +494,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);
@@ -572,8 +570,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);
        }
 
@@ -650,9 +647,7 @@ alloc_new:
                        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;
        }