Btrfs: skip set_page_dirty if eb pages are already dirty
authorLiu Bo <bo.liu@linux.alibaba.com>
Thu, 13 Sep 2018 17:44:42 +0000 (01:44 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 15 Oct 2018 15:23:31 +0000 (17:23 +0200)
commitabb57ef3ff9720c42bbc06bcd1788da9ce1a3eb8
tree3fadcf36a6e3770833520651cfd2141520144e57
parent51995c399b73dacb9d84375ad5a8fda3aced03ab
Btrfs: skip set_page_dirty if eb pages are already dirty

As long as @eb is marked with EXTENT_BUFFER_DIRTY, all of its pages
are dirty, so no need to set pages dirty again.

Ftrace showed that the loop took 10us on my dev box, so removing this
can save us at least 10us if eb is already dirty and otherwise avoid a
potentially expensive calls to set_page_dirty.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h