Skip to content

Commit

Permalink
Btrfs: fix missing inherited flag in rename
Browse files Browse the repository at this point in the history
When we move a file into a directory with compression flag, we need to
inherite BTRFS_INODE_COMPRESS and clear BTRFS_INODE_NOCOMPRESS as well.
But if we move a file into a directory without compression flag, we need
to clear both of them.

It is the way how our setflags deals with compression flag, so keep
the same behaviour here.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
liub authored and chrismason-xx committed Jun 15, 2012
1 parent acbcabd commit bc17823
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -7122,10 +7122,13 @@ static void fixup_inode_flags(struct inode *dir, struct inode *inode)
else
b_inode->flags &= ~BTRFS_INODE_NODATACOW;

if (b_dir->flags & BTRFS_INODE_COMPRESS)
if (b_dir->flags & BTRFS_INODE_COMPRESS) {
b_inode->flags |= BTRFS_INODE_COMPRESS;
else
b_inode->flags &= ~BTRFS_INODE_COMPRESS;
b_inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
} else {
b_inode->flags &= ~(BTRFS_INODE_COMPRESS |
BTRFS_INODE_NOCOMPRESS);
}
}

static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
Expand Down

0 comments on commit bc17823

Please sign in to comment.