linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: use cached state when dirtying pages during buffered write
@ 2017-10-31 18:55 fdmanana
  2017-11-06 15:50 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: fdmanana @ 2017-10-31 18:55 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

During a buffered IO write, we can have an extent state that we got when
we locked the range (if the range starts at an offset lower than eof), so
always pass it to btrfs_dirty_pages() so that setting the delalloc bit
in the range does not need to do a full search in the inode's io tree,
saving time and reducing the amount of time we hold the io tree's lock.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index e0d15c0d1641..aaab1838cece 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1755,7 +1755,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
 
 		if (copied > 0)
 			ret = btrfs_dirty_pages(inode, pages, dirty_pages,
-						pos, copied, NULL);
+						pos, copied, &cached_state);
 		if (need_unlock)
 			unlock_extent_cached(&BTRFS_I(inode)->io_tree,
 					     lockstart, lockend, &cached_state,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] Btrfs: use cached state when dirtying pages during buffered write
  2017-10-31 18:55 [PATCH 1/2] Btrfs: use cached state when dirtying pages during buffered write fdmanana
@ 2017-11-06 15:50 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-11-06 15:50 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Tue, Oct 31, 2017 at 06:55:40PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> During a buffered IO write, we can have an extent state that we got when
> we locked the range (if the range starts at an offset lower than eof), so
> always pass it to btrfs_dirty_pages() so that setting the delalloc bit
> in the range does not need to do a full search in the inode's io tree,
> saving time and reducing the amount of time we hold the io tree's lock.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-06 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 18:55 [PATCH 1/2] Btrfs: use cached state when dirtying pages during buffered write fdmanana
2017-11-06 15:50 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).