Skip to contentSkip to conversation

f2fs: avoid unneeded preflush during checkpoint()

PATCH In review Chao Yu 2 participants 4 messages Feb 7, 2022 – Feb 8, 2022 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: avoid unneeded preflush during checkpoint()

During checkpoint, we have committed preflush command via f2fs_flush_device_cache() to persist all metadata pages except last #2 CP pack page, so we don't need to commit another preflush command in commit_checkpoint(), remove it to avoid unneeded write cache overhead.

---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +1 -1
index 8c417864c66a..15ac18bbbc8e 100644
@@ -598,7 +598,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
 		io->fio.op = REQ_OP_WRITE;
 		io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC;
 		if (!test_opt(sbi, NOBARRIER))
-			io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
+			io->fio.op_flags |= REQ_FUA;
 	}
 	__submit_merged_bio(io);
 	up_write(&io->io_rwsem);
Signature · 8 lines
2.32.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#1 lore raw
Quoted 1 line · Chao Yu

During checkpoint, we have committed preflush command via f2fs_flush_device_cache()

787 int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) 788 {
789 int ret = 0, i;
790
791 if (!f2fs_is_multi_device(sbi))
792 return 0;

Seems a wrong assumption.

Quoted 24 lines

to persist all metadata pages except last #2 CP pack page, so we don't need to commit another preflush command in commit_checkpoint(), remove it to avoid unneeded write cache overhead.

---
 fs/f2fs/data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/data.c +1 -1
index 8c417864c66a..15ac18bbbc8e 100644
@@ -598,7 +598,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
 		io->fio.op = REQ_OP_WRITE;
 		io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC;
 		if (!test_opt(sbi, NOBARRIER))
-			io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
+			io->fio.op_flags |= REQ_FUA;
 	}
 	__submit_merged_bio(io);
 	up_write(&io->io_rwsem);
Signature · 1 line
2.32.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author maintainer
#2 lore raw
Quoted 11 lines · Jaegeuk Kim
Quoted 1 line · Chao Yu

During checkpoint, we have committed preflush command via f2fs_flush_device_cache()

  787 int f2fs_flush_device_cache(struct f2fs_sb_info *sbi)
  788 {
  789         int ret = 0, i;
  790
  791         if (!f2fs_is_multi_device(sbi))
  792                 return 0;

Seems a wrong assumption.

Oh, I missed that f2fs_flush_device_cache was introduced to flush devices except first device when multi-device feature is on.

	for (i = 1; i < sbi->s_ndevs; i++) {
		int count = DEFAULT_RETRY_IO_COUNT;

So, this patch seems wrong...

Instead, below case looks wrong since it needs to trigger flush during checkpoint() no matter nobarrier is on or off.

	if (test_opt(sbi, NOBARRIER))
		return 0;

Thanks,

Quoted 10 lines
Quoted 10 lines

to persist all metadata pages except last #2 CP pack page, so we don't need to commit another preflush command in commit_checkpoint(), remove it to avoid unneeded write cache overhead.

---
  fs/f2fs/data.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 15 lines
fs/f2fs/data.c +1 -1
index 8c417864c66a..15ac18bbbc8e 100644
@@ -598,7 +598,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
  		io->fio.op = REQ_OP_WRITE;
  		io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC;
  		if (!test_opt(sbi, NOBARRIER))
-			io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
+			io->fio.op_flags |= REQ_FUA;
  	}
  	__submit_merged_bio(io);
  	up_write(&io->io_rwsem);
Signature · 1 line
2.32.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author maintainer
#3 lore raw
Quoted 16 lines · Chao Yu
Quoted 11 lines · Jaegeuk Kim
Quoted 1 line · Chao Yu

During checkpoint, we have committed preflush command via f2fs_flush_device_cache()

  787 int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) 788 {
  789         int ret = 0, i;
  790
  791         if (!f2fs_is_multi_device(sbi))
  792                 return 0;

Seems a wrong assumption.

Oh, I missed that f2fs_flush_device_cache was introduced to flush devices except first device when multi-device feature is on.

Quoted 7 lines

    for (i = 1; i < sbi->s_ndevs; i++) {
        int count = DEFAULT_RETRY_IO_COUNT;

So, this patch seems wrong...

Instead, below case looks wrong since it needs to trigger flush during checkpoint() no matter nobarrier is on or off.

Wrong comments, let's ignore this patch, sorry.

Thanks,

Quoted 37 lines

    if (test_opt(sbi, NOBARRIER))
        return 0;

Thanks,

Quoted 10 lines
Quoted 10 lines

to persist all metadata pages except last #2 CP pack page, so we don't need to commit another preflush command in commit_checkpoint(), remove it to avoid unneeded write cache overhead.

---
  fs/f2fs/data.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 15 lines
fs/f2fs/data.c +1 -1
index 8c417864c66a..15ac18bbbc8e 100644
@@ -598,7 +598,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi,
           io->fio.op = REQ_OP_WRITE;
           io->fio.op_flags = REQ_META | REQ_PRIO | REQ_SYNC;
           if (!test_opt(sbi, NOBARRIER))
-            io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
+            io->fio.op_flags |= REQ_FUA;
       }
       __submit_merged_bio(io);
       up_write(&io->io_rwsem);
Signature · 1 line
2.32.0

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel