Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1377196 > unrolled thread

[PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

Started byToshi Kani <toshi.kani@hpe.com>
First post2016-04-12 23:00 +0200
Last post2016-04-13 21:10 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings Toshi Kani <toshi.kani@hpe.com> - 2016-04-12 23:00 +0200
    [PATCH v2 5/5] block: call dax_get_unmapped_area() for DAX pmd mappings Toshi Kani <toshi.kani@hpe.com> - 2016-04-12 23:00 +0200
    Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd  mappings Matthew Wilcox <willy@linux.intel.com> - 2016-04-13 05:10 +0200
      Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd  mappings Toshi Kani <toshi.kani@hpe.com> - 2016-04-13 17:20 +0200
        Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd  mappings Matthew Wilcox <willy@linux.intel.com> - 2016-04-13 20:30 +0200
          Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd  mappings Toshi Kani <toshi.kani@hpe.com> - 2016-04-13 21:10 +0200

#1377196 — [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

FromToshi Kani <toshi.kani@hpe.com>
Date2016-04-12 23:00 +0200
Subject[PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rndq3-56a-11@gated-at.bofh.it>
To support DAX pmd mappings with unmodified applications,
filesystems need to align an mmap address by the pmd size.

Call dax_get_unmapped_area() from f_op->get_unmapped_area.

Note, there is no change in behavior for a non-DAX file.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jan Kara <jack@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: <linux-ext4@vger.kernel.org>
---
 fs/ext4/file.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index fa2208b..2abc57b 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -708,6 +708,9 @@ const struct file_operations ext4_file_operations = {
 	.open		= ext4_file_open,
 	.release	= ext4_release_file,
 	.fsync		= ext4_sync_file,
+#ifdef CONFIG_FS_DAX
+	.get_unmapped_area = dax_get_unmapped_area,
+#endif
 	.splice_read	= generic_file_splice_read,
 	.splice_write	= iter_file_splice_write,
 	.fallocate	= ext4_fallocate,

[toc] | [next] | [standalone]


#1377197 — [PATCH v2 5/5] block: call dax_get_unmapped_area() for DAX pmd mappings

FromToshi Kani <toshi.kani@hpe.com>
Date2016-04-12 23:00 +0200
Subject[PATCH v2 5/5] block: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rndzJ-5be-49@gated-at.bofh.it>
In reply to#1377196
To support DAX pmd mappings with unmodified applications,
filesystems need to align an mmap address by the pmd size.

Call dax_get_unmapped_area() from f_op->get_unmapped_area.

Note, there is no change in behavior for a non-DAX file.

Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
---
 fs/block_dev.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 20a2c02..0274802 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1798,6 +1798,9 @@ const struct file_operations def_blk_fops = {
 	.write_iter	= blkdev_write_iter,
 	.mmap		= blkdev_mmap,
 	.fsync		= blkdev_fsync,
+#ifdef CONFIG_FS_DAX
+	.get_unmapped_area = dax_get_unmapped_area,
+#endif
 	.unlocked_ioctl	= block_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= compat_blkdev_ioctl,

[toc] | [prev] | [next] | [standalone]


#1377481 — Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

FromMatthew Wilcox <willy@linux.intel.com>
Date2016-04-13 05:10 +0200
SubjectRe: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rnjlL-29L-5@gated-at.bofh.it>
In reply to#1377196
On Tue, Apr 12, 2016 at 02:39:29PM -0600, Toshi Kani wrote:
> To support DAX pmd mappings with unmodified applications,
> filesystems need to align an mmap address by the pmd size.

> @@ -708,6 +708,9 @@ const struct file_operations ext4_file_operations = {
>  	.open		= ext4_file_open,
>  	.release	= ext4_release_file,
>  	.fsync		= ext4_sync_file,
> +#ifdef CONFIG_FS_DAX
> +	.get_unmapped_area = dax_get_unmapped_area,
> +#endif
>  	.splice_read	= generic_file_splice_read,
>  	.splice_write	= iter_file_splice_write,
>  	.fallocate	= ext4_fallocate,

Could you do something like:

 #ifdef CONFIG_FS_DAX
 struct page *read_dax_sector(struct block_device *bdev, sector_t n);
+unsigned long dax_get_unmapped_area(struct file *filp, unsigned long addr,
+               unsigned long len, unsigned long pgoff, unsigned long flags);
 #else
 static inline struct page *read_dax_sector(struct block_device *bdev,
                 sector_t n)
 {
         return ERR_PTR(-ENXIO);
 }
+#define dax_get_unmapped_area	NULL
 #endif

in patch 1/5.  Then there's no need for the ifdefs in each filesystem.

[toc] | [prev] | [next] | [standalone]


#1378037 — Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

FromToshi Kani <toshi.kani@hpe.com>
Date2016-04-13 17:20 +0200
SubjectRe: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rnuKe-3cP-19@gated-at.bofh.it>
In reply to#1377481
On Tue, 2016-04-12 at 23:01 -0400, Matthew Wilcox wrote:
> On Tue, Apr 12, 2016 at 02:39:29PM -0600, Toshi Kani wrote:
> > 
> > To support DAX pmd mappings with unmodified applications,
> > filesystems need to align an mmap address by the pmd size.
> > 
> > @@ -708,6 +708,9 @@ const struct file_operations ext4_file_operations =
> > {
> >  	.open		= ext4_file_open,
> >  	.release	= ext4_release_file,
> >  	.fsync		= ext4_sync_file,
> > +#ifdef CONFIG_FS_DAX
> > +	.get_unmapped_area = dax_get_unmapped_area,
> > +#endif
> >  	.splice_read	= generic_file_splice_read,
> >  	.splice_write	= iter_file_splice_write,
> >  	.fallocate	= ext4_fallocate,
>
> Could you do something like:
> 
>  #ifdef CONFIG_FS_DAX
>  struct page *read_dax_sector(struct block_device *bdev, sector_t n);
> +unsigned long dax_get_unmapped_area(struct file *filp, unsigned long
> addr,
> +               unsigned long len, unsigned long pgoff, unsigned long
> flags);
>  #else
>  static inline struct page *read_dax_sector(struct block_device *bdev,
>                  sector_t n)
>  {
>          return ERR_PTR(-ENXIO);
>  }
> +#define dax_get_unmapped_area	NULL
>  #endif
> 
> in patch 1/5.  Then there's no need for the ifdefs in each filesystem.

I thought about it, but I do not think we can use an inline function to an
entry point.

Thanks,
-Toshi

[toc] | [prev] | [next] | [standalone]


#1378161 — Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

FromMatthew Wilcox <willy@linux.intel.com>
Date2016-04-13 20:30 +0200
SubjectRe: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rnxI5-5ve-1@gated-at.bofh.it>
In reply to#1378037
On Wed, Apr 13, 2016 at 09:08:36AM -0600, Toshi Kani wrote:
> > Could you do something like:
> > 
> >  #ifdef CONFIG_FS_DAX
> >  struct page *read_dax_sector(struct block_device *bdev, sector_t n);
> > +unsigned long dax_get_unmapped_area(struct file *filp, unsigned long
> > addr,
> > +               unsigned long len, unsigned long pgoff, unsigned long
> > flags);
> >  #else
> >  static inline struct page *read_dax_sector(struct block_device *bdev,
> >                  sector_t n)
> >  {
> >          return ERR_PTR(-ENXIO);
> >  }
> > +#define dax_get_unmapped_area	NULL
> >  #endif
> > 
> > in patch 1/5.  Then there's no need for the ifdefs in each filesystem.
> 
> I thought about it, but I do not think we can use an inline function to an
> entry point.

That's not an inline function.  It's just NULL.  So after the preprocessor
is done with it, it just looks like:

	.get_unmapped_area = NULL,

and it won't be called by get_unmapped_area().

[toc] | [prev] | [next] | [standalone]


#1378183 — Re: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings

FromToshi Kani <toshi.kani@hpe.com>
Date2016-04-13 21:10 +0200
SubjectRe: [PATCH v2 2/5] ext4: call dax_get_unmapped_area() for DAX pmd mappings
Message-ID<rnykO-65O-15@gated-at.bofh.it>
In reply to#1378161
On Wed, 2016-04-13 at 14:22 -0400, Matthew Wilcox wrote:
> On Wed, Apr 13, 2016 at 09:08:36AM -0600, Toshi Kani wrote:
> > 
> > > 
> > > Could you do something like:
> > > 
> > >  #ifdef CONFIG_FS_DAX
> > >  struct page *read_dax_sector(struct block_device *bdev, sector_t n);
> > > +unsigned long dax_get_unmapped_area(struct file *filp, unsigned long
> > > addr,
> > > +               unsigned long len, unsigned long pgoff, unsigned long
> > > flags);
> > >  #else
> > >  static inline struct page *read_dax_sector(struct block_device
> > > *bdev,
> > >                  sector_t n)
> > >  {
> > >          return ERR_PTR(-ENXIO);
> > >  }
> > > +#define dax_get_unmapped_area	NULL
> > >  #endif
> > > 
> > > in patch 1/5.  Then there's no need for the ifdefs in each
> > > filesystem.
> >
> > I thought about it, but I do not think we can use an inline function to
> > an entry point.
>
> That's not an inline function.  It's just NULL.  So after the
> preprocessor is done with it, it just looks like:
> 
> 	.get_unmapped_area = NULL,
> 
> and it won't be called by get_unmapped_area().

Oh, I see. Good idea. I will do that.

Thanks,
-Toshi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web