diff mbox

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

Message ID 5568dfb1.6ac9440a.6c95.411c@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tom Marshall May 29, 2015, 6:57 p.m. UTC
Signed-off-by: Tom Marshall <tdm@cyngn.com>
---
 include/linux/fs.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 35ec87e..5e4444e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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
 }