From: Josef Bacik <jbacik@fusionio.com>
To: Stefan Behrens <sbehrens@giantdisaster.de>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v4 5/8] Btrfs: fill UUID tree initially
Date: Fri, 7 Jun 2013 10:36:47 -0400 [thread overview]
Message-ID: <20130607143647.GD29248@localhost.localdomain> (raw)
In-Reply-To: <9c19309fec3f04b1f0c0dc0d8081568759ea3582.1370534938.git.sbehrens@giantdisaster.de>
On Fri, Jun 07, 2013 at 04:27:50AM -0600, Stefan Behrens wrote:
> When the UUID tree is initially created, a task is spawned that
> walks through the root tree. For each found subvolume root_item,
> the uuid and received_uuid entries in the UUID tree are added.
> This is such a quick operation so that in case somebody wants
> to unmount the filesystem while the task is still running, the
> unmount is delayed until the UUID tree building task is finished.
>
What if we crash? Then we'll think we have a perfectly good uuid tree when its
half full.
> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
> ---
> fs/btrfs/ctree.h | 3 ++
> fs/btrfs/disk-io.c | 5 ++
> fs/btrfs/volumes.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 157 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index a635dbf..9393228 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -23,6 +23,7 @@
> #include <linux/highmem.h>
> #include <linux/fs.h>
> #include <linux/rwsem.h>
> +#include <linux/semaphore.h>
> #include <linux/completion.h>
> #include <linux/backing-dev.h>
> #include <linux/wait.h>
> @@ -1645,6 +1646,8 @@ struct btrfs_fs_info {
> struct btrfs_dev_replace dev_replace;
>
> atomic_t mutually_exclusive_operation_running;
> +
> + struct semaphore uuid_scan_sem;
> };
>
> /*
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 00bac63..89f99aa 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -31,6 +31,7 @@
> #include <linux/migrate.h>
> #include <linux/ratelimit.h>
> #include <linux/uuid.h>
> +#include <linux/semaphore.h>
> #include <asm/unaligned.h>
> #include "compat.h"
> #include "ctree.h"
> @@ -2288,6 +2289,7 @@ int open_ctree(struct super_block *sb,
> init_rwsem(&fs_info->extent_commit_sem);
> init_rwsem(&fs_info->cleanup_work_sem);
> init_rwsem(&fs_info->subvol_sem);
> + sema_init(&fs_info->uuid_scan_sem, 1);
> fs_info->dev_replace.lock_owner = 0;
> atomic_set(&fs_info->dev_replace.nesting_level, 0);
> mutex_init(&fs_info->dev_replace.lock_finishing_cancel_unmount);
> @@ -3543,6 +3545,9 @@ int close_ctree(struct btrfs_root *root)
> fs_info->closing = 1;
> smp_mb();
>
> + /* wait for the uuid_scan task to finish */
> + down(&fs_info->uuid_scan_sem);
> +
Need to re-up it again right? Thanks,
Josef
next prev parent reply other threads:[~2013-06-07 14:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-07 10:27 [PATCH v4 0/8] Btrfs: introduce a tree for UUID to subvol ID mapping Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 1/8] Btrfs: introduce a tree for items that map UUIDs to something Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 2/8] Btrfs: support printing UUID tree elements Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 3/8] Btrfs: create UUID tree if required Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 4/8] Btrfs: maintain subvolume items in the UUID tree Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 5/8] Btrfs: fill UUID tree initially Stefan Behrens
2013-06-07 14:36 ` Josef Bacik [this message]
2013-06-07 10:27 ` [PATCH v4 6/8] Btrfs: introduce uuid-tree-gen field Stefan Behrens
2013-06-07 14:39 ` Josef Bacik
2013-06-07 14:41 ` Stefan Behrens
2013-06-07 14:47 ` Josef Bacik
2013-06-07 10:27 ` [PATCH v4 7/8] Btrfs: check UUID tree during mount if required Stefan Behrens
2013-06-07 10:27 ` [PATCH v4 8/8] Btrfs: add mount option to force UUID tree checking Stefan Behrens
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=20130607143647.GD29248@localhost.localdomain \
--to=jbacik@fusionio.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sbehrens@giantdisaster.de \
/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).