linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zwu.kernel@gmail.com
To: viro@zeniv.linux.org.uk
Cc: torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	Dave Chinner <dchinner@redhat.com>,
	Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: [[RESEND]PATCH v4 10/10] VFS hot tracking, xfs: Add hot tracking support
Date: Mon, 12 Aug 2013 10:20:24 +0800	[thread overview]
Message-ID: <1376274024-28689-11-git-send-email-zwu.kernel@gmail.com> (raw)
In-Reply-To: <1376274024-28689-1-git-send-email-zwu.kernel@gmail.com>

From: Dave Chinner <dchinner@redhat.com>

Connect up the VFS hot tracking support so XFS filesystem
can make use of it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_mount.h |  1 +
 fs/xfs/xfs_super.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 4e374d4..948a070 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -222,6 +222,7 @@ typedef struct xfs_mount {
 #define XFS_MOUNT_WSYNC		(1ULL << 0)	/* for nfs - all metadata ops
 						   must be synchronous except
 						   for space allocations */
+#define XFS_MOUNT_HOTTRACK      (1ULL << 1)     /* hot tracking */
 #define XFS_MOUNT_WAS_CLEAN	(1ULL << 3)
 #define XFS_MOUNT_FS_SHUTDOWN	(1ULL << 4)	/* atomic stop of all filesystem
 						   operations, typically for
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 1d68ffc..e3ea98b 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -62,6 +62,7 @@
 #include <linux/kthread.h>
 #include <linux/freezer.h>
 #include <linux/parser.h>
+#include <linux/hot_tracking.h>
 
 static const struct super_operations xfs_super_operations;
 static kmem_zone_t *xfs_ioend_zone;
@@ -115,6 +116,7 @@ mempool_t *xfs_ioend_pool;
 #define MNTOPT_NODELAYLOG  "nodelaylog"	/* Delayed logging disabled */
 #define MNTOPT_DISCARD	   "discard"	/* Discard unused blocks */
 #define MNTOPT_NODISCARD   "nodiscard"	/* Do not discard unused blocks */
+#define MNTOPT_HOTTRACK    "hot_track"  /* hot tracking */
 
 /*
  * Table driven mount option parser.
@@ -381,6 +383,8 @@ xfs_parseargs(
 			mp->m_flags |= XFS_MOUNT_DISCARD;
 		} else if (!strcmp(this_char, MNTOPT_NODISCARD)) {
 			mp->m_flags &= ~XFS_MOUNT_DISCARD;
+		} else if (!strcmp(this_char, MNTOPT_HOTTRACK)) {
+			mp->m_flags |= XFS_MOUNT_HOTTRACK;
 		} else if (!strcmp(this_char, "ihashsize")) {
 			xfs_warn(mp,
 	"ihashsize no longer used, option is deprecated.");
@@ -510,6 +514,7 @@ xfs_showargs(
 		{ XFS_MOUNT_GRPID,		"," MNTOPT_GRPID },
 		{ XFS_MOUNT_DISCARD,		"," MNTOPT_DISCARD },
 		{ XFS_MOUNT_SMALL_INUMS,	"," MNTOPT_32BITINODE },
+		{ XFS_MOUNT_HOTTRACK,		"," MNTOPT_HOTTRACK },
 		{ 0, NULL }
 	};
 	static struct proc_xfs_info xfs_info_unset[] = {
@@ -1053,6 +1058,9 @@ xfs_fs_put_super(
 {
 	struct xfs_mount	*mp = XFS_M(sb);
 
+	if (mp->m_flags & XFS_MOUNT_HOTTRACK)
+		hot_track_exit(sb);
+
 	xfs_filestream_unmount(mp);
 	xfs_unmountfs(mp);
 
@@ -1500,8 +1508,18 @@ xfs_fs_fill_super(
 		goto out_unmount;
 	}
 
+	if (mp->m_flags & XFS_MOUNT_HOTTRACK) {
+		error = hot_track_init(sb);
+		if (error)
+			goto out_free_root;
+	}
+
 	return 0;
 
+ out_free_root:
+	dput(sb->s_root);
+	sb->s_root = NULL;
+
  out_filestream_unmount:
 	xfs_filestream_unmount(mp);
  out_free_sb:
-- 
1.7.11.7


  parent reply	other threads:[~2013-08-12  2:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12  2:20 [[RESEND]PATCH v4 00/10] VFS hot tracking zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 01/10] VFS hot tracking: Define basic data structures and functions zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 02/10] VFS hot tracking: Track IO and record heat information zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 03/10] VFS hot tracking: Add a workqueue to move items between hot maps zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 04/10] VFS hot tracking: Add shrinker functionality to curtail memory usage zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 05/10] VFS hot tracking: Add an ioctl to get hot tracking information zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 06/10] VFS hot tracking: Add a /proc interface to make the interval tunable zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 07/10] VFS hot tracking: Add a /proc interfaces to control memory usage zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 08/10] VFS hot tracking: Add documentation zwu.kernel
2013-08-12  2:20 ` [[RESEND]PATCH v4 09/10] VFS hot tracking, btrfs: Add hot tracking support zwu.kernel
2013-08-12  2:20 ` zwu.kernel [this message]
2013-08-12  2:27 ` [[RESEND]PATCH v4 00/10] VFS hot tracking Zhi Yong Wu
2013-08-13 18:32 ` Jörn Engel
2013-08-13 21:22 ` Al Viro

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=1376274024-28689-11-git-send-email-zwu.kernel@gmail.com \
    --to=zwu.kernel@gmail.com \
    --cc=dchinner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wuzhy@linux.vnet.ibm.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).