Skip to contentSkip to conversation

f2fs: enable nowait async buffered writes

PATCH Superseded Yangtao Li 2 participants 4 messages May 31, 2023 – Jun 8, 2023 F2FS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 f2fs: enable nowait async buffered writes

This adds the async buffered write support to f2fs, the following is the relevant test data.

iodepth      | 1    | 2    | 4    | 8    | 16   |
before(M/s)  | 1012 | 1133 | 894  | 981  | 866  |
after(M/s)   | 1488 | 1896 | 2081 | 2188 | 2207 |
---
 fs/f2fs/file.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/f2fs/file.c +1 -4
index 23c68ee946e5..4faf2c04e325 100644
@@ -546,7 +546,7 @@ static int f2fs_file_open(struct inode *inode, struct file *filp)
 	if (err)
 		return err;
 
-	filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
+	filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
 
 	return dquot_file_open(inode, filp);
 }
@@ -4515,9 +4515,6 @@ static ssize_t f2fs_buffered_write_iter(struct kiocb *iocb,
 	struct inode *inode = file_inode(file);
 	ssize_t ret;
 
-	if (iocb->ki_flags & IOCB_NOWAIT)
-		return -EOPNOTSUPP;
-
 	current->backing_dev_info = inode_to_bdi(inode);
 	ret = generic_perform_write(iocb, from);
 	current->backing_dev_info = NULL;
Signature · 1 line
2.39.0
maintainer
#1 lore raw
Quoted 2 lines · Yangtao Li

This adds the async buffered write support to f2fs, the following is the relevant test data.

Yangtao,

Could you please provide detailed test command?

Thanks,

Quoted 34 lines
iodepth      | 1    | 2    | 4    | 8    | 16   |
before(M/s)  | 1012 | 1133 | 894  | 981  | 866  |
after(M/s)   | 1488 | 1896 | 2081 | 2188 | 2207 |
---
  fs/f2fs/file.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
fs/f2fs/file.c +1 -4
index 23c68ee946e5..4faf2c04e325 100644
@@ -546,7 +546,7 @@ static int f2fs_file_open(struct inode *inode, struct file *filp)
  	if (err)
  		return err;
 
-	filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
+	filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
 
  	return dquot_file_open(inode, filp);
  }
@@ -4515,9 +4515,6 @@ static ssize_t f2fs_buffered_write_iter(struct kiocb *iocb,
  	struct inode *inode = file_inode(file);
  	ssize_t ret;
 
-	if (iocb->ki_flags & IOCB_NOWAIT)
-		return -EOPNOTSUPP;
-
  	current->backing_dev_info = inode_to_bdi(inode);
  	ret = generic_perform_write(iocb, from);
  	current->backing_dev_info = NULL;
author
#2 lore raw
Quoted 7 lines · Chao Yu
Quoted 2 lines · Yangtao Li

This adds the async buffered write support to f2fs, the following is the relevant test data.

Yangtao,

Could you please provide detailed test command?

Use fio to test, the following is the configuration:

# io_uring
[global]
ioengine=io_uring
sqthread_poll=1
threads=1
iodepth=32
hipri=0
direct=0
fixedbufs=0
uncached=0
nowait=0
force_async=0
randrepeat=0
time_based=0
size=256M
filename=/data/test/local/io_uring_test
group_reporting
[read256B-rand]
bs=4096
rw=randwrite
numjobs=1
Quoted 36 lines

Thanks,

Quoted 33 lines

iodepth      | 1    | 2    | 4    | 8    | 16   | before(M/s)  | 1012 | 1133 | 894  | 981  | 866  | after(M/s)   | 1488 | 1896 | 2081 | 2188 | 2207 |

---
  fs/f2fs/file.c | 5 +----

  1 file changed, 1 insertion(+), 4 deletions(-)
fs/f2fs/file.c +1 -2
index 23c68ee946e5..4faf2c04e325 100644
@@ -546,7 +546,7 @@ static int f2fs_file_open(struct inode *inode, 
 struct file *filp)
       if (err)
           return err;
   -    filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
+    filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
         return dquot_file_open(inode, filp);
   }
@@ -4515,9 +4515,6 @@ static ssize_t f2fs_buffered_write_iter(struct 
 kiocb *iocb,
       struct inode *inode = file_inode(file);
       ssize_t ret;
   -    if (iocb->ki_flags & IOCB_NOWAIT)
-        return -EOPNOTSUPP;
-
       current->backing_dev_info = inode_to_bdi(inode);
       ret = generic_perform_write(iocb, from);

      current->backing_dev_info = NULL;

maintainer
#3 lore raw
Quoted 26 lines · Yangtao Li
Quoted 7 lines · Chao Yu
Quoted 2 lines · Yangtao Li

This adds the async buffered write support to f2fs, the following is the relevant test data.

Yangtao,

Could you please provide detailed test command?

Use fio to test, the following is the configuration:

# io_uring
[global]
ioengine=io_uring
sqthread_poll=1
threads=1
iodepth=32
hipri=0
direct=0
fixedbufs=0
uncached=0
nowait=0
force_async=0
randrepeat=0
Quoted 8 lines
time_based=0
size=256M
filename=/data/test/local/io_uring_test
group_reporting
[read256B-rand]
bs=4096
rw=randwrite
numjobs=1

Thanks, it looks the performance is not very stable when iodepth is large, e.g. 32.

Could you please add above test parameter into commit message?

Otherwise, this patch looks good to me.

Thanks,

Quoted 36 lines
Quoted 36 lines

Thanks,

Quoted 31 lines

iodepth      | 1    | 2    | 4    | 8    | 16   | before(M/s)  | 1012 | 1133 | 894  | 981  | 866  | after(M/s)   | 1488 | 1896 | 2081 | 2188 | 2207 |

---
  fs/f2fs/file.c | 5 +----

  1 file changed, 1 insertion(+), 4 deletions(-)
fs/f2fs/file.c +1 -2
index 23c68ee946e5..4faf2c04e325 100644
@@ -546,7 +546,7 @@ static int f2fs_file_open(struct inode *inode, struct file *filp)
       if (err)
           return err;
   -    filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
+    filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
         return dquot_file_open(inode, filp);
   }
@@ -4515,9 +4515,6 @@ static ssize_t f2fs_buffered_write_iter(struct kiocb *iocb,
       struct inode *inode = file_inode(file);
       ssize_t ret;
   -    if (iocb->ki_flags & IOCB_NOWAIT)
-        return -EOPNOTSUPP;
-
       current->backing_dev_info = inode_to_bdi(inode);
       ret = generic_perform_write(iocb, from);
       current->backing_dev_info = NULL;