]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
f2fs: delete obsolete FI_FIRST_BLOCK_WRITTEN
authorChao Yu <chao@kernel.org>
Sun, 10 Dec 2023 09:20:35 +0000 (17:20 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:54 +0000 (18:20 -0400)
[ Upstream commit a53936361330e4c55c0654605178281387d9c761 ]

Commit 3c6c2bebef79 ("f2fs: avoid punch_hole overhead when releasing
volatile data") introduced FI_FIRST_BLOCK_WRITTEN as below reason:

This patch is to avoid some punch_hole overhead when releasing volatile
data. If volatile data was not written yet, we just can make the first
page as zero.

After commit 7bc155fec5b3 ("f2fs: kill volatile write support"), we
won't support volatile write, but it missed to remove obsolete
FI_FIRST_BLOCK_WRITTEN, delete it in this patch.

Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Stable-dep-of: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/compress.c
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/inode.c

index 553950962842ad9613de355752e4badfbfe1a9a6..5973fda2349c79cb0240777618fada7f8fb614d0 100644 (file)
@@ -1388,8 +1388,6 @@ unlock_continue:
        add_compr_block_stat(inode, cc->valid_nr_cpages);
 
        set_inode_flag(cc->inode, FI_APPEND_WRITE);
-       if (cc->cluster_idx == 0)
-               set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
 
        f2fs_put_dnode(&dn);
        if (quota_inode)
index 77b825fdeec85b28d5e9e0a30d1c53b134a3d64b..95e737fc75ef0a3d4b6ee9e941c66f94020f4a10 100644 (file)
@@ -2739,8 +2739,6 @@ got_it:
        f2fs_outplace_write_data(&dn, fio);
        trace_f2fs_do_write_data_page(page, OPU);
        set_inode_flag(inode, FI_APPEND_WRITE);
-       if (page->index == 0)
-               set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
 out_writepage:
        f2fs_put_dnode(&dn);
 out:
index 16dacf811481cac4b499c3a43cf96e358dd944c1..2364b6f7500b2f7c995f2088ab7f881ee57ee302 100644 (file)
@@ -764,7 +764,6 @@ enum {
        FI_UPDATE_WRITE,        /* inode has in-place-update data */
        FI_NEED_IPU,            /* used for ipu per file */
        FI_ATOMIC_FILE,         /* indicate atomic file */
-       FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */
        FI_DROP_CACHE,          /* drop dirty page cache */
        FI_DATA_EXIST,          /* indicate data exists */
        FI_INLINE_DOTS,         /* indicate inline dot dentries */
@@ -3248,11 +3247,6 @@ static inline bool f2fs_is_cow_file(struct inode *inode)
        return is_inode_flag_set(inode, FI_COW_FILE);
 }
 
-static inline bool f2fs_is_first_block_written(struct inode *inode)
-{
-       return is_inode_flag_set(inode, FI_FIRST_BLOCK_WRITTEN);
-}
-
 static inline bool f2fs_is_drop_cache(struct inode *inode)
 {
        return is_inode_flag_set(inode, FI_DROP_CACHE);
index 6c9f03e3be8e979b0ce2f62831b76cb70e076ee9..4d634b5b6011f3cf5eab11260a9e7e72835005a2 100644 (file)
@@ -602,9 +602,6 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count)
                                valid_blocks++;
                }
 
-               if (dn->ofs_in_node == 0 && IS_INODE(dn->node_page))
-                       clear_inode_flag(dn->inode, FI_FIRST_BLOCK_WRITTEN);
-
                f2fs_invalidate_blocks(sbi, blkaddr);
 
                if (!released || blkaddr != COMPRESS_ADDR)
index 8161355658562a7f51d8a766310737a9ae213e64..d4662ccb94c8f7a5e27522a91f387768b122f795 100644 (file)
@@ -1410,8 +1410,6 @@ static int move_data_block(struct inode *inode, block_t bidx,
 
        f2fs_update_data_blkaddr(&dn, newaddr);
        set_inode_flag(inode, FI_APPEND_WRITE);
-       if (page->index == 0)
-               set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
 put_page_out:
        f2fs_put_page(fio.encrypted_page, 1);
 recover_block:
index 0010579f1736832286417626fb0926ffb36c248d..f0f2584fed66ebb9260982d33ddf558af1c80776 100644 (file)
@@ -74,20 +74,6 @@ static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)
        }
 }
 
-static int __written_first_block(struct f2fs_sb_info *sbi,
-                                       struct f2fs_inode *ri)
-{
-       block_t addr = le32_to_cpu(ri->i_addr[offset_in_addr(ri)]);
-
-       if (!__is_valid_data_blkaddr(addr))
-               return 1;
-       if (!f2fs_is_valid_blkaddr(sbi, addr, DATA_GENERIC_ENHANCE)) {
-               f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
-               return -EFSCORRUPTED;
-       }
-       return 0;
-}
-
 static void __set_inode_rdev(struct inode *inode, struct f2fs_inode *ri)
 {
        int extra_size = get_extra_isize(inode);
@@ -336,7 +322,6 @@ static int do_read_inode(struct inode *inode)
        struct page *node_page;
        struct f2fs_inode *ri;
        projid_t i_projid;
-       int err;
 
        /* Check if ino is within scope */
        if (f2fs_check_nid_range(sbi, inode->i_ino))
@@ -417,16 +402,6 @@ static int do_read_inode(struct inode *inode)
        /* get rdev by using inline_info */
        __get_inode_rdev(inode, ri);
 
-       if (S_ISREG(inode->i_mode)) {
-               err = __written_first_block(sbi, ri);
-               if (err < 0) {
-                       f2fs_put_page(node_page, 1);
-                       return err;
-               }
-               if (!err)
-                       set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
-       }
-
        if (!f2fs_need_inode_block_update(sbi, inode->i_ino))
                fi->last_disk_size = inode->i_size;