linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arne Jansen <sensille@gmx.net>
To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org, dave@jikos.cz
Subject: Re: [PATCH v4 4/6] btrfs: sync scrub with commit & device removal
Date: Thu, 24 Mar 2011 14:48:17 +0100	[thread overview]
Message-ID: <4D8B4BA1.7060002@gmx.net> (raw)
In-Reply-To: <4D8B400C.7010102@gmx.net>

On 24.03.2011 13:58, Arne Jansen wrote:
> On 23.03.2011 18:28, David Sterba wrote:
>> Hi,
>>
>> you are adding a new smp_mb, can you please explain why it's needed and
>> document it?
>>
>> thanks,
>> dave
>>
>> On Fri, Mar 18, 2011 at 04:55:07PM +0100, Arne Jansen wrote:
>>> This adds several synchronizations:
>>>  - for a transaction commit, the scrub gets paused before the
>>>    tree roots are committed until the super are safely on disk
>>>  - during a log commit, scrubbing of supers is disabled
>>>  - on unmount, the scrub gets cancelled
>>>  - on device removal, the scrub for the particular device gets cancelled
>>>
> 
>>> --- a/fs/btrfs/volumes.c
>>> +++ b/fs/btrfs/volumes.c
>>> @@ -1330,6 +1330,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
>>>  		goto error_undo;
>>>  
>>>  	device->in_fs_metadata = 0;
>>> +	smp_mb();
>>         ^^^^^^^^
> 
> The idea was to disallow any new scrubs so start beyond
> this point, but it turns out this is not strong enough.
> I have to move the check for in_fs_metadata in btrfs_scrub_dev
> inside the scrub_lock. In this case, the smp_mb is still needed,
> as in_fs_metadata is not protected by any lock. I'll add a
> comment.

Thinking more about locking... the smp_mb is not necessary,
because the following cancel_dev aquires a spin_lock, which
implies a barrier.

> 
> -Arne
> 
>>
>>> +	btrfs_scrub_cancel_dev(root, device);
>>>  
>>>  	/*
>>>  	 * the device list mutex makes sure that we don't change
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2011-03-24 13:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 15:55 [PATCH v4 0/6] btrfs: scrub Arne Jansen
2011-03-18 15:55 ` [PATCH v4 1/6] btrfs: add parameter to btrfs_lookup_csum_range Arne Jansen
2011-03-18 15:55 ` [PATCH v4 2/6] btrfs: make struct map_lookup public Arne Jansen
2011-03-18 15:55 ` [PATCH v4 3/6] btrfs: add scrub code and prototypes Arne Jansen
2011-03-23 17:18   ` David Sterba
2011-03-24 10:25     ` Arne Jansen
2011-03-24 14:30       ` David Sterba
2011-03-18 15:55 ` [PATCH v4 4/6] btrfs: sync scrub with commit & device removal Arne Jansen
2011-03-23 17:28   ` David Sterba
2011-03-24 12:58     ` Arne Jansen
2011-03-24 13:48       ` Arne Jansen [this message]
2011-03-18 15:55 ` [PATCH v4 5/6] btrfs: add state information for scrub Arne Jansen
2011-03-18 15:55 ` [PATCH v4 6/6] btrfs: new ioctls " Arne Jansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8B4BA1.7060002@gmx.net \
    --to=sensille@gmx.net \
    --cc=chris.mason@oracle.com \
    --cc=dave@jikos.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).