From eec63c65dcbeb14b59c95159eb225b1fc2310806 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 17 Jul 2017 19:41:31 +0200 Subject: btrfs: separate defrag and property compression Add new value for compression to distinguish between defrag and property. Previously, a single variable was used and this caused clashes when the per-file 'compression' was set and a defrag -c was called. The property-compression is loaded when the file is open, defrag will overwrite the same variable and reset to 0 (ie. NONE) at when the file defragmentaion is finished. That's considered a usability bug. Now we won't touch the property value, use the defrag-compression. The precedence of defrag is higher than for property (and whole-filesystem). Signed-off-by: David Sterba --- fs/btrfs/btrfs_inode.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'fs/btrfs/btrfs_inode.h') diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index fa118036a84e..eccadb5f62a5 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -182,6 +182,11 @@ struct btrfs_inode { * Cached values of inode properties */ unsigned prop_compress; /* per-file compression algorithm */ + /* + * Force compression on the file using the defrag ioctl, could be + * different from prop_compress and takes precedence if set + */ + unsigned defrag_compress; struct btrfs_delayed_node *delayed_node; -- cgit v1.2.3