Skip to content

Commit 32b6aba

Browse files
author
Jaegeuk Kim
committed
f2fs: add node_io_flag for bio flags likewise data_io_flag
This patch adds another way to attach bio flags to node writes. Description: Give a way to attach REQ_META|FUA to node writes given temperature-based bits. Now the bits indicate: * REQ_META | REQ_FUA | * 5 | 4 | 3 | 2 | 1 | 0 | * Cold | Warm | Hot | Cold | Warm | Hot | Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent bc67c5d commit 32b6aba

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,15 @@ Description: Give a way to attach REQ_META|FUA to data writes
333333
* 5 | 4 | 3 | 2 | 1 | 0 |
334334
* Cold | Warm | Hot | Cold | Warm | Hot |
335335

336+
What: /sys/fs/f2fs/<disk>/node_io_flag
337+
Date: June 2020
338+
Contact: "Jaegeuk Kim" <[email protected]>
339+
Description: Give a way to attach REQ_META|FUA to node writes
340+
given temperature-based bits. Now the bits indicate:
341+
* REQ_META | REQ_FUA |
342+
* 5 | 4 | 3 | 2 | 1 | 0 |
343+
* Cold | Warm | Hot | Cold | Warm | Hot |
344+
336345
What: /sys/fs/f2fs/<disk>/iostat_period_ms
337346
Date: April 2020
338347
Contact: "Daeho Jeong" <[email protected]>

fs/f2fs/data.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -514,22 +514,28 @@ void f2fs_submit_bio(struct f2fs_sb_info *sbi,
514514
__submit_bio(sbi, bio, type);
515515
}
516516

517-
static void __attach_data_io_flag(struct f2fs_io_info *fio)
517+
static void __attach_io_flag(struct f2fs_io_info *fio)
518518
{
519519
struct f2fs_sb_info *sbi = fio->sbi;
520520
unsigned int temp_mask = (1 << NR_TEMP_TYPE) - 1;
521-
unsigned int fua_flag = sbi->data_io_flag & temp_mask;
522-
unsigned int meta_flag = (sbi->data_io_flag >> NR_TEMP_TYPE) &
523-
temp_mask;
521+
unsigned int io_flag, fua_flag, meta_flag;
522+
523+
if (fio->type == DATA)
524+
io_flag = sbi->data_io_flag;
525+
else if (fio->type == NODE)
526+
io_flag = sbi->node_io_flag;
527+
else
528+
return;
529+
530+
fua_flag = io_flag & temp_mask;
531+
meta_flag = (io_flag >> NR_TEMP_TYPE) & temp_mask;
532+
524533
/*
525-
* data io flag bits per temp:
534+
* data/node io flag bits per temp:
526535
* REQ_META | REQ_FUA |
527536
* 5 | 4 | 3 | 2 | 1 | 0 |
528537
* Cold | Warm | Hot | Cold | Warm | Hot |
529538
*/
530-
if (fio->type != DATA)
531-
return;
532-
533539
if ((1 << fio->temp) & meta_flag)
534540
fio->op_flags |= REQ_META;
535541
if ((1 << fio->temp) & fua_flag)
@@ -543,7 +549,7 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
543549
if (!io->bio)
544550
return;
545551

546-
__attach_data_io_flag(fio);
552+
__attach_io_flag(fio);
547553
bio_set_op_attrs(io->bio, fio->op, fio->op_flags);
548554

549555
if (is_read_io(fio->op))

fs/f2fs/f2fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,7 @@ struct f2fs_sb_info {
15681568

15691569
/* to attach REQ_META|REQ_FUA flags */
15701570
unsigned int data_io_flag;
1571+
unsigned int node_io_flag;
15711572

15721573
/* For sysfs suppport */
15731574
struct kobject s_kobj;

fs/f2fs/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ F2FS_RW_ATTR(FAULT_INFO_RATE, f2fs_fault_info, inject_rate, inject_rate);
554554
F2FS_RW_ATTR(FAULT_INFO_TYPE, f2fs_fault_info, inject_type, inject_type);
555555
#endif
556556
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, data_io_flag, data_io_flag);
557+
F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, node_io_flag, node_io_flag);
557558
F2FS_GENERAL_RO_ATTR(dirty_segments);
558559
F2FS_GENERAL_RO_ATTR(free_segments);
559560
F2FS_GENERAL_RO_ATTR(lifetime_write_kbytes);
@@ -635,6 +636,7 @@ static struct attribute *f2fs_attrs[] = {
635636
ATTR_LIST(inject_type),
636637
#endif
637638
ATTR_LIST(data_io_flag),
639+
ATTR_LIST(node_io_flag),
638640
ATTR_LIST(dirty_segments),
639641
ATTR_LIST(free_segments),
640642
ATTR_LIST(unusable),

0 commit comments

Comments
 (0)