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) | |
download | lwn-0660b5af3f7ac0fac69de975914e1f4a3a586fb3.tar.gz lwn-0660b5af3f7ac0fac69de975914e1f4a3a586fb3.zip |
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, return -ENOTEMPTY; } + /* to rename a snapshot or subvolume, we need to juggle the + * backrefs. This isn't coded yet + */ + if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) + return -EXDEV; + ret = btrfs_check_free_space(root, 1, 0); if (ret) goto out_unlock; |