* fully convert f2fs to the new bio allocation interface @ 2022-02-28 12:41 ` Christoph Hellwig 0 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-f2fs-devel, linux-kernel Hi Jaegeuk and Chao, as of the for-5.18/block tree, the bio allocation interfaces expect the block_device and operation passed. This fixes f2fs up to match that scheme. It could go into Jens' alloc-cleanups branch if there are no conflicts in the f2fs tree. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [f2fs-dev] fully convert f2fs to the new bio allocation interface @ 2022-02-28 12:41 ` Christoph Hellwig 0 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-kernel, linux-f2fs-devel Hi Jaegeuk and Chao, as of the for-5.18/block tree, the bio allocation interfaces expect the block_device and operation passed. This fixes f2fs up to match that scheme. It could go into Jens' alloc-cleanups branch if there are no conflicts in the f2fs tree. _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig @ 2022-02-28 12:41 ` Christoph Hellwig -1 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-f2fs-devel, linux-kernel Set the bdev at bio allocation time by changing the f2fs_target_device calling conventions, so that no bio needs to be passed in. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/f2fs/data.c | 25 +++++++++++++------------ fs/f2fs/f2fs.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e71dde8de0db0..59dd0347c4bc8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -354,7 +354,7 @@ static void f2fs_write_end_io(struct bio *bio) } struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, - block_t blk_addr, struct bio *bio) + block_t blk_addr, sector_t *sector) { struct block_device *bdev = sbi->sb->s_bdev; int i; @@ -369,10 +369,9 @@ struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, } } } - if (bio) { - bio_set_dev(bio, bdev); - bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(blk_addr); - } + + if (sector) + *sector = SECTOR_FROM_BLOCK(blk_addr); return bdev; } @@ -392,11 +391,13 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) { struct f2fs_sb_info *sbi = fio->sbi; + struct block_device *bdev; + sector_t sector; struct bio *bio; - bio = bio_alloc_bioset(NULL, npages, 0, GFP_NOIO, &f2fs_bioset); - - f2fs_target_device(sbi, fio->new_blkaddr, bio); + bdev = f2fs_target_device(sbi, fio->new_blkaddr, §or); + bio = bio_alloc_bioset(bdev, npages, 0, GFP_NOIO, &f2fs_bioset); + bio->bi_iter.bi_sector = sector; if (is_read_io(fio->op)) { bio->bi_end_io = f2fs_read_end_io; bio->bi_private = NULL; @@ -984,15 +985,15 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, struct bio *bio; struct bio_post_read_ctx *ctx = NULL; unsigned int post_read_steps = 0; + sector_t sector; + struct block_device *bdev = f2fs_target_device(sbi, blkaddr, §or); - bio = bio_alloc_bioset(NULL, bio_max_segs(nr_pages), REQ_OP_READ, + bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), REQ_OP_READ, for_write ? GFP_NOIO : GFP_KERNEL, &f2fs_bioset); if (!bio) return ERR_PTR(-ENOMEM); - + bio->bi_iter.bi_sector = sector; f2fs_set_bio_crypt_ctx(bio, inode, first_idx, NULL, GFP_NOFS); - - f2fs_target_device(sbi, blkaddr, bio); bio->bi_end_io = f2fs_read_end_io; if (fscrypt_inode_uses_fs_layer_crypto(inode)) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index eb22fa91c2b26..37faae388fe01 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3631,7 +3631,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio); int f2fs_merge_page_bio(struct f2fs_io_info *fio); void f2fs_submit_page_write(struct f2fs_io_info *fio); struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, - block_t blk_addr, struct bio *bio); + block_t blk_addr, sector_t *sector); int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr); void f2fs_set_data_blkaddr(struct dnode_of_data *dn); void f2fs_update_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr); -- 2.30.2 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device @ 2022-02-28 12:41 ` Christoph Hellwig 0 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-kernel, linux-f2fs-devel Set the bdev at bio allocation time by changing the f2fs_target_device calling conventions, so that no bio needs to be passed in. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/f2fs/data.c | 25 +++++++++++++------------ fs/f2fs/f2fs.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index e71dde8de0db0..59dd0347c4bc8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -354,7 +354,7 @@ static void f2fs_write_end_io(struct bio *bio) } struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, - block_t blk_addr, struct bio *bio) + block_t blk_addr, sector_t *sector) { struct block_device *bdev = sbi->sb->s_bdev; int i; @@ -369,10 +369,9 @@ struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, } } } - if (bio) { - bio_set_dev(bio, bdev); - bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(blk_addr); - } + + if (sector) + *sector = SECTOR_FROM_BLOCK(blk_addr); return bdev; } @@ -392,11 +391,13 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) { struct f2fs_sb_info *sbi = fio->sbi; + struct block_device *bdev; + sector_t sector; struct bio *bio; - bio = bio_alloc_bioset(NULL, npages, 0, GFP_NOIO, &f2fs_bioset); - - f2fs_target_device(sbi, fio->new_blkaddr, bio); + bdev = f2fs_target_device(sbi, fio->new_blkaddr, §or); + bio = bio_alloc_bioset(bdev, npages, 0, GFP_NOIO, &f2fs_bioset); + bio->bi_iter.bi_sector = sector; if (is_read_io(fio->op)) { bio->bi_end_io = f2fs_read_end_io; bio->bi_private = NULL; @@ -984,15 +985,15 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, struct bio *bio; struct bio_post_read_ctx *ctx = NULL; unsigned int post_read_steps = 0; + sector_t sector; + struct block_device *bdev = f2fs_target_device(sbi, blkaddr, §or); - bio = bio_alloc_bioset(NULL, bio_max_segs(nr_pages), REQ_OP_READ, + bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), REQ_OP_READ, for_write ? GFP_NOIO : GFP_KERNEL, &f2fs_bioset); if (!bio) return ERR_PTR(-ENOMEM); - + bio->bi_iter.bi_sector = sector; f2fs_set_bio_crypt_ctx(bio, inode, first_idx, NULL, GFP_NOFS); - - f2fs_target_device(sbi, blkaddr, bio); bio->bi_end_io = f2fs_read_end_io; if (fscrypt_inode_uses_fs_layer_crypto(inode)) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index eb22fa91c2b26..37faae388fe01 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3631,7 +3631,7 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio); int f2fs_merge_page_bio(struct f2fs_io_info *fio); void f2fs_submit_page_write(struct f2fs_io_info *fio); struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, - block_t blk_addr, struct bio *bio); + block_t blk_addr, sector_t *sector); int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr); void f2fs_set_data_blkaddr(struct dnode_of_data *dn); void f2fs_update_data_blkaddr(struct dnode_of_data *dn, block_t blkaddr); -- 2.30.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig @ 2022-03-01 2:48 ` Chao Yu -1 siblings, 0 replies; 20+ messages in thread From: Chao Yu @ 2022-03-01 2:48 UTC (permalink / raw) To: Christoph Hellwig, Jaegeuk Kim; +Cc: Jens Axboe, linux-f2fs-devel, linux-kernel On 2022/2/28 20:41, Christoph Hellwig wrote: > Set the bdev at bio allocation time by changing the f2fs_target_device > calling conventions, so that no bio needs to be passed in. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device @ 2022-03-01 2:48 ` Chao Yu 0 siblings, 0 replies; 20+ messages in thread From: Chao Yu @ 2022-03-01 2:48 UTC (permalink / raw) To: Christoph Hellwig, Jaegeuk Kim; +Cc: Jens Axboe, linux-kernel, linux-f2fs-devel On 2022/2/28 20:41, Christoph Hellwig wrote: > Set the bdev at bio allocation time by changing the f2fs_target_device > calling conventions, so that no bio needs to be passed in. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device 2022-03-01 2:48 ` [f2fs-dev] " Chao Yu @ 2022-03-09 21:56 ` Jaegeuk Kim -1 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 21:56 UTC (permalink / raw) To: Chao Yu; +Cc: Christoph Hellwig, Jens Axboe, linux-f2fs-devel, linux-kernel On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Set the bdev at bio allocation time by changing the f2fs_target_device > > calling conventions, so that no bio needs to be passed in. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Acked-by: Jaegeuk Kim <jaegeuk@kernel.org> > > Thanks, ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device @ 2022-03-09 21:56 ` Jaegeuk Kim 0 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 21:56 UTC (permalink / raw) To: Chao Yu; +Cc: Jens Axboe, linux-kernel, Christoph Hellwig, linux-f2fs-devel On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Set the bdev at bio allocation time by changing the f2fs_target_device > > calling conventions, so that no bio needs to be passed in. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Acked-by: Jaegeuk Kim <jaegeuk@kernel.org> > > Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig @ 2022-02-28 12:41 ` Christoph Hellwig -1 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-f2fs-devel, linux-kernel Refactor block I/O code so that the bio operation and known flags are set at bio allocation time. Only the later updated flags are updated on the fly. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/f2fs/data.c | 70 +++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 59dd0347c4bc8..fc077bce679d9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -388,6 +388,24 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) return 0; } +static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag) +{ + unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; + unsigned int fua_flag = io_flag & temp_mask; + unsigned int meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; + + /* + * data/node io flag bits per temp: + * REQ_META | REQ_FUA | + * 5 | 4 | 3 | 2 | 1 | 0 | + * Cold | Warm | Hot | Cold | Warm | Hot | + */ + if ((1 << fio->temp) & meta_flag) + fio->op_flags |= REQ_META; + if ((1 << fio->temp) & fua_flag) + fio->op_flags |= REQ_FUA; +} + static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) { struct f2fs_sb_info *sbi = fio->sbi; @@ -395,8 +413,14 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) sector_t sector; struct bio *bio; + if (fio->type == DATA) + __attach_io_flag(fio, sbi->data_io_flag); + else if (fio->type == NODE) + __attach_io_flag(fio, sbi->node_io_flag); + bdev = f2fs_target_device(sbi, fio->new_blkaddr, §or); - bio = bio_alloc_bioset(bdev, npages, 0, GFP_NOIO, &f2fs_bioset); + bio = bio_alloc_bioset(bdev, npages, fio->op | fio->op_flags, GFP_NOIO, + &f2fs_bioset); bio->bi_iter.bi_sector = sector; if (is_read_io(fio->op)) { bio->bi_end_io = f2fs_read_end_io; @@ -501,34 +525,6 @@ void f2fs_submit_bio(struct f2fs_sb_info *sbi, __submit_bio(sbi, bio, type); } -static void __attach_io_flag(struct f2fs_io_info *fio) -{ - struct f2fs_sb_info *sbi = fio->sbi; - unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; - unsigned int io_flag, fua_flag, meta_flag; - - if (fio->type == DATA) - io_flag = sbi->data_io_flag; - else if (fio->type == NODE) - io_flag = sbi->node_io_flag; - else - return; - - fua_flag = io_flag & temp_mask; - meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; - - /* - * data/node io flag bits per temp: - * REQ_META | REQ_FUA | - * 5 | 4 | 3 | 2 | 1 | 0 | - * Cold | Warm | Hot | Cold | Warm | Hot | - */ - if ((1 << fio->temp) & meta_flag) - fio->op_flags |= REQ_META; - if ((1 << fio->temp) & fua_flag) - fio->op_flags |= REQ_FUA; -} - static void __submit_merged_bio(struct f2fs_bio_info *io) { struct f2fs_io_info *fio = &io->fio; @@ -536,9 +532,6 @@ static void __submit_merged_bio(struct f2fs_bio_info *io) if (!io->bio) return; - __attach_io_flag(fio); - bio_set_op_attrs(io->bio, fio->op, fio->op_flags); - if (is_read_io(fio->op)) trace_f2fs_prepare_read_bio(io->sbi->sb, fio->type, io->bio); else @@ -596,10 +589,9 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, /* change META to META_FLUSH in the checkpoint procedure */ if (type >= META_FLUSH) { io->fio.type = META_FLUSH; - io->fio.op = REQ_OP_WRITE; - io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC; + io->bio->bi_opf |= REQ_META | REQ_PRIO | REQ_SYNC; if (!test_opt(sbi, NOBARRIER)) - io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA; + io->bio->bi_opf |= REQ_PREFLUSH | REQ_FUA; } __submit_merged_bio(io); up_write(&io->io_rwsem); @@ -680,9 +672,6 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) if (fio->io_wbc && !is_read_io(fio->op)) wbc_account_cgroup_owner(fio->io_wbc, page, PAGE_SIZE); - __attach_io_flag(fio); - bio_set_op_attrs(bio, fio->op, fio->op_flags); - inc_page_count(fio->sbi, is_read_io(fio->op) ? __read_io_type(page): WB_DATA_TYPE(fio->page)); @@ -876,10 +865,8 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) alloc_new: if (!bio) { bio = __bio_alloc(fio, BIO_MAX_VECS); - __attach_io_flag(fio); f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host, fio->page->index, fio, GFP_NOIO); - bio_set_op_attrs(bio, fio->op, fio->op_flags); add_bio_entry(fio->sbi, bio, page, fio->temp); } else { @@ -988,7 +975,8 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, sector_t sector; struct block_device *bdev = f2fs_target_device(sbi, blkaddr, §or); - bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), REQ_OP_READ, + bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), + REQ_OP_READ | op_flag, for_write ? GFP_NOIO : GFP_KERNEL, &f2fs_bioset); if (!bio) return ERR_PTR(-ENOMEM); -- 2.30.2 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-02-28 12:41 ` Christoph Hellwig 0 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-02-28 12:41 UTC (permalink / raw) To: Jaegeuk Kim, Chao Yu; +Cc: Jens Axboe, linux-kernel, linux-f2fs-devel Refactor block I/O code so that the bio operation and known flags are set at bio allocation time. Only the later updated flags are updated on the fly. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/f2fs/data.c | 70 +++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 59dd0347c4bc8..fc077bce679d9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -388,6 +388,24 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) return 0; } +static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag) +{ + unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; + unsigned int fua_flag = io_flag & temp_mask; + unsigned int meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; + + /* + * data/node io flag bits per temp: + * REQ_META | REQ_FUA | + * 5 | 4 | 3 | 2 | 1 | 0 | + * Cold | Warm | Hot | Cold | Warm | Hot | + */ + if ((1 << fio->temp) & meta_flag) + fio->op_flags |= REQ_META; + if ((1 << fio->temp) & fua_flag) + fio->op_flags |= REQ_FUA; +} + static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) { struct f2fs_sb_info *sbi = fio->sbi; @@ -395,8 +413,14 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages) sector_t sector; struct bio *bio; + if (fio->type == DATA) + __attach_io_flag(fio, sbi->data_io_flag); + else if (fio->type == NODE) + __attach_io_flag(fio, sbi->node_io_flag); + bdev = f2fs_target_device(sbi, fio->new_blkaddr, §or); - bio = bio_alloc_bioset(bdev, npages, 0, GFP_NOIO, &f2fs_bioset); + bio = bio_alloc_bioset(bdev, npages, fio->op | fio->op_flags, GFP_NOIO, + &f2fs_bioset); bio->bi_iter.bi_sector = sector; if (is_read_io(fio->op)) { bio->bi_end_io = f2fs_read_end_io; @@ -501,34 +525,6 @@ void f2fs_submit_bio(struct f2fs_sb_info *sbi, __submit_bio(sbi, bio, type); } -static void __attach_io_flag(struct f2fs_io_info *fio) -{ - struct f2fs_sb_info *sbi = fio->sbi; - unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1; - unsigned int io_flag, fua_flag, meta_flag; - - if (fio->type == DATA) - io_flag = sbi->data_io_flag; - else if (fio->type == NODE) - io_flag = sbi->node_io_flag; - else - return; - - fua_flag = io_flag & temp_mask; - meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask; - - /* - * data/node io flag bits per temp: - * REQ_META | REQ_FUA | - * 5 | 4 | 3 | 2 | 1 | 0 | - * Cold | Warm | Hot | Cold | Warm | Hot | - */ - if ((1 << fio->temp) & meta_flag) - fio->op_flags |= REQ_META; - if ((1 << fio->temp) & fua_flag) - fio->op_flags |= REQ_FUA; -} - static void __submit_merged_bio(struct f2fs_bio_info *io) { struct f2fs_io_info *fio = &io->fio; @@ -536,9 +532,6 @@ static void __submit_merged_bio(struct f2fs_bio_info *io) if (!io->bio) return; - __attach_io_flag(fio); - bio_set_op_attrs(io->bio, fio->op, fio->op_flags); - if (is_read_io(fio->op)) trace_f2fs_prepare_read_bio(io->sbi->sb, fio->type, io->bio); else @@ -596,10 +589,9 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, /* change META to META_FLUSH in the checkpoint procedure */ if (type >= META_FLUSH) { io->fio.type = META_FLUSH; - io->fio.op = REQ_OP_WRITE; - io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC; + io->bio->bi_opf |= REQ_META | REQ_PRIO | REQ_SYNC; if (!test_opt(sbi, NOBARRIER)) - io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA; + io->bio->bi_opf |= REQ_PREFLUSH | REQ_FUA; } __submit_merged_bio(io); up_write(&io->io_rwsem); @@ -680,9 +672,6 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) if (fio->io_wbc && !is_read_io(fio->op)) wbc_account_cgroup_owner(fio->io_wbc, page, PAGE_SIZE); - __attach_io_flag(fio); - bio_set_op_attrs(bio, fio->op, fio->op_flags); - inc_page_count(fio->sbi, is_read_io(fio->op) ? __read_io_type(page): WB_DATA_TYPE(fio->page)); @@ -876,10 +865,8 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) alloc_new: if (!bio) { bio = __bio_alloc(fio, BIO_MAX_VECS); - __attach_io_flag(fio); f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host, fio->page->index, fio, GFP_NOIO); - bio_set_op_attrs(bio, fio->op, fio->op_flags); add_bio_entry(fio->sbi, bio, page, fio->temp); } else { @@ -988,7 +975,8 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr, sector_t sector; struct block_device *bdev = f2fs_target_device(sbi, blkaddr, §or); - bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), REQ_OP_READ, + bio = bio_alloc_bioset(bdev, bio_max_segs(nr_pages), + REQ_OP_READ | op_flag, for_write ? GFP_NOIO : GFP_KERNEL, &f2fs_bioset); if (!bio) return ERR_PTR(-ENOMEM); -- 2.30.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig @ 2022-03-01 2:49 ` Chao Yu -1 siblings, 0 replies; 20+ messages in thread From: Chao Yu @ 2022-03-01 2:49 UTC (permalink / raw) To: Christoph Hellwig, Jaegeuk Kim; +Cc: Jens Axboe, linux-f2fs-devel, linux-kernel On 2022/2/28 20:41, Christoph Hellwig wrote: > Refactor block I/O code so that the bio operation and known flags are set > at bio allocation time. Only the later updated flags are updated on the > fly. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-03-01 2:49 ` Chao Yu 0 siblings, 0 replies; 20+ messages in thread From: Chao Yu @ 2022-03-01 2:49 UTC (permalink / raw) To: Christoph Hellwig, Jaegeuk Kim; +Cc: Jens Axboe, linux-kernel, linux-f2fs-devel On 2022/2/28 20:41, Christoph Hellwig wrote: > Refactor block I/O code so that the bio operation and known flags are set > at bio allocation time. Only the later updated flags are updated on the > fly. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-03-01 2:49 ` [f2fs-dev] " Chao Yu @ 2022-03-08 6:06 ` Christoph Hellwig -1 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-03-08 6:06 UTC (permalink / raw) To: Chao Yu Cc: Christoph Hellwig, Jaegeuk Kim, Jens Axboe, linux-f2fs-devel, linux-kernel On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: >> Refactor block I/O code so that the bio operation and known flags are set >> at bio allocation time. Only the later updated flags are updated on the >> fly. >> >> Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Is it okay for Jens to pick these two patches up in the https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups branch? > > Thanks, ---end quoted text--- ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-03-08 6:06 ` Christoph Hellwig 0 siblings, 0 replies; 20+ messages in thread From: Christoph Hellwig @ 2022-03-08 6:06 UTC (permalink / raw) To: Chao Yu Cc: Jens Axboe, Jaegeuk Kim, Christoph Hellwig, linux-kernel, linux-f2fs-devel On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: >> Refactor block I/O code so that the bio operation and known flags are set >> at bio allocation time. Only the later updated flags are updated on the >> fly. >> >> Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Is it okay for Jens to pick these two patches up in the https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups branch? > > Thanks, ---end quoted text--- _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-03-08 6:06 ` [f2fs-dev] " Christoph Hellwig @ 2022-03-09 0:59 ` Jens Axboe -1 siblings, 0 replies; 20+ messages in thread From: Jens Axboe @ 2022-03-09 0:59 UTC (permalink / raw) To: Christoph Hellwig, Chao Yu; +Cc: Jaegeuk Kim, linux-f2fs-devel, linux-kernel On 3/7/22 11:06 PM, Christoph Hellwig wrote: > On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: >> On 2022/2/28 20:41, Christoph Hellwig wrote: >>> Refactor block I/O code so that the bio operation and known flags are set >>> at bio allocation time. Only the later updated flags are updated on the >>> fly. >>> >>> Signed-off-by: Christoph Hellwig <hch@lst.de> >> >> Reviewed-by: Chao Yu <chao@kernel.org> > > Is it okay for Jens to pick these two patches up in the > https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups > branch? I have tentatively done so, let me know you prefer doing it differently. -- Jens Axboe ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-03-09 0:59 ` Jens Axboe 0 siblings, 0 replies; 20+ messages in thread From: Jens Axboe @ 2022-03-09 0:59 UTC (permalink / raw) To: Christoph Hellwig, Chao Yu; +Cc: Jaegeuk Kim, linux-kernel, linux-f2fs-devel On 3/7/22 11:06 PM, Christoph Hellwig wrote: > On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: >> On 2022/2/28 20:41, Christoph Hellwig wrote: >>> Refactor block I/O code so that the bio operation and known flags are set >>> at bio allocation time. Only the later updated flags are updated on the >>> fly. >>> >>> Signed-off-by: Christoph Hellwig <hch@lst.de> >> >> Reviewed-by: Chao Yu <chao@kernel.org> > > Is it okay for Jens to pick these two patches up in the > https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups > branch? I have tentatively done so, let me know you prefer doing it differently. -- Jens Axboe _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-03-09 0:59 ` [f2fs-dev] " Jens Axboe @ 2022-03-09 22:03 ` Jaegeuk Kim -1 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 22:03 UTC (permalink / raw) To: Jens Axboe; +Cc: Christoph Hellwig, Chao Yu, linux-f2fs-devel, linux-kernel Hi Jens, On 03/08, Jens Axboe wrote: > On 3/7/22 11:06 PM, Christoph Hellwig wrote: > > On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: > >> On 2022/2/28 20:41, Christoph Hellwig wrote: > >>> Refactor block I/O code so that the bio operation and known flags are set > >>> at bio allocation time. Only the later updated flags are updated on the > >>> fly. > >>> > >>> Signed-off-by: Christoph Hellwig <hch@lst.de> > >> > >> Reviewed-by: Chao Yu <chao@kernel.org> > > > > Is it okay for Jens to pick these two patches up in the > > https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups > > branch? > > I have tentatively done so, let me know you prefer doing it differently. I've acked to the patches, and it seems they need to be landed in block. Thank you. > > -- > Jens Axboe ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-03-09 22:03 ` Jaegeuk Kim 0 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 22:03 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel, Christoph Hellwig, linux-f2fs-devel Hi Jens, On 03/08, Jens Axboe wrote: > On 3/7/22 11:06 PM, Christoph Hellwig wrote: > > On Tue, Mar 01, 2022 at 10:49:06AM +0800, Chao Yu wrote: > >> On 2022/2/28 20:41, Christoph Hellwig wrote: > >>> Refactor block I/O code so that the bio operation and known flags are set > >>> at bio allocation time. Only the later updated flags are updated on the > >>> fly. > >>> > >>> Signed-off-by: Christoph Hellwig <hch@lst.de> > >> > >> Reviewed-by: Chao Yu <chao@kernel.org> > > > > Is it okay for Jens to pick these two patches up in the > > https://git.kernel.dk/cgit/linux-block/log/?h=for-5.18/alloc-cleanups > > branch? > > I have tentatively done so, let me know you prefer doing it differently. I've acked to the patches, and it seems they need to be landed in block. Thank you. > > -- > Jens Axboe _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset 2022-03-01 2:49 ` [f2fs-dev] " Chao Yu @ 2022-03-09 22:02 ` Jaegeuk Kim -1 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 22:02 UTC (permalink / raw) To: Chao Yu; +Cc: Christoph Hellwig, Jens Axboe, linux-f2fs-devel, linux-kernel On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Refactor block I/O code so that the bio operation and known flags are set > > at bio allocation time. Only the later updated flags are updated on the > > fly. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Acked-by: Jaegeuk Kim <jaegeuk@kernel.org> > > Thanks, ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [f2fs-dev] [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset @ 2022-03-09 22:02 ` Jaegeuk Kim 0 siblings, 0 replies; 20+ messages in thread From: Jaegeuk Kim @ 2022-03-09 22:02 UTC (permalink / raw) To: Chao Yu; +Cc: Jens Axboe, linux-kernel, Christoph Hellwig, linux-f2fs-devel On 03/01, Chao Yu wrote: > On 2022/2/28 20:41, Christoph Hellwig wrote: > > Refactor block I/O code so that the bio operation and known flags are set > > at bio allocation time. Only the later updated flags are updated on the > > fly. > > > > Signed-off-by: Christoph Hellwig <hch@lst.de> > > Reviewed-by: Chao Yu <chao@kernel.org> Acked-by: Jaegeuk Kim <jaegeuk@kernel.org> > > Thanks, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2022-03-09 22:04 UTC | newest] Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-02-28 12:41 fully convert f2fs to the new bio allocation interface Christoph Hellwig 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig 2022-02-28 12:41 ` [PATCH 1/2] f2fs: don't pass a bio to f2fs_target_device Christoph Hellwig 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig 2022-03-01 2:48 ` Chao Yu 2022-03-01 2:48 ` [f2fs-dev] " Chao Yu 2022-03-09 21:56 ` Jaegeuk Kim 2022-03-09 21:56 ` [f2fs-dev] " Jaegeuk Kim 2022-02-28 12:41 ` [PATCH 2/2] f2fs: pass the bio operation to bio_alloc_bioset Christoph Hellwig 2022-02-28 12:41 ` [f2fs-dev] " Christoph Hellwig 2022-03-01 2:49 ` Chao Yu 2022-03-01 2:49 ` [f2fs-dev] " Chao Yu 2022-03-08 6:06 ` Christoph Hellwig 2022-03-08 6:06 ` [f2fs-dev] " Christoph Hellwig 2022-03-09 0:59 ` Jens Axboe 2022-03-09 0:59 ` [f2fs-dev] " Jens Axboe 2022-03-09 22:03 ` Jaegeuk Kim 2022-03-09 22:03 ` [f2fs-dev] " Jaegeuk Kim 2022-03-09 22:02 ` Jaegeuk Kim 2022-03-09 22:02 ` [f2fs-dev] " Jaegeuk Kim
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.