diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-11-17 20:37:39 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-11-17 20:37:39 -0500 |
commit | 0660b5af3f7ac0fac69de975914e1f4a3a586fb3 (patch) | |
tree | 5e911dfad23df29f1815fbbc76d38ffff7fe36d8 /fs/btrfs/inode.c | |
parent | 3394e1607eaf870ebba37d303fbd590a4c569908 (diff) |
Btrfs: Add backrefs and forward refs for subvols and snapshots
Subvols and snapshots can now be referenced from any point in the directory
tree. We need to maintain back refs for them so we can find lost
subvols.
Forward refs are added so that we know all of the subvols and
snapshots referenced anywhere in the directory tree of a single subvol. This
can be used to do recursive snapshotting (but they aren't yet) and it is
also used to detect and prevent directory loops when creating new snapshots.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7ef79ce86e25..6854bf41856a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4580,6 +4580,12 @@ static int btrfs_rename(struct inode * old_dir, struct dentry *old_dentry, | |||
4580 | return -ENOTEMPTY; | 4580 | return -ENOTEMPTY; |
4581 | } | 4581 | } |
4582 | 4582 | ||
4583 | /* to rename a snapshot or subvolume, we need to juggle the | ||
4584 | * backrefs. This isn't coded yet | ||
4585 | */ | ||
4586 | if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) | ||
4587 | return -EXDEV; | ||
4588 | |||
4583 | ret = btrfs_check_free_space(root, 1, 0); | 4589 | ret = btrfs_check_free_space(root, 1, 0); |
4584 | if (ret) | 4590 | if (ret) |
4585 | goto out_unlock; | 4591 | goto out_unlock; |