Skip to content

Commit 0adc2ab

Browse files
author
Jaegeuk Kim
committed
f2fs: keep io_flags to avoid IO split due to different op_flags in two fio holders
Let's attach io_flags to bio only, so that we can merge IOs given original io_flags only. Fixes: 64bf0ee ("f2fs: pass the bio operation to bio_alloc_bioset") Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 930e260 commit 0adc2ab

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

fs/f2fs/data.c

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,23 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr)
388388
return 0;
389389
}
390390

391-
static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag)
391+
static unsigned int f2fs_io_flags(struct f2fs_io_info *fio)
392392
{
393393
unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1;
394-
unsigned int fua_flag = io_flag & temp_mask;
395-
unsigned int meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask;
394+
unsigned int fua_flag, meta_flag, io_flag;
395+
unsigned int op_flags = 0;
396+
397+
if (fio->op != REQ_OP_WRITE)
398+
return 0;
399+
if (fio->type == DATA)
400+
io_flag = fio->sbi->data_io_flag;
401+
else if (fio->type == NODE)
402+
io_flag = fio->sbi->node_io_flag;
403+
else
404+
return 0;
405+
406+
fua_flag = io_flag & temp_mask;
407+
meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask;
396408

397409
/*
398410
* data/node io flag bits per temp:
@@ -401,9 +413,10 @@ static void __attach_io_flag(struct f2fs_io_info *fio, unsigned int io_flag)
401413
* Cold | Warm | Hot | Cold | Warm | Hot |
402414
*/
403415
if ((1 << fio->temp) & meta_flag)
404-
fio->op_flags |= REQ_META;
416+
op_flags |= REQ_META;
405417
if ((1 << fio->temp) & fua_flag)
406-
fio->op_flags |= REQ_FUA;
418+
op_flags |= REQ_FUA;
419+
return op_flags;
407420
}
408421

409422
static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
@@ -413,14 +426,10 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
413426
sector_t sector;
414427
struct bio *bio;
415428

416-
if (fio->type == DATA)
417-
__attach_io_flag(fio, sbi->data_io_flag);
418-
else if (fio->type == NODE)
419-
__attach_io_flag(fio, sbi->node_io_flag);
420-
421429
bdev = f2fs_target_device(sbi, fio->new_blkaddr, &sector);
422-
bio = bio_alloc_bioset(bdev, npages, fio->op | fio->op_flags, GFP_NOIO,
423-
&f2fs_bioset);
430+
bio = bio_alloc_bioset(bdev, npages,
431+
fio->op | fio->op_flags | f2fs_io_flags(fio),
432+
GFP_NOIO, &f2fs_bioset);
424433
bio->bi_iter.bi_sector = sector;
425434
if (is_read_io(fio->op)) {
426435
bio->bi_end_io = f2fs_read_end_io;

0 commit comments

Comments
 (0)