Skip to contentSkip to conversation

f2fs: fix iostat parameter for discard

PATCH In review Yangtao Li 3 participants 7 messages Dec 5, 2022 – Dec 15, 2022 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 f2fs: fix iostat parameter for discard

Just like other data we count uses the number of bytes as the basic unit, but discard uses the number of cmds as the statistical unit. In fact the discard command contains the number of blocks, so let's change to the number of bytes as the base unit.

Fixes b0af6d491a6b ("f2fs: add app/fs io stat")
---
 fs/f2fs/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
index 9486ca49ecb1..bc262e17b279 100644
@@ -1181,7 +1181,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
 
 		atomic_inc(&dcc->issued_discard);
 
-		f2fs_update_iostat(sbi, NULL, FS_DISCARD, 1);
+		f2fs_update_iostat(sbi, NULL, FS_DISCARD, len * F2FS_BLKSIZE);
 
 		lstart += len;
 		start += len;
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 17 lines · Yangtao Li

Just like other data we count uses the number of bytes as the basic unit, but discard uses the number of cmds as the statistical unit. In fact the discard command contains the number of blocks, so let's change to the number of bytes as the base unit.

Fixes b0af6d491a6b ("f2fs: add app/fs io stat")
---
  fs/f2fs/segment.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +0 -0
index 9486ca49ecb1..bc262e17b279 100644

fs/f2fs/segment.c static int __submit_discard_cmd(struct f2fs_sb_info *sbi, · line 1184

Quoted 5 lines
fs/f2fs/segment.c +1 -1
@@ -1181,7 +1181,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
 
  		atomic_inc(&dcc->issued_discard);
 
-		f2fs_update_iostat(sbi, NULL, FS_DISCARD, 1);
+		f2fs_update_iostat(sbi, NULL, FS_DISCARD, len * F2FS_BLKSIZE);

In order to avoid breaking its usage of application, how about keeping FS_DISCARD as it is, and add FS_DISCARD_IO to account discard bytes?

Thanks,

Quoted 3 lines
fs/f2fs/segment.c +0 -0
  		lstart += len;
  		start += len;
maintainer
#2 lore raw
Quoted 13 lines · Chao Yu
Quoted 12 lines · Yangtao Li

Just like other data we count uses the number of bytes as the basic unit, but discard uses the number of cmds as the statistical unit. In fact the discard command contains the number of blocks, so let's change to the number of bytes as the base unit.

Fixes b0af6d491a6b ("f2fs: add app/fs io stat")
---
  fs/f2fs/segment.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

fs/f2fs/segment.c static int __submit_discard_cmd(struct f2fs_sb_info *sbi, · line 1182

Quoted 8 lines
fs/f2fs/segment.c +1 -1
index 9486ca49ecb1..bc262e17b279 100644
@@ -1181,7 +1181,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
  		atomic_inc(&dcc->issued_discard);
-		f2fs_update_iostat(sbi, NULL, FS_DISCARD, 1);
+		f2fs_update_iostat(sbi, NULL, FS_DISCARD, len * F2FS_BLKSIZE);

In order to avoid breaking its usage of application, how about keeping FS_DISCARD as it is, and add FS_DISCARD_IO to account discard bytes?

I picked this to match the f2fs_update_iostat() definition. Do we know how many applications will be affected? I don't have any at a glance in Android tho.

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes)

Quoted 5 lines

Thanks,

Quoted 2 lines
fs/f2fs/segment.c +0 -0
  		lstart += len;
  		start += len;
maintainer
#3 lore raw
Quoted 26 lines · Jaegeuk Kim
Quoted 13 lines · Chao Yu
Quoted 12 lines · Yangtao Li

Just like other data we count uses the number of bytes as the basic unit, but discard uses the number of cmds as the statistical unit. In fact the discard command contains the number of blocks, so let's change to the number of bytes as the base unit.

Fixes b0af6d491a6b ("f2fs: add app/fs io stat")
---
   fs/f2fs/segment.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

fs/f2fs/segment.c static int __submit_discard_cmd(struct f2fs_sb_info *sbi, · line 1182

Quoted 8 lines
fs/f2fs/segment.c +1 -1
index 9486ca49ecb1..bc262e17b279 100644
@@ -1181,7 +1181,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
   		atomic_inc(&dcc->issued_discard);
-		f2fs_update_iostat(sbi, NULL, FS_DISCARD, 1);
+		f2fs_update_iostat(sbi, NULL, FS_DISCARD, len * F2FS_BLKSIZE);

In order to avoid breaking its usage of application, how about keeping FS_DISCARD as it is, and add FS_DISCARD_IO to account discard bytes?

Quoted 3 lines

I picked this to match the f2fs_update_iostat() definition. Do we know how many applications will be affected? I don't have any at a glance in Android tho.

I guess there is some private scripts in OEM rely on this, and I don't see any non-Android users using this.

Quoted 3 lines

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes)

What do you think of extending this function to support io_counts?

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes, unsigned long long io_counts)

Thanks,

Quoted 7 lines
Quoted 7 lines

Thanks,

Quoted 2 lines
fs/f2fs/segment.c +0 -0
   		lstart += len;
   		start += len;
author
#4 lore raw
Quoted 5 lines

What do you think of extending this function to support io_counts?

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes, unsigned long long io_counts)

Support to have extra io_count.

But I don't think there is any need to add additional parameters to f2fs_update_iostat. IIUC, each call to f2fs_update_iostat means that the corresponding count increases by 1, so only the internal processing of the function is required.

BTW, let's type out the iocount of the additional record in the following way?

time: 1670930162
[WRITE]
app buffered data: 4096(1)

Thx,
Yangtao

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

maintainer
#5 lore raw
Quoted 12 lines · Yangtao Li
Quoted 5 lines

What do you think of extending this function to support io_counts?

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes, unsigned long long io_counts)

Support to have extra io_count.

But I don't think there is any need to add additional parameters to f2fs_update_iostat. IIUC, each call to f2fs_update_iostat means that the corresponding count increases by 1, so only the internal processing of the function is required.

Quoted 5 lines

BTW, let's type out the iocount of the additional record in the following way?

time: 1670930162
[WRITE]
app buffered data: 4096(1)

How about giving in another columns with additional stats like avg. len/call or max. len?

app buffered data: 4096 1

Quoted 3 lines

Thx,
Yangtao

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

maintainer
#6 lore raw
Quoted 13 lines · Jaegeuk Kim
Quoted 12 lines · Yangtao Li
Quoted 5 lines

What do you think of extending this function to support io_counts?

void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode,
enum iostat_type type, unsigned long long io_bytes, unsigned long long io_counts)

Support to have extra io_count.

But I don't think there is any need to add additional parameters to f2fs_update_iostat. IIUC, each call to f2fs_update_iostat means that the corresponding count increases by 1, so only the internal processing of the function is required.

Quoted 7 lines
Quoted 5 lines

BTW, let's type out the iocount of the additional record in the following way?

time: 1670930162
[WRITE]
app buffered data: 4096(1)

How about giving in another columns with additional stats like avg. len/call or max. len?

Maybe call is better? w/ it we can calculate avg. len/call.

Thanks,

Quoted 6 lines

app buffered data: 4096 1

Quoted 3 lines

Thx,
Yangtao