Btrfs: Give each subvol and snapshot their own anonymous devid

Each subvolume has its own private inode number space, and so we need
to fill in different device numbers for each subvolume to avoid confusing
applications.

This commit puts a struct super_block into struct btrfs_root so it can
call set_anon_super() and get a different device number generated for
each root.

btrfs_rename is changed to prevent renames across subvols.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2008-11-17 20:42:26 -05:00
parent 3de4586c52
commit 3394e1607e
5 changed files with 34 additions and 6 deletions

View File

@ -832,13 +832,13 @@ static noinline int finish_pending_snapshot(struct btrfs_fs_info *fs_info,
struct inode *parent_inode;
struct inode *inode;
trans = btrfs_start_transaction(fs_info->fs_root, 1);
parent_inode = pending->dentry->d_parent->d_inode;
trans = btrfs_start_transaction(BTRFS_I(parent_inode)->root, 1);
/*
* insert the directory item
*/
namelen = strlen(pending->name);
parent_inode = pending->dentry->d_parent->d_inode;
ret = btrfs_set_inode_index(parent_inode, &index);
ret = btrfs_insert_dir_item(trans,
BTRFS_I(parent_inode)->root,