* [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans
@ 2017-11-07 9:22 Nikolay Borisov
2017-11-07 20:18 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: Nikolay Borisov @ 2017-11-07 9:22 UTC (permalink / raw)
To: dsterba; +Cc: linux-btrfs, josef, Nikolay Borisov
After commit ('btrfs: change how we decide to commit transactions during
flushing') there is no need to hold the delayed_rsv during the
percpu_counter_compare call since we get the byte's snapshot earlier. So hold
the lock only while reading delayed_rsv
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
This is based on David's misc-4.15 branch
fs/btrfs/extent-tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 673ac4e01dd0..11b7d613140b 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4952,12 +4952,12 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,
bytes = 0;
else
bytes -= delayed_rsv->size;
+ spin_unlock(&delayed_rsv->lock);
+
if (percpu_counter_compare(&space_info->total_bytes_pinned,
bytes) < 0) {
- spin_unlock(&delayed_rsv->lock);
return -ENOSPC;
}
- spin_unlock(&delayed_rsv->lock);
commit:
trans = btrfs_join_transaction(fs_info->extent_root);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans
2017-11-07 9:22 [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans Nikolay Borisov
@ 2017-11-07 20:18 ` David Sterba
2017-11-07 20:42 ` Nikolay Borisov
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2017-11-07 20:18 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: dsterba, linux-btrfs, josef
On Tue, Nov 07, 2017 at 11:22:54AM +0200, Nikolay Borisov wrote:
> After commit ('btrfs: change how we decide to commit transactions during
996478ca9c460886ac1
> flushing') there is no need to hold the delayed_rsv during the
> percpu_counter_compare call since we get the byte's snapshot earlier. So hold
> the lock only while reading delayed_rsv
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans
2017-11-07 20:18 ` David Sterba
@ 2017-11-07 20:42 ` Nikolay Borisov
2017-11-07 21:15 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: Nikolay Borisov @ 2017-11-07 20:42 UTC (permalink / raw)
To: dsterba, linux-btrfs, josef
On 7.11.2017 22:18, David Sterba wrote:
> On Tue, Nov 07, 2017 at 11:22:54AM +0200, Nikolay Borisov wrote:
>> After commit ('btrfs: change how we decide to commit transactions during
>
> 996478ca9c460886ac1
That commit is still not pulled by linus so is this id stable?
>
>> flushing') there is no need to hold the delayed_rsv during the
>> percpu_counter_compare call since we get the byte's snapshot earlier. So hold
>> the lock only while reading delayed_rsv
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>
> Reviewed-by: David Sterba <dsterba@suse.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans
2017-11-07 20:42 ` Nikolay Borisov
@ 2017-11-07 21:15 ` David Sterba
0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-11-07 21:15 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: dsterba, linux-btrfs, josef
On Tue, Nov 07, 2017 at 10:42:26PM +0200, Nikolay Borisov wrote:
>
>
> On 7.11.2017 22:18, David Sterba wrote:
> > On Tue, Nov 07, 2017 at 11:22:54AM +0200, Nikolay Borisov wrote:
> >> After commit ('btrfs: change how we decide to commit transactions during
> >
> > 996478ca9c460886ac1
>
> That commit is still not pulled by linus so is this id stable?
Oh right, it's in the pending pull request branch. I don't expect any
changes so the id should be stable, but will keep it in mind anyway.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-07 21:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 9:22 [PATCH] btrfs: Reduce scope of delayed_rsv->lock in may_commit_trans Nikolay Borisov
2017-11-07 20:18 ` David Sterba
2017-11-07 20:42 ` Nikolay Borisov
2017-11-07 21:15 ` 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).