OSDN Git Service

btrfs: remove write and wait of struct walk_control
authorFilipe Manana <fdmanana@suse.com>
Tue, 4 Jan 2022 12:53:41 +0000 (12:53 +0000)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:46 +0000 (13:13 +0100)
The ->write and ->wait fields of struct walk_control, used for log trees,
are not used since 2008, more specifically since commit d0c803c4049c5c
("Btrfs: Record dirty pages tree-log pages in an extent_io tree") and
since commit d0c803c4049c5c ("Btrfs: Record dirty pages tree-log pages in
an extent_io tree"). So just remove them, along with the function
btrfs_write_tree_block(), which is also not used anymore after removing
the ->write member.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c

index 6bc8834..be4f45e 100644 (file)
@@ -270,12 +270,6 @@ void btrfs_end_log_trans(struct btrfs_root *root)
        }
 }
 
-static int btrfs_write_tree_block(struct extent_buffer *buf)
-{
-       return filemap_fdatawrite_range(buf->pages[0]->mapping, buf->start,
-                                       buf->start + buf->len - 1);
-}
-
 static void btrfs_wait_tree_block_writeback(struct extent_buffer *buf)
 {
        filemap_fdatawait_range(buf->pages[0]->mapping,
@@ -294,16 +288,6 @@ struct walk_control {
         */
        int free;
 
-       /* should we write out the extent buffer?  This is used
-        * while flushing the log tree to disk during a sync
-        */
-       int write;
-
-       /* should we wait for the extent buffer io to finish?  Also used
-        * while flushing the log tree to disk for a sync
-        */
-       int wait;
-
        /* pin only walk, we record which extents on disk belong to the
         * log trees
         */
@@ -354,17 +338,15 @@ static int process_one_buffer(struct btrfs_root *log,
                        return ret;
        }
 
-       if (wc->pin)
+       if (wc->pin) {
                ret = btrfs_pin_extent_for_log_replay(wc->trans, eb->start,
                                                      eb->len);
+               if (ret)
+                       return ret;
 
-       if (!ret && btrfs_buffer_uptodate(eb, gen, 0)) {
-               if (wc->pin && btrfs_header_level(eb) == 0)
+               if (btrfs_buffer_uptodate(eb, gen, 0) &&
+                   btrfs_header_level(eb) == 0)
                        ret = btrfs_exclude_logged_extents(eb);
-               if (wc->write)
-                       btrfs_write_tree_block(eb);
-               if (wc->wait)
-                       btrfs_wait_tree_block_writeback(eb);
        }
        return ret;
 }