Skip to contentSkip to conversation

fs: Add inode.i_compressed_size and support for FS_IMPL

PATCH New Tom Marshall 1 participant 1 message May 29, 2015 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 fs: Add inode.i_compressed_size and support for FS_IMPL

---
 include/linux/fs.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
include/linux/fs.h +12 -3
index 35ec87e..5e4444e 100644
@@ -614,6 +614,9 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
+#ifdef CONFIG_FS_TRANSPARENT_COMPRESSION
+	loff_t			i_compressed_size;
+#endif
 	struct timespec		i_atime;
 	struct timespec		i_mtime;
 	struct timespec		i_ctime;
@@ -702,6 +705,12 @@ enum inode_i_mutex_lock_class
 void lock_two_nondirectories(struct inode *, struct inode*);
 void unlock_two_nondirectories(struct inode *, struct inode*);
 
+#if defined(CONFIG_FS_TRANSPARENT_COMPRESSION) && defined(FS_IMPL)
+#define I_SIZE_MEMBER i_compressed_size
+#else
+#define I_SIZE_MEMBER i_size
+#endif
+
 /*
  * NOTE: in a 32bit arch with a preemptable kernel and
  * an UP compile the i_size_read/write must be atomic
@@ -720,18 +729,18 @@ static inline loff_t i_size_read(const struct inode *inode)
 
 	do {
 		seq = read_seqcount_begin(&inode->i_size_seqcount);
-		i_size = inode->i_size;
+		i_size = inode->I_SIZE_MEMBER;
 	} while (read_seqcount_retry(&inode->i_size_seqcount, seq));
 	return i_size;
 #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
 	loff_t i_size;
 
 	preempt_disable();
-	i_size = inode->i_size;
+	i_size = inode->I_SIZE_MEMBER;
 	preempt_enable();
 	return i_size;
 #else
-	return inode->i_size;
+	return inode->I_SIZE_MEMBER;
 #endif
 }
 
Signature · 1 line
2.1.4