Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806355/?format=api
{ "id": 806355, "url": "http://patchwork.ozlabs.org/api/patches/806355/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/patch/150389212075.25151.17146973298430877023.stgit@dwillia2-desk3.amr.corp.intel.com/", "project": { "id": 8, "url": "http://patchwork.ozlabs.org/api/projects/8/?format=api", "name": "Linux ext4 filesystem development", "link_name": "linux-ext4", "list_id": "linux-ext4.vger.kernel.org", "list_email": "linux-ext4@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<150389212075.25151.17146973298430877023.stgit@dwillia2-desk3.amr.corp.intel.com>", "list_archive_url": null, "date": "2017-08-28T03:48:40", "name": "[v2,1/2] fs, xfs: perform dax_device lookup at mount", "commit_ref": null, "pull_url": null, "state": "new", "archived": true, "hash": "f72c976456353cb3a281fbc428a35f49f7c9cf9a", "submitter": { "id": 347, "url": "http://patchwork.ozlabs.org/api/people/347/?format=api", "name": "Dan Williams", "email": "dan.j.williams@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-ext4/patch/150389212075.25151.17146973298430877023.stgit@dwillia2-desk3.amr.corp.intel.com/mbox/", "series": [ { "id": 64, "url": "http://patchwork.ozlabs.org/api/series/64/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-ext4/list/?series=64", "date": "2017-08-28T03:48:35", "name": "fs, dax: lookup dax_device at mount time", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/64/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806355/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806355/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-ext4-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgdFp32gKz9t1t\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 28 Aug 2017 13:55:10 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751889AbdH1DzG (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 27 Aug 2017 23:55:06 -0400", "from mga05.intel.com ([192.55.52.43]:10923 \"EHLO mga05.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751768AbdH1DzF (ORCPT <rfc822;linux-ext4@vger.kernel.org>);\n\tSun, 27 Aug 2017 23:55:05 -0400", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga105.fm.intel.com with ESMTP; 27 Aug 2017 20:55:04 -0700", "from dwillia2-desk3.jf.intel.com (HELO\n\tdwillia2-desk3.amr.corp.intel.com) ([10.54.39.125])\n\tby orsmga003.jf.intel.com with ESMTP; 27 Aug 2017 20:55:04 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.41,439,1498546800\"; d=\"scan'208\";a=\"1008224425\"", "Subject": "[PATCH v2 1/2] fs, xfs: perform dax_device lookup at mount", "From": "Dan Williams <dan.j.williams@intel.com>", "To": "linux-fsdevel@vger.kernel.org", "Cc": "jack@suse.cz, linux-nvdimm@lists.01.org,\n\t\"Darrick J. Wong\" <darrick.wong@oracle.com>,\n\tlinux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, hch@lst.de", "Date": "Sun, 27 Aug 2017 20:48:40 -0700", "Message-ID": "<150389212075.25151.17146973298430877023.stgit@dwillia2-desk3.amr.corp.intel.com>", "In-Reply-To": "<150389211501.25151.6477753201827914462.stgit@dwillia2-desk3.amr.corp.intel.com>", "References": "<150389211501.25151.6477753201827914462.stgit@dwillia2-desk3.amr.corp.intel.com>", "User-Agent": "StGit/0.17.1-9-g687f", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Sender": "linux-ext4-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-ext4.vger.kernel.org>", "X-Mailing-List": "linux-ext4@vger.kernel.org" }, "content": "The ->iomap_begin() operation is a hot path, so cache the\nfs_dax_get_by_host() result at mount time to avoid the incurring the\nhash lookup overhead on a per-i/o basis.\n\nCc: \"Darrick J. Wong\" <darrick.wong@oracle.com>\nReported-by: Christoph Hellwig <hch@lst.de>\nSigned-off-by: Dan Williams <dan.j.williams@intel.com>\n---\n drivers/dax/super.c | 10 ++++++++++\n fs/super.c | 26 +++++++++++++++++++++++---\n fs/xfs/xfs_aops.c | 13 +++++++++++++\n fs/xfs/xfs_aops.h | 1 +\n fs/xfs/xfs_buf.c | 4 +++-\n fs/xfs/xfs_buf.h | 3 ++-\n fs/xfs/xfs_iomap.c | 10 +---------\n fs/xfs/xfs_super.c | 21 +++++++++++++++++----\n include/linux/dax.h | 6 ++++++\n include/linux/fs.h | 1 +\n 10 files changed, 77 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/dax/super.c b/drivers/dax/super.c\nindex 938eb4868f7f..b699aac268a6 100644\n--- a/drivers/dax/super.c\n+++ b/drivers/dax/super.c\n@@ -46,6 +46,8 @@ void dax_read_unlock(int id)\n EXPORT_SYMBOL_GPL(dax_read_unlock);\n \n #ifdef CONFIG_BLOCK\n+#include <linux/blkdev.h>\n+\n int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,\n \t\tpgoff_t *pgoff)\n {\n@@ -59,6 +61,14 @@ int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,\n }\n EXPORT_SYMBOL(bdev_dax_pgoff);\n \n+struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)\n+{\n+\tif (!blk_queue_dax(bdev->bd_queue))\n+\t\treturn NULL;\n+\treturn fs_dax_get_by_host(bdev->bd_disk->disk_name);\n+}\n+EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);\n+\n /**\n * __bdev_dax_supported() - Check if the device supports dax for filesystem\n * @sb: The superblock of the device\ndiff --git a/fs/super.c b/fs/super.c\nindex 6bc3352adcf3..671889b02bed 100644\n--- a/fs/super.c\n+++ b/fs/super.c\n@@ -23,6 +23,7 @@\n #include <linux/export.h>\n #include <linux/slab.h>\n #include <linux/blkdev.h>\n+#include <linux/dax.h>\n #include <linux/mount.h>\n #include <linux/security.h>\n #include <linux/writeback.h>\t\t/* for the emergency remount stuff */\n@@ -1048,9 +1049,17 @@ struct dentry *mount_ns(struct file_system_type *fs_type,\n EXPORT_SYMBOL(mount_ns);\n \n #ifdef CONFIG_BLOCK\n+struct sget_devs {\n+\tstruct block_device *bdev;\n+\tstruct dax_device *dax_dev;\n+};\n+\n static int set_bdev_super(struct super_block *s, void *data)\n {\n-\ts->s_bdev = data;\n+\tstruct sget_devs *devs = data;\n+\n+\ts->s_bdev = devs->bdev;\n+\ts->s_daxdev = devs->dax_dev;\n \ts->s_dev = s->s_bdev->bd_dev;\n \ts->s_bdi = bdi_get(s->s_bdev->bd_bdi);\n \n@@ -1059,14 +1068,18 @@ static int set_bdev_super(struct super_block *s, void *data)\n \n static int test_bdev_super(struct super_block *s, void *data)\n {\n-\treturn (void *)s->s_bdev == data;\n+\tstruct sget_devs *devs = data;\n+\n+\treturn s->s_bdev == devs->bdev;\n }\n \n struct dentry *mount_bdev(struct file_system_type *fs_type,\n \tint flags, const char *dev_name, void *data,\n \tint (*fill_super)(struct super_block *, void *, int))\n {\n+\tstruct sget_devs devs;\n \tstruct block_device *bdev;\n+\tstruct dax_device *dax_dev;\n \tstruct super_block *s;\n \tfmode_t mode = FMODE_READ | FMODE_EXCL;\n \tint error = 0;\n@@ -1077,6 +1090,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,\n \tbdev = blkdev_get_by_path(dev_name, mode, fs_type);\n \tif (IS_ERR(bdev))\n \t\treturn ERR_CAST(bdev);\n+\tdax_dev = fs_dax_get_by_bdev(bdev);\n \n \t/*\n \t * once the super is inserted into the list by sget, s_umount\n@@ -1089,8 +1103,10 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,\n \t\terror = -EBUSY;\n \t\tgoto error_bdev;\n \t}\n+\tdevs.bdev = bdev;\n+\tdevs.dax_dev = dax_dev;\n \ts = sget(fs_type, test_bdev_super, set_bdev_super, flags | MS_NOSEC,\n-\t\t bdev);\n+\t\t &devs);\n \tmutex_unlock(&bdev->bd_fsfreeze_mutex);\n \tif (IS_ERR(s))\n \t\tgoto error_s;\n@@ -1111,6 +1127,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,\n \t\t */\n \t\tup_write(&s->s_umount);\n \t\tblkdev_put(bdev, mode);\n+\t\tfs_put_dax(dax_dev);\n \t\tdown_write(&s->s_umount);\n \t} else {\n \t\ts->s_mode = mode;\n@@ -1132,6 +1149,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,\n \terror = PTR_ERR(s);\n error_bdev:\n \tblkdev_put(bdev, mode);\n+\tfs_put_dax(dax_dev);\n error:\n \treturn ERR_PTR(error);\n }\n@@ -1140,6 +1158,7 @@ EXPORT_SYMBOL(mount_bdev);\n void kill_block_super(struct super_block *sb)\n {\n \tstruct block_device *bdev = sb->s_bdev;\n+\tstruct dax_device *dax_dev = sb->s_daxdev;\n \tfmode_t mode = sb->s_mode;\n \n \tbdev->bd_super = NULL;\n@@ -1147,6 +1166,7 @@ void kill_block_super(struct super_block *sb)\n \tsync_blockdev(bdev);\n \tWARN_ON_ONCE(!(mode & FMODE_EXCL));\n \tblkdev_put(bdev, mode | FMODE_EXCL);\n+\tfs_put_dax(dax_dev);\n }\n \n EXPORT_SYMBOL(kill_block_super);\ndiff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c\nindex 6bf120bb1a17..78185f3b10b2 100644\n--- a/fs/xfs/xfs_aops.c\n+++ b/fs/xfs/xfs_aops.c\n@@ -80,6 +80,19 @@ xfs_find_bdev_for_inode(\n \t\treturn mp->m_ddev_targp->bt_bdev;\n }\n \n+struct dax_device *\n+xfs_find_daxdev_for_inode(\n+\tstruct inode\t\t*inode)\n+{\n+\tstruct xfs_inode\t*ip = XFS_I(inode);\n+\tstruct xfs_mount\t*mp = ip->i_mount;\n+\n+\tif (XFS_IS_REALTIME_INODE(ip))\n+\t\treturn mp->m_rtdev_targp->bt_daxdev;\n+\telse\n+\t\treturn mp->m_ddev_targp->bt_daxdev;\n+}\n+\n /*\n * We're now finished for good with this page. Update the page state via the\n * associated buffer_heads, paying attention to the start and end offsets that\ndiff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h\nindex cc174ec6c2fd..88c85ea63da0 100644\n--- a/fs/xfs/xfs_aops.h\n+++ b/fs/xfs/xfs_aops.h\n@@ -59,5 +59,6 @@ int\txfs_setfilesize(struct xfs_inode *ip, xfs_off_t offset, size_t size);\n \n extern void xfs_count_page_state(struct page *, int *, int *);\n extern struct block_device *xfs_find_bdev_for_inode(struct inode *);\n+extern struct dax_device *xfs_find_daxdev_for_inode(struct inode *);\n \n #endif /* __XFS_AOPS_H__ */\ndiff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c\nindex 72f038492ba8..6deb86c845d1 100644\n--- a/fs/xfs/xfs_buf.c\n+++ b/fs/xfs/xfs_buf.c\n@@ -1802,7 +1802,8 @@ xfs_setsize_buftarg_early(\n xfs_buftarg_t *\n xfs_alloc_buftarg(\n \tstruct xfs_mount\t*mp,\n-\tstruct block_device\t*bdev)\n+\tstruct block_device\t*bdev,\n+\tstruct dax_device\t*dax_dev)\n {\n \txfs_buftarg_t\t\t*btp;\n \n@@ -1811,6 +1812,7 @@ xfs_alloc_buftarg(\n \tbtp->bt_mount = mp;\n \tbtp->bt_dev = bdev->bd_dev;\n \tbtp->bt_bdev = bdev;\n+\tbtp->bt_daxdev = dax_dev;\n \n \tif (xfs_setsize_buftarg_early(btp, bdev))\n \t\tgoto error;\ndiff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h\nindex 20721261dae5..bf71507ddb16 100644\n--- a/fs/xfs/xfs_buf.h\n+++ b/fs/xfs/xfs_buf.h\n@@ -108,6 +108,7 @@ typedef unsigned int xfs_buf_flags_t;\n typedef struct xfs_buftarg {\n \tdev_t\t\t\tbt_dev;\n \tstruct block_device\t*bt_bdev;\n+\tstruct dax_device\t*bt_daxdev;\n \tstruct xfs_mount\t*bt_mount;\n \tunsigned int\t\tbt_meta_sectorsize;\n \tsize_t\t\t\tbt_meta_sectormask;\n@@ -385,7 +386,7 @@ xfs_buf_update_cksum(struct xfs_buf *bp, unsigned long cksum_offset)\n *\tHandling of buftargs.\n */\n extern xfs_buftarg_t *xfs_alloc_buftarg(struct xfs_mount *,\n-\t\t\tstruct block_device *);\n+\t\t\tstruct block_device *, struct dax_device *);\n extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *);\n extern void xfs_wait_buftarg(xfs_buftarg_t *);\n extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int);\ndiff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c\nindex 813394c62849..7c934e407332 100644\n--- a/fs/xfs/xfs_iomap.c\n+++ b/fs/xfs/xfs_iomap.c\n@@ -69,6 +69,7 @@ xfs_bmbt_to_iomap(\n \tiomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);\n \tiomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);\n \tiomap->bdev = xfs_find_bdev_for_inode(VFS_I(ip));\n+\tiomap->dax_dev = xfs_find_daxdev_for_inode(VFS_I(ip));\n }\n \n xfs_extlen_t\n@@ -976,7 +977,6 @@ xfs_file_iomap_begin(\n \tint\t\t\tnimaps = 1, error = 0;\n \tbool\t\t\tshared = false, trimmed = false;\n \tunsigned\t\tlockmode;\n-\tstruct block_device\t*bdev;\n \n \tif (XFS_FORCED_SHUTDOWN(mp))\n \t\treturn -EIO;\n@@ -1087,13 +1087,6 @@ xfs_file_iomap_begin(\n \n \txfs_bmbt_to_iomap(ip, iomap, &imap);\n \n-\t/* optionally associate a dax device with the iomap bdev */\n-\tbdev = iomap->bdev;\n-\tif (blk_queue_dax(bdev->bd_queue))\n-\t\tiomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);\n-\telse\n-\t\tiomap->dax_dev = NULL;\n-\n \tif (shared)\n \t\tiomap->flags |= IOMAP_F_SHARED;\n \treturn 0;\n@@ -1171,7 +1164,6 @@ xfs_file_iomap_end(\n \tunsigned\t\tflags,\n \tstruct iomap\t\t*iomap)\n {\n-\tfs_put_dax(iomap->dax_dev);\n \tif ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)\n \t\treturn xfs_file_iomap_end_delalloc(XFS_I(inode), offset,\n \t\t\t\tlength, written, iomap);\ndiff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c\nindex 38aaacdbb8b3..d863f96b16e2 100644\n--- a/fs/xfs/xfs_super.c\n+++ b/fs/xfs/xfs_super.c\n@@ -716,13 +716,19 @@ xfs_close_devices(\n {\n \tif (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {\n \t\tstruct block_device *logdev = mp->m_logdev_targp->bt_bdev;\n+\t\tstruct dax_device *dax_logdev = mp->m_logdev_targp->bt_daxdev;\n+\n \t\txfs_free_buftarg(mp, mp->m_logdev_targp);\n \t\txfs_blkdev_put(logdev);\n+\t\tfs_put_dax(dax_logdev);\n \t}\n \tif (mp->m_rtdev_targp) {\n \t\tstruct block_device *rtdev = mp->m_rtdev_targp->bt_bdev;\n+\t\tstruct dax_device *dax_rtdev = mp->m_rtdev_targp->bt_daxdev;\n+\n \t\txfs_free_buftarg(mp, mp->m_rtdev_targp);\n \t\txfs_blkdev_put(rtdev);\n+\t\tfs_put_dax(dax_rtdev);\n \t}\n \txfs_free_buftarg(mp, mp->m_ddev_targp);\n }\n@@ -742,7 +748,9 @@ xfs_open_devices(\n \tstruct xfs_mount\t*mp)\n {\n \tstruct block_device\t*ddev = mp->m_super->s_bdev;\n+\tstruct dax_device\t*dax_ddev = mp->m_super->s_daxdev;\n \tstruct block_device\t*logdev = NULL, *rtdev = NULL;\n+\tstruct dax_device\t*dax_logdev = NULL, *dax_rtdev = NULL;\n \tint\t\t\terror;\n \n \t/*\n@@ -752,6 +760,7 @@ xfs_open_devices(\n \t\terror = xfs_blkdev_get(mp, mp->m_logname, &logdev);\n \t\tif (error)\n \t\t\tgoto out;\n+\t\tdax_logdev = fs_dax_get_by_bdev(logdev);\n \t}\n \n \tif (mp->m_rtname) {\n@@ -765,24 +774,25 @@ xfs_open_devices(\n \t\t\terror = -EINVAL;\n \t\t\tgoto out_close_rtdev;\n \t\t}\n+\t\tdax_rtdev = fs_dax_get_by_bdev(rtdev);\n \t}\n \n \t/*\n \t * Setup xfs_mount buffer target pointers\n \t */\n \terror = -ENOMEM;\n-\tmp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev);\n+\tmp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev, dax_ddev);\n \tif (!mp->m_ddev_targp)\n \t\tgoto out_close_rtdev;\n \n \tif (rtdev) {\n-\t\tmp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev);\n+\t\tmp->m_rtdev_targp = xfs_alloc_buftarg(mp, rtdev, dax_rtdev);\n \t\tif (!mp->m_rtdev_targp)\n \t\t\tgoto out_free_ddev_targ;\n \t}\n \n \tif (logdev && logdev != ddev) {\n-\t\tmp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev);\n+\t\tmp->m_logdev_targp = xfs_alloc_buftarg(mp, logdev, dax_logdev);\n \t\tif (!mp->m_logdev_targp)\n \t\t\tgoto out_free_rtdev_targ;\n \t} else {\n@@ -798,9 +808,12 @@ xfs_open_devices(\n \txfs_free_buftarg(mp, mp->m_ddev_targp);\n out_close_rtdev:\n \txfs_blkdev_put(rtdev);\n+\tfs_put_dax(dax_rtdev);\n out_close_logdev:\n-\tif (logdev && logdev != ddev)\n+\tif (logdev && logdev != ddev) {\n \t\txfs_blkdev_put(logdev);\n+\t\tfs_put_dax(dax_logdev);\n+\t}\n out:\n \treturn error;\n }\ndiff --git a/include/linux/dax.h b/include/linux/dax.h\nindex df97b7af7e2c..6e32be3badec 100644\n--- a/include/linux/dax.h\n+++ b/include/linux/dax.h\n@@ -57,6 +57,7 @@ static inline void fs_put_dax(struct dax_device *dax_dev)\n \tput_dax(dax_dev);\n }\n \n+struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);\n #else\n static inline int bdev_dax_supported(struct super_block *sb, int blocksize)\n {\n@@ -71,6 +72,11 @@ static inline struct dax_device *fs_dax_get_by_host(const char *host)\n static inline void fs_put_dax(struct dax_device *dax_dev)\n {\n }\n+\n+struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)\n+{\n+\treturn NULL;\n+}\n #endif\n \n int dax_read_lock(void);\ndiff --git a/include/linux/fs.h b/include/linux/fs.h\nindex 6e1fd5d21248..d0e3234a1fae 100644\n--- a/include/linux/fs.h\n+++ b/include/linux/fs.h\n@@ -1334,6 +1334,7 @@ struct super_block {\n \tstruct hlist_bl_head\ts_anon;\t\t/* anonymous dentries for (nfs) exporting */\n \tstruct list_head\ts_mounts;\t/* list of mounts; _not_ for fs use */\n \tstruct block_device\t*s_bdev;\n+\tstruct dax_device\t*s_daxdev;\n \tstruct backing_dev_info *s_bdi;\n \tstruct mtd_info\t\t*s_mtd;\n \tstruct hlist_node\ts_instances;\n", "prefixes": [ "v2", "1/2" ] }