From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "hch@lst.de" <hch@lst.de>, "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Cc: "rpeterso@redhat.com" <rpeterso@redhat.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 01/15] dax: export a low-level __dax_zero_page_range helper
Date: Wed, 11 May 2016 22:43:26 +0000 [thread overview]
Message-ID: <1463006594.29294.33.camel@intel.com> (raw)
In-Reply-To: <1462783638-4968-2-git-send-email-hch@lst.de>
On Mon, 2016-05-09 at 10:47 +0200, Christoph Hellwig wrote:
> This allows XFS to perform zeroing using the iomap infrastructure and
> avoid buffer heads.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/dax.c | 35 ++++++++++++++++++++---------------
> include/linux/dax.h | 7 +++++++
> 2 files changed, 27 insertions(+), 15 deletions(-)
This looks good to me.
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 90322eb..6d5d744 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -1082,6 +1082,23 @@ int dax_pfn_mkwrite(struct vm_area_struct *vma,
> struct vm_fault *vmf)
> }
> EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
>
> +int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
> + unsigned int offset, unsigned int length)
> +{
> + struct blk_dax_ctl dax = {
> + .sector = sector,
> + .size = PAGE_CACHE_SIZE,
> + };
> +
> + if (dax_map_atomic(bdev, &dax) < 0)
> + return PTR_ERR(dax.addr);
> + clear_pmem(dax.addr + offset, length);
> + wmb_pmem();
> + dax_unmap_atomic(bdev, &dax);
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(__dax_zero_page_range);
> +
> /**
> * dax_zero_page_range - zero a range within a page of a DAX file
> * @inode: The file being truncated
> @@ -1117,23 +1134,11 @@ int dax_zero_page_range(struct inode *inode,
> loff_t from, unsigned length,
> bh.b_bdev = inode->i_sb->s_bdev;
> bh.b_size = PAGE_CACHE_SIZE;
> err = get_block(inode, index, &bh, 0);
> - if (err < 0)
> + if (err < 0 || !buffer_written(&bh))
> return err;
> - if (buffer_written(&bh)) {
> - struct block_device *bdev = bh.b_bdev;
> - struct blk_dax_ctl dax = {
> - .sector = to_sector(&bh, inode),
> - .size = PAGE_CACHE_SIZE,
> - };
>
> - if (dax_map_atomic(bdev, &dax) < 0)
> - return PTR_ERR(dax.addr);
> - clear_pmem(dax.addr + offset, length);
> - wmb_pmem();
> - dax_unmap_atomic(bdev, &dax);
> - }
> -
> - return 0;
> + return __dax_zero_page_range(bh.b_bdev, to_sector(&bh,
> inode),
> + offset, length);
> }
> EXPORT_SYMBOL_GPL(dax_zero_page_range);
>
> diff --git a/include/linux/dax.h b/include/linux/dax.h
> index 636dd59..8155b81 100644
> --- a/include/linux/dax.h
> +++ b/include/linux/dax.h
> @@ -17,12 +17,19 @@ int __dax_fault(struct vm_area_struct *, struct
> vm_fault *, get_block_t,
>
> #ifdef CONFIG_FS_DAX
> struct page *read_dax_sector(struct block_device *bdev, sector_t n);
> +int __dax_zero_page_range(struct block_device *bdev, sector_t sector,
> + unsigned int offset, unsigned int length);
> #else
> static inline struct page *read_dax_sector(struct block_device *bdev,
> sector_t n)
> {
> return ERR_PTR(-ENXIO);
> }
> +static inline int __dax_zero_page_range(struct block_device *bdev,
> + sector_t sector, unsigned int offset, unsigned int
> length)
> +{
> + return -ENXIO;
> +}
> #endif
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
next prev parent reply other threads:[~2016-05-11 22:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 8:47 iomap infrastructure and multipage writes V4 Christoph Hellwig
2016-05-09 8:47 ` [PATCH 01/15] dax: export a low-level __dax_zero_page_range helper Christoph Hellwig
2016-05-11 22:43 ` Verma, Vishal L [this message]
2016-05-09 8:47 ` [PATCH 02/15] fs: move struct iomap from exportfs.h to a separate header Christoph Hellwig
2016-05-09 8:47 ` [PATCH 03/15] fs: introduce iomap infrastructure Christoph Hellwig
2016-05-09 8:47 ` [PATCH 04/15] fs: support DAX based iomap zeroing Christoph Hellwig
2016-05-09 8:47 ` [PATCH 05/15] xfs: make xfs_bmbt_to_iomap available outside of xfs_pnfs.c Christoph Hellwig
2016-05-09 8:47 ` [PATCH 06/15] xfs: reorder zeroing and flushing sequence in truncate Christoph Hellwig
2016-05-09 8:47 ` [PATCH 07/15] xfs: implement iomap based buffered write path Christoph Hellwig
2016-05-09 8:47 ` [PATCH 08/15] xfs: remove buffered write support from __xfs_get_blocks Christoph Hellwig
2016-05-09 8:47 ` [PATCH 09/15] fs: iomap based fiemap implementation Christoph Hellwig
2016-05-23 20:09 ` Bob Peterson
2016-05-24 13:10 ` Christoph Hellwig
2016-05-26 18:19 ` Bob Peterson
2016-05-26 22:57 ` Dave Chinner
2016-05-09 8:47 ` [PATCH 10/15] xfs: use iomap " Christoph Hellwig
2016-05-09 8:47 ` [PATCH 11/15] xfs: use iomap infrastructure for DAX zeroing Christoph Hellwig
2016-05-09 8:47 ` [PATCH 12/15] xfs: handle 64-bit length in xfs_iozero Christoph Hellwig
2016-05-09 8:47 ` [PATCH 13/15] xfs: use xfs_zero_range in xfs_zero_eof Christoph Hellwig
2016-05-09 8:47 ` [PATCH 14/15] xfs: split xfs_free_file_space in manageable pieces Christoph Hellwig
2016-05-09 8:47 ` [PATCH 15/15] xfs: kill xfs_zero_remaining_bytes Christoph Hellwig
2016-05-11 22:42 ` iomap infrastructure and multipage writes V4 Verma, Vishal L
2016-06-01 6:35 ` Dave Chinner
2016-06-01 12:31 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463006594.29294.33.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rpeterso@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).