btrfs: use clear_page where appropriate
authorDavid Sterba <dsterba@suse.com>
Wed, 29 Mar 2017 18:48:44 +0000 (20:48 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Apr 2017 12:07:26 +0000 (14:07 +0200)
There's a helper to clear whole page, with a arch-specific optimized
code. The replaced cases do not seem to be in performace critical code,
but we still might get some percent gain.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-cache.c
fs/btrfs/scrub.c

index da6841efac26b1be3509ad3e410c34e72b253a65..c5e6180cdb8c9250e3a525e311a42795c4831c32 100644 (file)
@@ -355,7 +355,7 @@ static void io_ctl_map_page(struct btrfs_io_ctl *io_ctl, int clear)
        io_ctl->orig = io_ctl->cur;
        io_ctl->size = PAGE_SIZE;
        if (clear)
-               memset(io_ctl->cur, 0, PAGE_SIZE);
+               clear_page(io_ctl->cur);
 }
 
 static void io_ctl_drop_pages(struct btrfs_io_ctl *io_ctl)
index c4d1e60e831e1b85ea43c9763c2655fe7f0363c7..48dd6f170c364e95a6c9863a9dc66cb1cff7caf5 100644 (file)
@@ -1643,7 +1643,7 @@ static int scrub_write_page_to_dev_replace(struct scrub_block *sblock,
        if (spage->io_error) {
                void *mapped_buffer = kmap_atomic(spage->page);
 
-               memset(mapped_buffer, 0, PAGE_SIZE);
+               clear_page(mapped_buffer);
                flush_dcache_page(spage->page);
                kunmap_atomic(mapped_buffer);
        }