[Unionfs] RT kernel 2.6.23

Erez Zadok ezk at cs.sunysb.edu
Mon Nov 19 21:11:01 EST 2007


In message <200711150903.18381.paul at gccs.co.za>, Paul Hewlett writes:
> On Wednesday 14 November 2007 16:40:21 Erez Zadok wrote:

> Erez
> 
> Yes 2.6.23 only. 
> I would imagine that using the mapping function unconditionally would be the 
> correct way to go.
> 
> Paul

OK, try this small patch below.

Erez.


Unionfs: cleaner support for RT patches

Signed-off-by: Erez Zadok <ezk at cs.sunysb.edu>
diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c
index edea1a4..19c6a45 100644
--- a/fs/unionfs/dentry.c
+++ b/fs/unionfs/dentry.c
@@ -268,7 +268,7 @@ static inline void purge_inode_data(struct inode *inode)
 	/* remove all non-private mappings */
 	unmap_mapping_range(inode->i_mapping, 0, 0, 0);
 
-	if (inode->i_data.nrpages)
+	if (mapping_nrpages(inode->i_data.nrpages))
 		truncate_inode_pages(&inode->i_data, 0);
 }
 
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index 29badd2..9798336 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -71,7 +71,7 @@ static void unionfs_delete_inode(struct inode *inode)
 {
 	i_size_write(inode, 0);	/* every f/s seems to do that */
 
-	if (inode->i_data.nrpages)
+	if (mapping_nrpages(inode->i_data.nrpages))
 		truncate_inode_pages(&inode->i_data, 0);
 
 	clear_inode(inode);
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index ddb9b8b..e0f38d7 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -79,6 +79,14 @@ extern struct address_space_operations unionfs_aops;
 /* How long should an entry be allowed to persist */
 #define RDCACHE_JIFFIES	(5*HZ)
 
+/* compatibility with Real-Time patches */
+#ifdef CONFIG_PREEMPT_RT
+# define unionfs_rw_semaphore	compat_rw_semaphore
+#else /* not CONFIG_PREEMPT_RT */
+# define unionfs_rw_semaphore	rw_semaphore
+# define mapping_nrpages(x)	(x)
+#endif /* not CONFIG_PREEMPT_RT */
+
 /* file private data. */
 struct unionfs_file_info {
 	int bstart;
@@ -153,11 +161,7 @@ struct unionfs_sb_info {
 	 * branch-management is used on a pivot_root'ed union, because we
 	 * have to ->lookup paths which belong to the same union.
 	 */
-#ifdef CONFIG_PREEMPT_RT
-	struct compat_rw_semaphore rwsem;
-#else /* not CONFIG_PREEMPT_RT */
-	struct rw_semaphore rwsem;
-#endif /* not CONFIG_PREEMPT_RT */
+	struct unionfs_rw_semaphore rwsem;
 	pid_t write_lock_owner;	/* PID of rw_sem owner (write lock) */
 	int high_branch_id;	/* last unique branch ID given */
 	struct unionfs_data *data;


More information about the unionfs mailing list