* [PATCH v3 0/4] fs, dax: lookup dax_device at mount time @ 2017-08-30 19:43 Dan Williams [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Dan Williams @ 2017-08-30 19:43 UTC (permalink / raw) To: linux-xfs, linux-ext4 Cc: Jan Kara, linux-nvdimm, Darrick J. Wong, Andreas Dilger, Theodore Ts'o, Christoph Hellwig Changes since v2 [1]: * Split fs_dax_get_by_bdev() to its own patch (Christoph) * Push dax_device reference management into <fs>_{fill,put}_super() rather than the generic vfs. (Christoph) [1]: https://lists.01.org/pipermail/linux-nvdimm/2017-August/012133.html --- Christoph notes: I just noticed that we now do a fs_dax_get_by_host in every iomap_begin call for DAX. This function iterates a list, does a string compared and igrab. I really think we need to cache this in the superblock (possible even the fs superblock) similar to what we do for the block device. This passes the libnvdimm unit tests. --- Dan Williams (4): dax: introduce a fs_dax_get_by_bdev() helper xfs: perform dax_device lookup at mount ext2: perform dax_device lookup at mount ext4: perform dax_device lookup at mount drivers/dax/super.c | 10 ++++++++++ fs/ext2/ext2.h | 1 + fs/ext2/inode.c | 11 +++-------- fs/ext2/super.c | 5 +++++ fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 11 +++-------- fs/ext4/super.c | 5 +++++ fs/xfs/xfs_aops.c | 13 +++++++++++++ fs/xfs/xfs_aops.h | 1 + fs/xfs/xfs_buf.c | 4 +++- fs/xfs/xfs_buf.h | 3 ++- fs/xfs/xfs_iomap.c | 10 +--------- fs/xfs/xfs_super.c | 25 +++++++++++++++++++++---- include/linux/dax.h | 6 ++++++ 14 files changed, 75 insertions(+), 31 deletions(-) ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-08-30 19:43 ` Dan Williams 2017-08-30 21:39 ` Darrick J. Wong ` (2 more replies) 2017-08-30 19:43 ` [PATCH v3 2/4] xfs: perform dax_device lookup at mount Dan Williams 1 sibling, 3 replies; 13+ messages in thread From: Dan Williams @ 2017-08-30 19:43 UTC (permalink / raw) To: linux-xfs-u79uwXL29TY76Z2rM5mHXA, linux-ext4-u79uwXL29TY76Z2rM5mHXA Cc: Jan Kara, Christoph Hellwig, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw Add a helper that can replace the following common pattern: if (blk_queue_dax(bdev->bd_queue)) fs_dax_get_by_host(bdev->bd_disk->disk_name); This will be used to move dax_device lookup from iomap-operation time to fs-mount time. Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org> Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- drivers/dax/super.c | 10 ++++++++++ include/linux/dax.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 938eb4868f7f..b699aac268a6 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -46,6 +46,8 @@ void dax_read_unlock(int id) EXPORT_SYMBOL_GPL(dax_read_unlock); #ifdef CONFIG_BLOCK +#include <linux/blkdev.h> + int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, pgoff_t *pgoff) { @@ -59,6 +61,14 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, } EXPORT_SYMBOL(bdev_dax_pgoff); +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) +{ + if (!blk_queue_dax(bdev->bd_queue)) + return NULL; + return fs_dax_get_by_host(bdev->bd_disk->disk_name); +} +EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev); + /** * __bdev_dax_supported() - Check if the device supports dax for filesystem * @sb: The superblock of the device diff --git a/include/linux/dax.h b/include/linux/dax.h index df97b7af7e2c..ac8afa18f707 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -57,6 +57,7 @@ static inline void fs_put_dax(struct dax_device *dax_dev) put_dax(dax_dev); } +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev); #else static inline int bdev_dax_supported(struct super_block *sb, int blocksize) { @@ -71,6 +72,11 @@ static inline struct dax_device *fs_dax_get_by_host(const char *host) static inline void fs_put_dax(struct dax_device *dax_dev) { } + +static inline struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) +{ + return NULL; +} #endif int dax_read_lock(void); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper 2017-08-30 19:43 ` [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper Dan Williams @ 2017-08-30 21:39 ` Darrick J. Wong [not found] ` <150412223265.10177.11004612169458058274.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-08-31 9:55 ` Christoph Hellwig 2 siblings, 0 replies; 13+ messages in thread From: Darrick J. Wong @ 2017-08-30 21:39 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs, linux-ext4, Jan Kara, Christoph Hellwig, linux-nvdimm On Wed, Aug 30, 2017 at 12:43:52PM -0700, Dan Williams wrote: > Add a helper that can replace the following common pattern: > > if (blk_queue_dax(bdev->bd_queue)) > fs_dax_get_by_host(bdev->bd_disk->disk_name); > > This will be used to move dax_device lookup from iomap-operation time to > fs-mount time. > > Cc: Jan Kara <jack@suse.cz> > Cc: Christoph Hellwig <hch@lst.de> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > drivers/dax/super.c | 10 ++++++++++ > include/linux/dax.h | 6 ++++++ > 2 files changed, 16 insertions(+) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index 938eb4868f7f..b699aac268a6 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -46,6 +46,8 @@ void dax_read_unlock(int id) > EXPORT_SYMBOL_GPL(dax_read_unlock); > > #ifdef CONFIG_BLOCK > +#include <linux/blkdev.h> > + > int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, > pgoff_t *pgoff) > { > @@ -59,6 +61,14 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, > } > EXPORT_SYMBOL(bdev_dax_pgoff); > > +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) > +{ > + if (!blk_queue_dax(bdev->bd_queue)) > + return NULL; > + return fs_dax_get_by_host(bdev->bd_disk->disk_name); > +} > +EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev); > + > /** > * __bdev_dax_supported() - Check if the device supports dax for filesystem > * @sb: The superblock of the device > diff --git a/include/linux/dax.h b/include/linux/dax.h > index df97b7af7e2c..ac8afa18f707 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -57,6 +57,7 @@ static inline void fs_put_dax(struct dax_device *dax_dev) > put_dax(dax_dev); > } > > +struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev); > #else > static inline int bdev_dax_supported(struct super_block *sb, int blocksize) > { > @@ -71,6 +72,11 @@ static inline struct dax_device *fs_dax_get_by_host(const char *host) > static inline void fs_put_dax(struct dax_device *dax_dev) > { > } > + > +static inline struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev) > +{ > + return NULL; > +} > #endif > > int dax_read_lock(void); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
[parent not found: <150412223265.10177.11004612169458058274.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper [not found] ` <150412223265.10177.11004612169458058274.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-08-31 8:25 ` Jan Kara 0 siblings, 0 replies; 13+ messages in thread From: Jan Kara @ 2017-08-31 8:25 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs-u79uwXL29TY76Z2rM5mHXA, linux-ext4-u79uwXL29TY76Z2rM5mHXA, Jan Kara, Christoph Hellwig, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw On Wed 30-08-17 12:43:52, Dan Williams wrote: > Add a helper that can replace the following common pattern: > > if (blk_queue_dax(bdev->bd_queue)) > fs_dax_get_by_host(bdev->bd_disk->disk_name); > > This will be used to move dax_device lookup from iomap-operation time to > fs-mount time. > > Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org> > Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> > Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Looks good to me. You can add: Reviewed-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org> Honza -- Jan Kara <jack-IBi9RG/b67k@public.gmane.org> SUSE Labs, CR ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper 2017-08-30 19:43 ` [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper Dan Williams 2017-08-30 21:39 ` Darrick J. Wong [not found] ` <150412223265.10177.11004612169458058274.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-08-31 9:55 ` Christoph Hellwig 2 siblings, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2017-08-31 9:55 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs, linux-ext4, Jan Kara, Christoph Hellwig, linux-nvdimm Looks fine, Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 2/4] xfs: perform dax_device lookup at mount [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-08-30 19:43 ` [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper Dan Williams @ 2017-08-30 19:43 ` Dan Williams 2017-08-30 21:42 ` Darrick J. Wong 2017-08-31 9:56 ` Christoph Hellwig 1 sibling, 2 replies; 13+ messages in thread From: Dan Williams @ 2017-08-30 19:43 UTC (permalink / raw) To: linux-xfs-u79uwXL29TY76Z2rM5mHXA, linux-ext4-u79uwXL29TY76Z2rM5mHXA Cc: Darrick J. Wong, Christoph Hellwig, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw The ->iomap_begin() operation is a hot path, so cache the fs_dax_get_by_host() result at mount time to avoid the incurring the hash lookup overhead on a per-i/o basis. Cc: "Darrick J. Wong" <darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Reported-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> --- fs/xfs/xfs_aops.c | 13 +++++++++++++ fs/xfs/xfs_aops.h | 1 + fs/xfs/xfs_buf.c | 4 +++- fs/xfs/xfs_buf.h | 3 ++- fs/xfs/xfs_iomap.c | 10 +--------- fs/xfs/xfs_super.c | 25 +++++++++++++++++++++---- 6 files changed, 41 insertions(+), 15 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 6bf120bb1a17..78185f3b10b2 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -80,6 +80,19 @@ xfs_find_bdev_for_inode( return mp->m_ddev_targp->bt_bdev; } +struct dax_device * +xfs_find_daxdev_for_inode( + struct inode *inode) +{ + struct xfs_inode *ip = XFS_I(inode); + struct xfs_mount *mp = ip->i_mount; + + if (XFS_IS_REALTIME_INODE(ip)) + return mp->m_rtdev_targp->bt_daxdev; + else + return mp->m_ddev_targp->bt_daxdev; +} + /* * We're now finished for good with this page. Update the page state via the * associated buffer_heads, paying attention to the start and end offsets that diff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h index cc174ec6c2fd..88c85ea63da0 100644 --- a/fs/xfs/xfs_aops.h +++ b/fs/xfs/xfs_aops.h @@ -59,5 +59,6 @@ int xfs_setfilesize(struct xfs_inode *ip, xfs_off_t offset, size_t size); extern void xfs_count_page_state(struct page *, int *, int *); extern struct block_device *xfs_find_bdev_for_inode(struct inode *); +extern struct dax_device *xfs_find_daxdev_for_inode(struct inode *); #endif /* __XFS_AOPS_H__ */ diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index 72f038492ba8..6deb86c845d1 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1802,7 +1802,8 @@ xfs_setsize_buftarg_early( xfs_buftarg_t * xfs_alloc_buftarg( struct xfs_mount *mp, - struct block_device *bdev) + struct block_device *bdev, + struct dax_device *dax_dev) { xfs_buftarg_t *btp; @@ -1811,6 +1812,7 @@ xfs_alloc_buftarg( btp->bt_mount = mp; btp->bt_dev = bdev->bd_dev; btp->bt_bdev = bdev; + btp->bt_daxdev = dax_dev; if (xfs_setsize_buftarg_early(btp, bdev)) goto error; diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h index 20721261dae5..bf71507ddb16 100644 --- a/fs/xfs/xfs_buf.h +++ b/fs/xfs/xfs_buf.h @@ -108,6 +108,7 @@ typedef unsigned int xfs_buf_flags_t; typedef struct xfs_buftarg { dev_t bt_dev; struct block_device *bt_bdev; + struct dax_device *bt_daxdev; struct xfs_mount *bt_mount; unsigned int bt_meta_sectorsize; size_t bt_meta_sectormask; @@ -385,7 +386,7 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset) * Handling of buftargs. */ extern xfs_buftarg_t *xfs_alloc_buftarg(struct xfs_mount *, - struct block_device *); + struct block_device *, struct dax_device *); extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *); extern void xfs_wait_buftarg(xfs_buftarg_t *); extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int); diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 813394c62849..7c934e407332 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -69,6 +69,7 @@ xfs_bmbt_to_iomap( iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff); iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount); iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip)); + iomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip)); } xfs_extlen_t @@ -976,7 +977,6 @@ xfs_file_iomap_begin( int nimaps = 1, error = 0; bool shared = false, trimmed = false; unsigned lockmode; - struct block_device *bdev; if (XFS_FORCED_SHUTDOWN(mp)) return -EIO; @@ -1087,13 +1087,6 @@ xfs_file_iomap_begin( xfs_bmbt_to_iomap(ip, iomap, &imap); - /* optionally associate a dax device with the iomap bdev */ - bdev = iomap->bdev; - if (blk_queue_dax(bdev->bd_queue)) - iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); - else - iomap->dax_dev = NULL; - if (shared) iomap->flags |= IOMAP_F_SHARED; return 0; @@ -1171,7 +1164,6 @@ xfs_file_iomap_end( unsigned flags, struct iomap *iomap) { - fs_put_dax(iomap->dax_dev); if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC) return xfs_file_iomap_end_delalloc(XFS_I(inode), offset, length, written, iomap); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 38aaacdbb8b3..ee4225c65f0c 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -714,17 +714,26 @@ STATIC void xfs_close_devices( struct xfs_mount *mp) { + struct dax_device *dax_ddev = mp->m_ddev_targp->bt_daxdev; + if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { struct block_device *logdev = mp->m_logdev_targp->bt_bdev; + struct dax_device *dax_logdev = mp->m_logdev_targp->bt_daxdev; + xfs_free_buftarg(mp, mp->m_logdev_targp); xfs_blkdev_put(logdev); + fs_put_dax(dax_logdev); } if (mp->m_rtdev_targp) { struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; + struct dax_device *dax_rtdev = mp->m_rtdev_targp->bt_daxdev; + xfs_free_buftarg(mp, mp->m_rtdev_targp); xfs_blkdev_put(rtdev); + fs_put_dax(dax_rtdev); } xfs_free_buftarg(mp, mp->m_ddev_targp); + fs_put_dax(dax_ddev); } /* @@ -742,6 +751,8 @@ xfs_open_devices( struct xfs_mount *mp) { struct block_device *ddev = mp->m_super->s_bdev; + struct dax_device *dax_ddev = fs_dax_get_by_bdev(ddev); + struct dax_device *dax_logdev = NULL, *dax_rtdev = NULL; struct block_device *logdev = NULL, *rtdev = NULL; int error; @@ -752,6 +763,7 @@ xfs_open_devices( error = xfs_blkdev_get(mp, mp->m_logname, &logdev); if (error) goto out; + dax_logdev = fs_dax_get_by_bdev(logdev); } if (mp->m_rtname) { @@ -765,24 +777,25 @@ xfs_open_devices( error = -EINVAL; goto out_close_rtdev; } + dax_rtdev = fs_dax_get_by_bdev(rtdev); } /* * Setup xfs_mount buffer target pointers */ error = -ENOMEM; - mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); + mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev, dax_ddev); if (!mp->m_ddev_targp) goto out_close_rtdev; if (rtdev) { - mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev); + mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev, dax_rtdev); if (!mp->m_rtdev_targp) goto out_free_ddev_targ; } if (logdev && logdev != ddev) { - mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev); + mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev, dax_logdev); if (!mp->m_logdev_targp) goto out_free_rtdev_targ; } else { @@ -798,10 +811,14 @@ xfs_open_devices( xfs_free_buftarg(mp, mp->m_ddev_targp); out_close_rtdev: xfs_blkdev_put(rtdev); + fs_put_dax(dax_rtdev); out_close_logdev: - if (logdev && logdev != ddev) + if (logdev && logdev != ddev) { xfs_blkdev_put(logdev); + fs_put_dax(dax_logdev); + } out: + fs_put_dax(dax_ddev); return error; } ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 2/4] xfs: perform dax_device lookup at mount 2017-08-30 19:43 ` [PATCH v3 2/4] xfs: perform dax_device lookup at mount Dan Williams @ 2017-08-30 21:42 ` Darrick J. Wong 2017-08-31 9:56 ` Christoph Hellwig 1 sibling, 0 replies; 13+ messages in thread From: Darrick J. Wong @ 2017-08-30 21:42 UTC (permalink / raw) To: Dan Williams; +Cc: linux-xfs, linux-ext4, linux-nvdimm, Christoph Hellwig On Wed, Aug 30, 2017 at 12:43:58PM -0700, Dan Williams wrote: > The ->iomap_begin() operation is a hot path, so cache the > fs_dax_get_by_host() result at mount time to avoid the incurring the > hash lookup overhead on a per-i/o basis. > > Cc: "Darrick J. Wong" <darrick.wong@oracle.com> > Reported-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > fs/xfs/xfs_aops.c | 13 +++++++++++++ > fs/xfs/xfs_aops.h | 1 + > fs/xfs/xfs_buf.c | 4 +++- > fs/xfs/xfs_buf.h | 3 ++- > fs/xfs/xfs_iomap.c | 10 +--------- > fs/xfs/xfs_super.c | 25 +++++++++++++++++++++---- > 6 files changed, 41 insertions(+), 15 deletions(-) > > diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c > index 6bf120bb1a17..78185f3b10b2 100644 > --- a/fs/xfs/xfs_aops.c > +++ b/fs/xfs/xfs_aops.c > @@ -80,6 +80,19 @@ xfs_find_bdev_for_inode( > return mp->m_ddev_targp->bt_bdev; > } > > +struct dax_device * > +xfs_find_daxdev_for_inode( > + struct inode *inode) > +{ > + struct xfs_inode *ip = XFS_I(inode); > + struct xfs_mount *mp = ip->i_mount; > + > + if (XFS_IS_REALTIME_INODE(ip)) > + return mp->m_rtdev_targp->bt_daxdev; > + else > + return mp->m_ddev_targp->bt_daxdev; > +} > + > /* > * We're now finished for good with this page. Update the page state via the > * associated buffer_heads, paying attention to the start and end offsets that > diff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h > index cc174ec6c2fd..88c85ea63da0 100644 > --- a/fs/xfs/xfs_aops.h > +++ b/fs/xfs/xfs_aops.h > @@ -59,5 +59,6 @@ int xfs_setfilesize(struct xfs_inode *ip, xfs_off_t offset, size_t size); > > extern void xfs_count_page_state(struct page *, int *, int *); > extern struct block_device *xfs_find_bdev_for_inode(struct inode *); > +extern struct dax_device *xfs_find_daxdev_for_inode(struct inode *); > > #endif /* __XFS_AOPS_H__ */ > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index 72f038492ba8..6deb86c845d1 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -1802,7 +1802,8 @@ xfs_setsize_buftarg_early( > xfs_buftarg_t * > xfs_alloc_buftarg( > struct xfs_mount *mp, > - struct block_device *bdev) > + struct block_device *bdev, > + struct dax_device *dax_dev) > { > xfs_buftarg_t *btp; > > @@ -1811,6 +1812,7 @@ xfs_alloc_buftarg( > btp->bt_mount = mp; > btp->bt_dev = bdev->bd_dev; > btp->bt_bdev = bdev; > + btp->bt_daxdev = dax_dev; > > if (xfs_setsize_buftarg_early(btp, bdev)) > goto error; > diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h > index 20721261dae5..bf71507ddb16 100644 > --- a/fs/xfs/xfs_buf.h > +++ b/fs/xfs/xfs_buf.h > @@ -108,6 +108,7 @@ typedef unsigned int xfs_buf_flags_t; > typedef struct xfs_buftarg { > dev_t bt_dev; > struct block_device *bt_bdev; > + struct dax_device *bt_daxdev; > struct xfs_mount *bt_mount; > unsigned int bt_meta_sectorsize; > size_t bt_meta_sectormask; > @@ -385,7 +386,7 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset) > * Handling of buftargs. > */ > extern xfs_buftarg_t *xfs_alloc_buftarg(struct xfs_mount *, > - struct block_device *); > + struct block_device *, struct dax_device *); > extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *); > extern void xfs_wait_buftarg(xfs_buftarg_t *); > extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int); > diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c > index 813394c62849..7c934e407332 100644 > --- a/fs/xfs/xfs_iomap.c > +++ b/fs/xfs/xfs_iomap.c > @@ -69,6 +69,7 @@ xfs_bmbt_to_iomap( > iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff); > iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount); > iomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip)); > + iomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip)); > } > > xfs_extlen_t > @@ -976,7 +977,6 @@ xfs_file_iomap_begin( > int nimaps = 1, error = 0; > bool shared = false, trimmed = false; > unsigned lockmode; > - struct block_device *bdev; > > if (XFS_FORCED_SHUTDOWN(mp)) > return -EIO; > @@ -1087,13 +1087,6 @@ xfs_file_iomap_begin( > > xfs_bmbt_to_iomap(ip, iomap, &imap); > > - /* optionally associate a dax device with the iomap bdev */ > - bdev = iomap->bdev; > - if (blk_queue_dax(bdev->bd_queue)) > - iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); > - else > - iomap->dax_dev = NULL; > - > if (shared) > iomap->flags |= IOMAP_F_SHARED; > return 0; > @@ -1171,7 +1164,6 @@ xfs_file_iomap_end( > unsigned flags, > struct iomap *iomap) > { > - fs_put_dax(iomap->dax_dev); > if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC) > return xfs_file_iomap_end_delalloc(XFS_I(inode), offset, > length, written, iomap); > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c > index 38aaacdbb8b3..ee4225c65f0c 100644 > --- a/fs/xfs/xfs_super.c > +++ b/fs/xfs/xfs_super.c > @@ -714,17 +714,26 @@ STATIC void > xfs_close_devices( > struct xfs_mount *mp) > { > + struct dax_device *dax_ddev = mp->m_ddev_targp->bt_daxdev; > + > if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { > struct block_device *logdev = mp->m_logdev_targp->bt_bdev; > + struct dax_device *dax_logdev = mp->m_logdev_targp->bt_daxdev; > + > xfs_free_buftarg(mp, mp->m_logdev_targp); > xfs_blkdev_put(logdev); > + fs_put_dax(dax_logdev); > } > if (mp->m_rtdev_targp) { > struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; > + struct dax_device *dax_rtdev = mp->m_rtdev_targp->bt_daxdev; > + > xfs_free_buftarg(mp, mp->m_rtdev_targp); > xfs_blkdev_put(rtdev); > + fs_put_dax(dax_rtdev); > } > xfs_free_buftarg(mp, mp->m_ddev_targp); > + fs_put_dax(dax_ddev); > } > > /* > @@ -742,6 +751,8 @@ xfs_open_devices( > struct xfs_mount *mp) > { > struct block_device *ddev = mp->m_super->s_bdev; > + struct dax_device *dax_ddev = fs_dax_get_by_bdev(ddev); > + struct dax_device *dax_logdev = NULL, *dax_rtdev = NULL; > struct block_device *logdev = NULL, *rtdev = NULL; > int error; > > @@ -752,6 +763,7 @@ xfs_open_devices( > error = xfs_blkdev_get(mp, mp->m_logname, &logdev); > if (error) > goto out; > + dax_logdev = fs_dax_get_by_bdev(logdev); > } > > if (mp->m_rtname) { > @@ -765,24 +777,25 @@ xfs_open_devices( > error = -EINVAL; > goto out_close_rtdev; > } > + dax_rtdev = fs_dax_get_by_bdev(rtdev); > } > > /* > * Setup xfs_mount buffer target pointers > */ > error = -ENOMEM; > - mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); > + mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev, dax_ddev); > if (!mp->m_ddev_targp) > goto out_close_rtdev; > > if (rtdev) { > - mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev); > + mp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev, dax_rtdev); > if (!mp->m_rtdev_targp) > goto out_free_ddev_targ; > } > > if (logdev && logdev != ddev) { > - mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev); > + mp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev, dax_logdev); > if (!mp->m_logdev_targp) > goto out_free_rtdev_targ; > } else { > @@ -798,10 +811,14 @@ xfs_open_devices( > xfs_free_buftarg(mp, mp->m_ddev_targp); > out_close_rtdev: > xfs_blkdev_put(rtdev); > + fs_put_dax(dax_rtdev); > out_close_logdev: > - if (logdev && logdev != ddev) > + if (logdev && logdev != ddev) { > xfs_blkdev_put(logdev); > + fs_put_dax(dax_logdev); > + } > out: > + fs_put_dax(dax_ddev); > return error; > } > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 2/4] xfs: perform dax_device lookup at mount 2017-08-30 19:43 ` [PATCH v3 2/4] xfs: perform dax_device lookup at mount Dan Williams 2017-08-30 21:42 ` Darrick J. Wong @ 2017-08-31 9:56 ` Christoph Hellwig 1 sibling, 0 replies; 13+ messages in thread From: Christoph Hellwig @ 2017-08-31 9:56 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs, linux-ext4, linux-nvdimm, Christoph Hellwig, Darrick J. Wong We don't really need the dax_device for the log device (yet), but acquiring it seems harmless, so: Reviewed-by: Christoph Hellwig <hch@lst.de> ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/4] ext2: perform dax_device lookup at mount 2017-08-30 19:43 [PATCH v3 0/4] fs, dax: lookup dax_device at mount time Dan Williams [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-08-30 19:44 ` Dan Williams 2017-08-31 8:22 ` Jan Kara 2017-08-30 19:44 ` [PATCH v3 4/4] ext4: " Dan Williams 2 siblings, 1 reply; 13+ messages in thread From: Dan Williams @ 2017-08-30 19:44 UTC (permalink / raw) To: linux-xfs, linux-ext4 Cc: Jan Kara, linux-nvdimm, Andreas Dilger, Theodore Ts'o, Christoph Hellwig The ->iomap_begin() operation is a hot path, so cache the fs_dax_get_by_host() result at mount time to avoid the incurring the hash lookup overhead on a per-i/o basis. Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Jan Kara <jack@suse.cz> Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- fs/ext2/ext2.h | 1 + fs/ext2/inode.c | 11 +++-------- fs/ext2/super.c | 5 +++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 23ebb92484c6..28de3edd4f4d 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h @@ -114,6 +114,7 @@ struct ext2_sb_info { */ spinlock_t s_lock; struct mb_cache *s_ea_block_cache; + struct dax_device *s_daxdev; }; static inline spinlock_t * diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 30163d007b2f..4dca6f348714 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -800,10 +800,10 @@ int ext2_get_block(struct inode *inode, sector_t iblock, static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, unsigned flags, struct iomap *iomap) { - struct block_device *bdev; unsigned int blkbits = inode->i_blkbits; unsigned long first_block = offset >> blkbits; unsigned long max_blocks = (length + (1 << blkbits) - 1) >> blkbits; + struct ext2_sb_info *sbi = EXT2_SB(inode->i_sb); bool new = false, boundary = false; u32 bno; int ret; @@ -814,13 +814,9 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length, return ret; iomap->flags = 0; - bdev = inode->i_sb->s_bdev; - iomap->bdev = bdev; + iomap->bdev = inode->i_sb->s_bdev; iomap->offset = (u64)first_block << blkbits; - if (blk_queue_dax(bdev->bd_queue)) - iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); - else - iomap->dax_dev = NULL; + iomap->dax_dev = sbi->s_daxdev; if (ret == 0) { iomap->type = IOMAP_HOLE; @@ -842,7 +838,6 @@ static int ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, ssize_t written, unsigned flags, struct iomap *iomap) { - fs_put_dax(iomap->dax_dev); if (iomap->type == IOMAP_MAPPED && written < length && (flags & IOMAP_WRITE)) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 7b1bc9059863..d9dd999568c2 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -144,6 +144,7 @@ static void ext2_put_super (struct super_block * sb) int db_count; int i; struct ext2_sb_info *sbi = EXT2_SB(sb); + struct dax_device *dax_dev = sbi->s_daxdev; ext2_quota_off_umount(sb); @@ -172,6 +173,7 @@ static void ext2_put_super (struct super_block * sb) sb->s_fs_info = NULL; kfree(sbi->s_blockgroup_lock); kfree(sbi); + fs_put_dax(dax_dev); } static struct kmem_cache * ext2_inode_cachep; @@ -813,6 +815,7 @@ static unsigned long descriptor_loc(struct super_block *sb, static int ext2_fill_super(struct super_block *sb, void *data, int silent) { + struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); struct buffer_head * bh; struct ext2_sb_info * sbi; struct ext2_super_block * es; @@ -842,6 +845,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } sb->s_fs_info = sbi; sbi->s_sb_block = sb_block; + sbi->s_daxdev = dax_dev; spin_lock_init(&sbi->s_lock); @@ -1200,6 +1204,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) kfree(sbi->s_blockgroup_lock); kfree(sbi); failed: + fs_put_dax(dax_dev); return ret; } ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 3/4] ext2: perform dax_device lookup at mount 2017-08-30 19:44 ` [PATCH v3 3/4] ext2: " Dan Williams @ 2017-08-31 8:22 ` Jan Kara 2017-08-31 14:20 ` Dan Williams 0 siblings, 1 reply; 13+ messages in thread From: Jan Kara @ 2017-08-31 8:22 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs, linux-ext4, Jan Kara, linux-nvdimm, Andreas Dilger, Theodore Ts'o, Christoph Hellwig On Wed 30-08-17 12:44:03, Dan Williams wrote: > The ->iomap_begin() operation is a hot path, so cache the > fs_dax_get_by_host() result at mount time to avoid the incurring the > hash lookup overhead on a per-i/o basis. > > Cc: "Theodore Ts'o" <tytso@mit.edu> > Cc: Andreas Dilger <adilger.kernel@dilger.ca> > Cc: Jan Kara <jack@suse.cz> > Reported-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Looks good to me (and it looks even cleaner than your previous approach). Just one nit below. You can add: Reviewed-by: Jan Kara <jack@suse.cz> > diff --git a/fs/ext2/super.c b/fs/ext2/super.c > index 7b1bc9059863..d9dd999568c2 100644 > --- a/fs/ext2/super.c > +++ b/fs/ext2/super.c > @@ -144,6 +144,7 @@ static void ext2_put_super (struct super_block * sb) > int db_count; > int i; > struct ext2_sb_info *sbi = EXT2_SB(sb); > + struct dax_device *dax_dev = sbi->s_daxdev; > > ext2_quota_off_umount(sb); > > @@ -172,6 +173,7 @@ static void ext2_put_super (struct super_block * sb) > sb->s_fs_info = NULL; > kfree(sbi->s_blockgroup_lock); > kfree(sbi); > + fs_put_dax(dax_dev); The local variable looks superfluous here. I'd just do fs_put_dax(sbi->s_daxdev); Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3 3/4] ext2: perform dax_device lookup at mount 2017-08-31 8:22 ` Jan Kara @ 2017-08-31 14:20 ` Dan Williams 0 siblings, 0 replies; 13+ messages in thread From: Dan Williams @ 2017-08-31 14:20 UTC (permalink / raw) To: Jan Kara Cc: linux-xfs, linux-ext4, linux-nvdimm@lists.01.org, Andreas Dilger, Theodore Ts'o, Christoph Hellwig On Thu, Aug 31, 2017 at 1:22 AM, Jan Kara <jack@suse.cz> wrote: > On Wed 30-08-17 12:44:03, Dan Williams wrote: >> The ->iomap_begin() operation is a hot path, so cache the >> fs_dax_get_by_host() result at mount time to avoid the incurring the >> hash lookup overhead on a per-i/o basis. >> >> Cc: "Theodore Ts'o" <tytso@mit.edu> >> Cc: Andreas Dilger <adilger.kernel@dilger.ca> >> Cc: Jan Kara <jack@suse.cz> >> Reported-by: Christoph Hellwig <hch@lst.de> >> Signed-off-by: Dan Williams <dan.j.williams@intel.com> > > Looks good to me (and it looks even cleaner than your previous approach). > Just one nit below. You can add: > > Reviewed-by: Jan Kara <jack@suse.cz> > >> diff --git a/fs/ext2/super.c b/fs/ext2/super.c >> index 7b1bc9059863..d9dd999568c2 100644 >> --- a/fs/ext2/super.c >> +++ b/fs/ext2/super.c >> @@ -144,6 +144,7 @@ static void ext2_put_super (struct super_block * sb) >> int db_count; >> int i; >> struct ext2_sb_info *sbi = EXT2_SB(sb); >> + struct dax_device *dax_dev = sbi->s_daxdev; >> >> ext2_quota_off_umount(sb); >> >> @@ -172,6 +173,7 @@ static void ext2_put_super (struct super_block * sb) >> sb->s_fs_info = NULL; >> kfree(sbi->s_blockgroup_lock); >> kfree(sbi); >> + fs_put_dax(dax_dev); > > The local variable looks superfluous here. I'd just do > fs_put_dax(sbi->s_daxdev); Ok... and move that before the kfree(sbi). ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 4/4] ext4: perform dax_device lookup at mount 2017-08-30 19:43 [PATCH v3 0/4] fs, dax: lookup dax_device at mount time Dan Williams [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-08-30 19:44 ` [PATCH v3 3/4] ext2: " Dan Williams @ 2017-08-30 19:44 ` Dan Williams 2017-08-31 8:24 ` Jan Kara 2 siblings, 1 reply; 13+ messages in thread From: Dan Williams @ 2017-08-30 19:44 UTC (permalink / raw) To: linux-xfs, linux-ext4 Cc: Jan Kara, linux-nvdimm, Andreas Dilger, Theodore Ts'o, Christoph Hellwig The ->iomap_begin() operation is a hot path, so cache the fs_dax_get_by_host() result at mount time to avoid the incurring the hash lookup overhead on a per-i/o basis. Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Jan Kara <jack@suse.cz> Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 11 +++-------- fs/ext4/super.c | 5 +++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index a2bb7d2870e4..194e622dc3dd 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1528,6 +1528,7 @@ struct ext4_sb_info { /* Barrier between changing inodes' journal flags and writepages ops. */ struct percpu_rw_semaphore s_journal_flag_rwsem; + struct dax_device *s_daxdev; }; static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c774bdc22759..16424b5c4e88 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3404,7 +3404,7 @@ static int ext4_releasepage(struct page *page, gfp_t wait) static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, unsigned flags, struct iomap *iomap) { - struct block_device *bdev; + struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); unsigned int blkbits = inode->i_blkbits; unsigned long first_block = offset >> blkbits; unsigned long last_block = (offset + length - 1) >> blkbits; @@ -3473,12 +3473,8 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, } iomap->flags = 0; - bdev = inode->i_sb->s_bdev; - iomap->bdev = bdev; - if (blk_queue_dax(bdev->bd_queue)) - iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name); - else - iomap->dax_dev = NULL; + iomap->bdev = inode->i_sb->s_bdev; + iomap->dax_dev = sbi->s_daxdev; iomap->offset = first_block << blkbits; if (ret == 0) { @@ -3511,7 +3507,6 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length, int blkbits = inode->i_blkbits; bool truncate = false; - fs_put_dax(iomap->dax_dev); if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT)) return 0; diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d61a70e2193a..0b3d94e25efb 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -864,6 +864,7 @@ static inline void ext4_quota_off_umount(struct super_block *sb) static void ext4_put_super(struct super_block *sb) { struct ext4_sb_info *sbi = EXT4_SB(sb); + struct dax_device *dax_dev = sbi->s_daxdev; struct ext4_super_block *es = sbi->s_es; int aborted = 0; int i, err; @@ -952,6 +953,7 @@ static void ext4_put_super(struct super_block *sb) crypto_free_shash(sbi->s_chksum_driver); kfree(sbi->s_blockgroup_lock); kfree(sbi); + fs_put_dax(dax_dev); } static struct kmem_cache *ext4_inode_cachep; @@ -3377,6 +3379,7 @@ static void ext4_set_resv_clusters(struct super_block *sb) static int ext4_fill_super(struct super_block *sb, void *data, int silent) { + struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev); char *orig_data = kstrdup(data, GFP_KERNEL); struct buffer_head *bh; struct ext4_super_block *es = NULL; @@ -3399,6 +3402,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; ext4_group_t first_not_zeroed; + sbi->s_daxdev = dax_dev; if ((data && !orig_data) || !sbi) goto out_free_base; @@ -4378,6 +4382,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) out_free_base: kfree(sbi); kfree(orig_data); + fs_put_dax(dax_dev); return err ? err : ret; } ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 4/4] ext4: perform dax_device lookup at mount 2017-08-30 19:44 ` [PATCH v3 4/4] ext4: " Dan Williams @ 2017-08-31 8:24 ` Jan Kara 0 siblings, 0 replies; 13+ messages in thread From: Jan Kara @ 2017-08-31 8:24 UTC (permalink / raw) To: Dan Williams Cc: linux-xfs, linux-ext4, Jan Kara, linux-nvdimm, Andreas Dilger, Theodore Ts'o, Christoph Hellwig On Wed 30-08-17 12:44:08, Dan Williams wrote: > The ->iomap_begin() operation is a hot path, so cache the > fs_dax_get_by_host() result at mount time to avoid the incurring the > hash lookup overhead on a per-i/o basis. > > Cc: "Theodore Ts'o" <tytso@mit.edu> > Cc: Andreas Dilger <adilger.kernel@dilger.ca> > Cc: Jan Kara <jack@suse.cz> > Reported-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Looks good to me. You can add: Reviewed-by: Jan Kara <jack@suse.cz> With the same nit as for ext2: > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index d61a70e2193a..0b3d94e25efb 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -864,6 +864,7 @@ static inline void ext4_quota_off_umount(struct super_block *sb) > static void ext4_put_super(struct super_block *sb) > { > struct ext4_sb_info *sbi = EXT4_SB(sb); > + struct dax_device *dax_dev = sbi->s_daxdev; > struct ext4_super_block *es = sbi->s_es; > int aborted = 0; > int i, err; > @@ -952,6 +953,7 @@ static void ext4_put_super(struct super_block *sb) > crypto_free_shash(sbi->s_chksum_driver); > kfree(sbi->s_blockgroup_lock); > kfree(sbi); > + fs_put_dax(dax_dev); Just remove dax_dev local variable... Honza -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-08-31 14:20 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-30 19:43 [PATCH v3 0/4] fs, dax: lookup dax_device at mount time Dan Williams [not found] ` <150412222686.10177.8031279869867070772.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-08-30 19:43 ` [PATCH v3 1/4] dax: introduce a fs_dax_get_by_bdev() helper Dan Williams 2017-08-30 21:39 ` Darrick J. Wong [not found] ` <150412223265.10177.11004612169458058274.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2017-08-31 8:25 ` Jan Kara 2017-08-31 9:55 ` Christoph Hellwig 2017-08-30 19:43 ` [PATCH v3 2/4] xfs: perform dax_device lookup at mount Dan Williams 2017-08-30 21:42 ` Darrick J. Wong 2017-08-31 9:56 ` Christoph Hellwig 2017-08-30 19:44 ` [PATCH v3 3/4] ext2: " Dan Williams 2017-08-31 8:22 ` Jan Kara 2017-08-31 14:20 ` Dan Williams 2017-08-30 19:44 ` [PATCH v3 4/4] ext4: " Dan Williams 2017-08-31 8:24 ` Jan Kara
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).