btrfs-progs: skip mounted fs when deal with umounted ones for fi show

Stalling problems may happen when exec balance & fi show cmds concurrently.

With the following commit:
        commit 915902c500
        btrfs-progs: fix device missing of btrfs fi show with seed devices

The fi show cmd will bother the mounted fs when only umounted fs should
be handled after @btrfs_can_kernel() has finished showing all mounted ones.

We could skip the mounted fs after @btrfs_can_kernel() is done, then tasks
keeps going on mounted fs while fi show continues on umounted ones separately.

Reported-by: Petr Janecek <janecek@ucw.cz>
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
Gui Hecheng 2014-10-30 10:44:50 +08:00 committed by David Sterba
parent cfdb818dda
commit 8a26f850cd
1 changed files with 13 additions and 0 deletions

View File

@ -53,6 +53,15 @@ struct seen_fsid {
static struct seen_fsid *seen_fsid_hash[SEEN_FSID_HASH_SIZE] = {NULL,};
static int is_seen_fsid(u8 *fsid)
{
u8 hash = fsid[0];
int slot = hash % SEEN_FSID_HASH_SIZE;
struct seen_fsid *seen = seen_fsid_hash[slot];
return seen ? 1 : 0;
}
static int add_seen_fsid(u8 *fsid)
{
u8 hash = fsid[0];
@ -766,6 +775,10 @@ static int map_seed_devices(struct list_head *all_uuids,
*found = 1;
}
/* skip all fs already shown as mounted fs */
if (is_seen_fsid(cur_fs->fsid))
continue;
fs_copy = malloc(sizeof(*fs_copy));
if (!fs_copy) {
ret = -ENOMEM;