All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work
@ 2013-03-11  9:20 Liu Bo
  2013-03-11 17:26 ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Liu Bo @ 2013-03-11  9:20 UTC (permalink / raw)
  To: linux-btrfs

Using spinning case instead of blocking will result in better concurrency
overall.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/inode.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 13ab4de..1f268888 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2312,6 +2312,7 @@ again:
 	key.type = BTRFS_EXTENT_DATA_KEY;
 	key.offset = start;
 
+	path->leave_spinning = 1;
 	if (merge) {
 		struct btrfs_file_extent_item *fi;
 		u64 extent_len;
@@ -2368,6 +2369,7 @@ again:
 
 	btrfs_mark_buffer_dirty(leaf);
 	inode_add_bytes(inode, len);
+	btrfs_release_path(path);
 
 	ret = btrfs_inc_extent_ref(trans, root, new->bytenr,
 			new->disk_len, 0,
@@ -2381,6 +2383,7 @@ again:
 	ret = 1;
 out_free_path:
 	btrfs_release_path(path);
+	path->leave_spinning = 0;
 	btrfs_end_transaction(trans, root);
 out_unlock:
 	unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
-- 
1.7.7.6


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

* Re: [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work
  2013-03-11  9:20 [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work Liu Bo
@ 2013-03-11 17:26 ` David Sterba
  2013-03-12  1:44   ` Liu Bo
  0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2013-03-11 17:26 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-btrfs

On Mon, Mar 11, 2013 at 05:20:58PM +0800, Liu Bo wrote:
> Using spinning case instead of blocking will result in better concurrency
> overall.

Do you have numbers to support that?

david

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

* Re: [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work
  2013-03-11 17:26 ` David Sterba
@ 2013-03-12  1:44   ` Liu Bo
  2013-03-14 18:38     ` Chris Mason
  0 siblings, 1 reply; 5+ messages in thread
From: Liu Bo @ 2013-03-12  1:44 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On Mon, Mar 11, 2013 at 06:26:40PM +0100, David Sterba wrote:
> On Mon, Mar 11, 2013 at 05:20:58PM +0800, Liu Bo wrote:
> > Using spinning case instead of blocking will result in better concurrency
> > overall.
> 
> Do you have numbers to support that?
> 

Sorry, I don't, just judging from what leave_spinning is desiged for and the
similar usecases, like insert_reserved_file_extents(), which is also involved in
endio write worker.

thanks,
liubo

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

* Re: [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work
  2013-03-12  1:44   ` Liu Bo
@ 2013-03-14 18:38     ` Chris Mason
  2013-03-15  1:39       ` Liu Bo
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Mason @ 2013-03-14 18:38 UTC (permalink / raw)
  To: Liu Bo; +Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org

On Mon, Mar 11, 2013 at 07:44:04PM -0600, Liu Bo wrote:
> On Mon, Mar 11, 2013 at 06:26:40PM +0100, David Sterba wrote:
> > On Mon, Mar 11, 2013 at 05:20:58PM +0800, Liu Bo wrote:
> > > Using spinning case instead of blocking will result in better concurrency
> > > overall.
> > 
> > Do you have numbers to support that?
> > 
> 
> Sorry, I don't, just judging from what leave_spinning is desiged for and the
> similar usecases, like insert_reserved_file_extents(), which is also involved in
> endio write worker.

Leaving the path spinning is always faster.  As long as you're sure the
code inside doesn't schedule it is the right choice.

-chris


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

* Re: [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work
  2013-03-14 18:38     ` Chris Mason
@ 2013-03-15  1:39       ` Liu Bo
  0 siblings, 0 replies; 5+ messages in thread
From: Liu Bo @ 2013-03-15  1:39 UTC (permalink / raw)
  To: Chris Mason, dsterba@suse.cz, linux-btrfs@vger.kernel.org

On Thu, Mar 14, 2013 at 02:38:29PM -0400, Chris Mason wrote:
> On Mon, Mar 11, 2013 at 07:44:04PM -0600, Liu Bo wrote:
> > On Mon, Mar 11, 2013 at 06:26:40PM +0100, David Sterba wrote:
> > > On Mon, Mar 11, 2013 at 05:20:58PM +0800, Liu Bo wrote:
> > > > Using spinning case instead of blocking will result in better concurrency
> > > > overall.
> > > 
> > > Do you have numbers to support that?
> > > 
> > 
> > Sorry, I don't, just judging from what leave_spinning is desiged for and the
> > similar usecases, like insert_reserved_file_extents(), which is also involved in
> > endio write worker.
> 
> Leaving the path spinning is always faster.  As long as you're sure the
> code inside doesn't schedule it is the right choice.
> 

Yeah, I've taken care of schedule thing :)

thanks,
liubo
> 

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

end of thread, other threads:[~2013-03-15  1:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-11  9:20 [PATCH] Btrfs: get better concurrency for snapshot-aware defrag work Liu Bo
2013-03-11 17:26 ` David Sterba
2013-03-12  1:44   ` Liu Bo
2013-03-14 18:38     ` Chris Mason
2013-03-15  1:39       ` Liu Bo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.