|
|
@@ -6183,6 +6183,37 @@ static int btrfs_insert_inode_locked(struct inode *inode)
|
|
|
btrfs_find_actor, &args);
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * Inherit flags from the parent inode.
|
|
|
+ *
|
|
|
+ * Currently only the compression flags and the cow flags are inherited.
|
|
|
+ */
|
|
|
+static void btrfs_inherit_iflags(struct inode *inode, struct inode *dir)
|
|
|
+{
|
|
|
+ unsigned int flags;
|
|
|
+
|
|
|
+ if (!dir)
|
|
|
+ return;
|
|
|
+
|
|
|
+ flags = BTRFS_I(dir)->flags;
|
|
|
+
|
|
|
+ if (flags & BTRFS_INODE_NOCOMPRESS) {
|
|
|
+ BTRFS_I(inode)->flags &= ~BTRFS_INODE_COMPRESS;
|
|
|
+ BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS;
|
|
|
+ } else if (flags & BTRFS_INODE_COMPRESS) {
|
|
|
+ BTRFS_I(inode)->flags &= ~BTRFS_INODE_NOCOMPRESS;
|
|
|
+ BTRFS_I(inode)->flags |= BTRFS_INODE_COMPRESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flags & BTRFS_INODE_NODATACOW) {
|
|
|
+ BTRFS_I(inode)->flags |= BTRFS_INODE_NODATACOW;
|
|
|
+ if (S_ISREG(inode->i_mode))
|
|
|
+ BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM;
|
|
|
+ }
|
|
|
+
|
|
|
+ btrfs_update_iflags(inode);
|
|
|
+}
|
|
|
+
|
|
|
static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
|
|
struct btrfs_root *root,
|
|
|
struct inode *dir,
|