On 2021/8/18 11:49, Fengnan Chang wrote:


On 2021/8/13 9:36, Chao Yu wrote:
On 2021/8/13 5:15, Jaegeuk Kim wrote:
On 08/06, Chao Yu wrote:
On 2021/7/29 20:25, Fengnan Chang wrote:
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?

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,

should keep consistency.


Thanks,



Jaegeuk, thoughts?

Thanks,


Signed-off-by: Fengnan Chang <[email protected]>
---
    fs/f2fs/data.c | 6 ++++++
    fs/f2fs/f2fs.h | 2 ++
    2 files changed, 8 insertions(+)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index d2cf48c5a2e4..60510acf91ec 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -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))) {
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 867f2c5d9559..3a9df28e6fd7 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -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

Reply via email to