[Unionfs] RT patch - again

Erez Zadok ezk at cs.sunysb.edu
Mon Nov 26 19:26:16 EST 2007


In message <200711261256.49477.paul at gccs.co.za>, Paul Hewlett writes:
> On Sunday 25 November 2007 20:50:56 Erez Zadok wrote:
> > In message <200711221317.39711.paul at gccs.co.za>, Paul Hewlett writes:
> > > Please ignore previous post - here is correct patch (apologies)
> 
> > Paul, the problem with this patch, as I alluded to in my previous email, is
> > that unionfs won't compile unless the RT patches are applied: the vanilla
> > kernel doesn't have a mapping_nrpages() function.  I'd like to avoid
> > keeping two sets of unionfs-patches, one for RT users and one for those who
> > don't use RT.  I could have created a simple wrapper macro to replace
> Erez
> 
> This patch should be generic ...
> 
> Paul
> 
> 
> diff -ur unionfs.org/dentry.c unionfs/dentry.c
> --- unionfs.org/dentry.c        2007-11-26 11:08:22.000000000 +0200
> +++ unionfs/dentry.c    2007-11-26 11:10:00.000000000 +0200
> @@ -264,7 +264,11 @@
>         /* remove all non-private mappings */
>         unmap_mapping_range(inode->i_mapping, 0, 0, 0);
> 
> +#ifdef CONFIG_PREEMPT_RT
> +       if (mapping_nrpages(&inode->i_data))
> +#else
>         if (inode->i_data.nrpages)
> +#endif
>                 truncate_inode_pages(&inode->i_data, 0);
>  }

Yes, I did want a single patch, and preferably one I can keep permanently w/
the unionfs code.  Alas, whether you do it the way above, or with a wrapper
macro to mapping_nrpages() which is defined all the time, you still get
compile-time errors.  The problem is that I want whatever RT patches are
applied to unionfs, to compile *even* if the RT patches are not applied, or
if they are applied, then even if CONFIG_PREEMPT_RT is not enabled.  Try
this:

- apply the RT patch to your kernel
- apply the above small patch to unionfs
- configure a kernel *without* RT (i.e., CONFIG_PREEMPT_RT=n)
- compile and you get this error:

  CC [M]  fs/unionfs/dentry.o
fs/unionfs/dentry.c: In function 'purge_inode_data':
fs/unionfs/dentry.c:270: error: 'struct address_space' has no member named 'nrpages'
make[2]: *** [fs/unionfs/dentry.o] Error 1
make[1]: *** [fs/unionfs] Error 2
make: *** [fs] Error 2

The problem is that the RT patches *unconditionally* change the name of the
field from .nrpages to .__nrpages.  Any solution that will work with/without
the RT patches, and with/without CONFIG_PREEMPT_RT enabled, will have to
change that field's name back to its original name.  The only solution I see
at this point is to re-map the field name at compile time using something
(ugly) like:

	CFLAGS=-D__nrpages=nrpages

Erez.


More information about the unionfs mailing list