From: Josef Bacik Date: Mon, 1 Aug 2011 16:08:18 +0000 (-0400) Subject: Btrfs: skip looking for delalloc if we don't have ->fill_delalloc X-Git-Tag: v2.6.39-400.9.0~845^2~105 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1a3eded8882b3a70ad73666b2ff5609e4530a649;p=users%2Fjedix%2Flinux-maple.git Btrfs: skip looking for delalloc if we don't have ->fill_delalloc We always look for delalloc bytes in our io_tree so we can fill in delalloc. This is fine in most cases, but if we're writing out the btree_inode this is just a superfluous tree search on the io_tree, and if we have a lot of metadata dirty this could be an expensive check. So instead check to see if our io_tree has a ->fill_delalloc op, and if not don't even bother doing the lookup. Thanks, Signed-off-by: Josef Bacik (cherry picked from commit 9e4871070b5f070cacf26525389d56e0345ba156) --- diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index acd6e9996d60..28494c0b25c4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2511,6 +2511,7 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, int compressed; int write_flags; unsigned long nr_written = 0; + bool fill_delalloc = true; if (wbc->sync_mode == WB_SYNC_ALL) write_flags = WRITE_SYNC; @@ -2541,10 +2542,13 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc, set_page_extent_mapped(page); + if (!tree->ops || !tree->ops->fill_delalloc) + fill_delalloc = false; + delalloc_start = start; delalloc_end = 0; page_started = 0; - if (!epd->extent_locked) { + if (!epd->extent_locked && fill_delalloc) { u64 delalloc_to_write = 0; /* * make sure the wbc mapping index is at least updated