f2fs: fix missing inplace count in overwrite with direct io
PATCH 1/1 f2fs: fix missing inplace count in overwrite with direct io
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)
fs/f2fs/data.c +6 -0
@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,if (flag ==F2FS_GET_BLOCK_DIO )f2fs_wait_on_block_writeback_range (inode, map->m_pblk, map->m_len); +if (!f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_add_inplace_blocks (sbi, map->m_len); goto out; }
@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr;set_inode_flag (inode,FI_APPEND_WRITE ); } +if (!create && !f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_inc_inplace_blocks (sbi); }else {if (create) {if (unlikely (f2fs_cp_error (sbi))) {
fs/f2fs/f2fs.h +2 -0
@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++)#define stat_inc_inplace_blocks (sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count))#define stat_update_max_atomic_write (inode) \ do { \ int cur = F2FS_I_SB(inode)->atomic_files; \
Signature · 8 lines
2.29.0 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Jaegeuk, thoughts?
Thanks,
Quoted 37 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)fs/f2fs/data.c +6
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,if (flag ==F2FS_GET_BLOCK_DIO )f2fs_wait_on_block_writeback_range (inode, map->m_pblk, map->m_len); +if (!f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_add_inplace_blocks (sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr;set_inode_flag (inode,FI_APPEND_WRITE ); } +if (!create && !f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_inc_inplace_blocks (sbi); }else {if (create) {if (unlikely (f2fs_cp_error (sbi))) {fs/f2fs/f2fs.h +0
-0
fs/f2fs/f2fs.h static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) · line 3811
Quoted 8 lines
fs/f2fs/f2fs.h +2
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++)#define stat_inc_inplace_blocks (sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count))#define stat_update_max_atomic_write (inode) \ do { \ int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 6 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Quoted 41 lines
Jaegeuk, thoughts?
Thanks,
Quoted 36 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)fs/f2fs/data.c +6
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,if (flag ==F2FS_GET_BLOCK_DIO )f2fs_wait_on_block_writeback_range (inode, map->m_pblk, map->m_len); +if (!f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_add_inplace_blocks (sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr;set_inode_flag (inode,FI_APPEND_WRITE ); } +if (!create && !f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_inc_inplace_blocks (sbi); }else {if (create) {if (unlikely (f2fs_cp_error (sbi))) {fs/f2fs/f2fs.h +0
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++)
Quoted 8 lines
fs/f2fs/f2fs.h static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) · line 3811
Quoted 8 lines
fs/f2fs/f2fs.h +2
-0#define stat_inc_inplace_blocks (sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count))#define stat_update_max_atomic_write (inode) \ do { \ int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 9 lines · Jaegeuk Kim
Quoted 6 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
Thanks,
Quoted 42 lines
Quoted 42 lines
Jaegeuk, thoughts?
Thanks,
Quoted 36 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)fs/f2fs/data.c +6
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map,if (flag ==F2FS_GET_BLOCK_DIO )f2fs_wait_on_block_writeback_range (inode, map->m_pblk, map->m_len); +if (!f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_add_inplace_blocks (sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr;set_inode_flag (inode,FI_APPEND_WRITE ); } +if (!create && !f2fs_lfs_mode (sbi) && flag ==F2FS_GET_BLOCK_DIO && + map->m_may_create) +stat_inc_inplace_blocks (sbi); }else {if (create) {if (unlikely (f2fs_cp_error (sbi))) {fs/f2fs/f2fs.h +0
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++)
Quoted 8 lines
Quoted 8 lines
fs/f2fs/f2fs.h static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) · line 3811
Quoted 8 lines
fs/f2fs/f2fs.h +2
-0#define stat_inc_inplace_blocks (sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count))#define stat_update_max_atomic_write (inode) \ do { \ int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 6 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim
Quoted 4 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
For now, LFS & SSR are count in DIO, but not count IPU, I think we should keep consistency.
Quoted 49 lines
Thanks,
Quoted 46 lines
Quoted 46 lines
Jaegeuk, thoughts?
Thanks,
Quoted 40 lines
Signed-off-by Fengnan Chang <[email protected]>---
fs/f2fs/data.c| 6 ++++++
fs/f2fs/f2fs.h| 2 ++2 files changed, 8 insertions(+)fs/f2fs/data.c +4
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (flag == F2FS_GET_BLOCK_DIO) f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + if (!f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO && + map->m_may_create) + stat_add_inplace_blocks(sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode,struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr; set_inode_flag(inode, FI_APPEND_WRITE); } + if (!create && !f2fs_lfs_mode(sbi) && flag ==
F2FS_GET_BLOCK_DIO&&
+map->m_may_create)
+stat_inc_inplace_blocks(sbi); } else {
if (create) {
if (unlikely(f2fs_cp_error(sbi))) {fs/f2fs/f2fs.h +0
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++)
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
fs/f2fs/f2fs.h +2
-0#define stat_inc_inplace_blocks(sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count)) #define stat_update_max_atomic_write(inode) \ do { \int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 9 lines · Fengnan Chang
Quoted 6 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim
Quoted 4 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
For now, LFS & SSR are count in DIO, but not count IPU, I think we
I guess it will account IOs which are fallbacking from DIO to buffered IO, so all DIOs are not accounted...
Thanks,
Quoted 60 lines
should keep consistency.
Quoted 58 lines
Thanks,
Quoted 54 lines
Quoted 54 lines
Jaegeuk, thoughts?
Thanks,
Quoted 48 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)fs/f2fs/data.c +4
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (flag == F2FS_GET_BLOCK_DIO) f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + if (!f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO && + map->m_may_create) + stat_add_inplace_blocks(sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode,struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr; set_inode_flag(inode, FI_APPEND_WRITE); } + if (!create && !f2fs_lfs_mode(sbi) && flag ==
F2FS_GET_BLOCK_DIO&&
+map->m_may_create)
+stat_inc_inplace_blocks(sbi);
} else {
if (create) {
if (unlikely(f2fs_cp_error(sbi))) {fs/f2fs/f2fs.h +2
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++) #define stat_inc_inplace_blocks(sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count)) #define stat_update_max_atomic_write(inode) \ do { \int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 13 lines · Chao Yu
Quoted 12 lines · Fengnan Chang
Quoted 9 lines · Chao Yu
Quoted 8 lines · Jaegeuk Kim
Quoted 6 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
For now, LFS & SSR are count in DIO, but not count IPU, I think we
I guess it will account IOs which are fallbacking from DIO to buffered IO, so all DIOs are not accounted...
It seems not, the account was done in f2fs_allocate_data_block->stat_inc_block_count, when direct + append write file, it will count DIO too, because stat_inc_block_count doesn't care about DIO or not.
root@kvm-xfstests:~# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3 [---------|-|----------------------------------------]
IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 0 blocks in 0 segments
root@kvm-xfstests:/mnt# dd if=/dev/zero of=./new oflag=direct bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.016008 s, 65.5 MB/s root@kvm-xfstests:/mnt# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3 [---------|-|----------------------------------------]
IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 256 blocks in 1 segments
BDF: 99, avg. vblocks: 226
Quoted 64 lines
Thanks,
Quoted 60 lines
should keep consistency.
Quoted 58 lines
Thanks,
Quoted 54 lines
Quoted 54 lines
Jaegeuk, thoughts?
Thanks,
Quoted 48 lines
Signed-off-by Fengnan Chang <[email protected]>---
fs/f2fs/data.c| 6 ++++++
fs/f2fs/f2fs.h| 2 ++2 files changed, 8 insertions(+)fs/f2fs/data.c +4
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (flag == F2FS_GET_BLOCK_DIO) f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + if (!f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO && + map->m_may_create) + stat_add_inplace_blocks(sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode,struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr; set_inode_flag(inode, FI_APPEND_WRITE); } + if (!create && !f2fs_lfs_mode(sbi) && flag ==
F2FS_GET_BLOCK_DIO&&
+map->m_may_create)
+stat_inc_inplace_blocks(sbi); } else {
if (create) {
if (unlikely(f2fs_cp_error(sbi))) {fs/f2fs/f2fs.h +2
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++) #define stat_inc_inplace_blocks(sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count)) #define stat_update_max_atomic_write(inode) \ do { \int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 22 lines · Fengnan Chang
Quoted 19 lines · Chao Yu
Quoted 17 lines · Fengnan Chang
Quoted 6 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim
Quoted 4 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
For now, LFS & SSR are count in DIO, but not count IPU, I think we
Quoted 7 lines
Quoted 2 lines
I guess it will account IOs which are fallbacking from DIO to buffered IO, so all DIOs are not accounted...
It seems not, the account was done in
f2fs_allocate_data_block->stat_inc_block_count, when direct + append write file, it will count DIO too, becausestat_inc_block_countdoesn't care about DIO or not.
Correct.
Quoted 7 lines
root@kvm-xfstests:~# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3 [---------|-|----------------------------------------]IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 0 blocks in 0 segments
Output like this?
buffer direct segments
IPU: N/A
SSR:
LFS:
Thanks,
Quoted 7 lines
root@kvm-xfstests:/mnt# dd if=/dev/zero of=./new oflag=direct bs=1M count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.016008 s, 65.5 MB/s
root@kvm-xfstests:/mnt# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3
[---------|-|----------------------------------------]Quoted 70 lines
IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 256 blocks in 1 segmentsBDF: 99, avg. vblocks: 226
Quoted 64 lines
Thanks,
Quoted 60 lines
should keep consistency.
Quoted 58 lines
Thanks,
Quoted 54 lines
Quoted 54 lines
Jaegeuk, thoughts?
Thanks,
Quoted 48 lines
Signed-off-by Fengnan Chang <[email protected]>--- fs/f2fs/data.c | 6 ++++++ fs/f2fs/f2fs.h | 2 ++ 2 files changed, 8 insertions(+)fs/f2fs/data.c +4
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (flag == F2FS_GET_BLOCK_DIO) f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + if (!f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO && + map->m_may_create) + stat_add_inplace_blocks(sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode,struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr; set_inode_flag(inode, FI_APPEND_WRITE); } + if (!create && !f2fs_lfs_mode(sbi) && flag ==
F2FS_GET_BLOCK_DIO&&
+map->m_may_create)
+stat_inc_inplace_blocks(sbi);
} else {
if (create) {
if (unlikely(f2fs_cp_error(sbi))) {fs/f2fs/f2fs.h +2
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++) #define stat_inc_inplace_blocks(sbi) \ (atomic_inc(&(sbi)->inplace_count)) +#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count)) #define stat_update_max_atomic_write(inode) \ do { \int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 41 lines · Chao Yu
Quoted 22 lines · Fengnan Chang
Quoted 19 lines · Chao Yu
Quoted 17 lines · Fengnan Chang
Quoted 6 lines · Chao Yu
Quoted 5 lines · Jaegeuk Kim
Quoted 4 lines · Chao Yu
Quoted 2 lines · Fengnan Chang
For now, overwrite file with direct io use inplace policy, but not counted, fix it.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
IMO, LFS/SSR/IPU stats in debugfs was for buffered write, maybe we need to add separated one for DIO.
Do we really need to monitor DIO stats?
Similar reason as we did for buffered IO?
For now, LFS & SSR are count in DIO, but not count IPU, I think we
Quoted 7 lines
Quoted 2 lines
I guess it will account IOs which are fallbacking from DIO to buffered IO, so all DIOs are not accounted...
It seems not, the account was done in
f2fs_allocate_data_block->stat_inc_block_count, when direct + append write file, it will count DIO too, becausestat_inc_block_countdoesn't care about DIO or not.Correct.
Quoted 7 lines
root@kvm-xfstests:~# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3 [---------|-|----------------------------------------]IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 0 blocks in 0 segments
Quoted 7 lines
Output like this?
buffer direct segments
IPU: N/A
SSR:
LFS:Thanks,
I like this, I will send a new patch later.
Thanks.
Quoted 70 lines
Quoted 70 lines
root@kvm-xfstests:/mnt# dd if=/dev/zero of=./new oflag=direct bs=1M count=1 1+0 records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.016008 s, 65.5 MB/s root@kvm-xfstests:/mnt# cat /sys/kernel/debug/f2fs/status |grep SSR -C 3 [---------|-|----------------------------------------]IPU: 0 blocks
SSR: 0 blocks in 0 segments
LFS: 256 blocks in 1 segmentsBDF: 99, avg. vblocks: 226
Quoted 56 lines
Thanks,
Quoted 53 lines
should keep consistency.
Quoted 51 lines
Thanks,
Quoted 48 lines
Quoted 48 lines
Jaegeuk, thoughts?
Thanks,
Quoted 42 lines
Signed-off-by Fengnan Chang <[email protected]>---
fs/f2fs/data.c| 6 ++++++
fs/f2fs/f2fs.h| 2 ++2 files changed, 8 insertions(+)fs/f2fs/data.c +4
-0@@ -1477,6 +1477,9 @@ int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, if (flag == F2FS_GET_BLOCK_DIO) f2fs_wait_on_block_writeback_range(inode, map->m_pblk, map->m_len); + if (!f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO && + map->m_may_create) + stat_add_inplace_blocks(sbi, map->m_len); goto out; }@@ -1526,6 +1529,9 @@ int f2fs_map_blocks(struct inode *inode,struct f2fs_map_blocks *map, blkaddr = dn.data_blkaddr; set_inode_flag(inode, FI_APPEND_WRITE); } + if (!create && !f2fs_lfs_mode(sbi) && flag ==
F2FS_GET_BLOCK_DIO&&
+map->m_may_create)
+stat_inc_inplace_blocks(sbi);
} else {
if (create) {
if (unlikely(f2fs_cp_error(sbi))) {fs/f2fs/f2fs.h +0
-0@@ -3804,6 +3804,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ((sbi)->block_count[(curseg)->alloc_type]++) #define stat_inc_inplace_blocks(sbi) \ (atomic_inc(&(sbi)->inplace_count))
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
fs/f2fs/f2fs.h +2
-0+#define stat_add_inplace_blocks (sbi, count) \ + (atomic_add(count, &(sbi)->inplace_count)) #define stat_update_max_atomic_write(inode) \ do { \int cur = F2FS_I_SB(inode)->atomic_files; \
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel