From patchwork Mon Oct 29 04:30:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyong Wu X-Patchwork-Id: 1660851 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B336BDFB7A for ; Mon, 29 Oct 2012 04:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757988Ab2J2Ee3 (ORCPT ); Mon, 29 Oct 2012 00:34:29 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:34465 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757951Ab2J2Ee0 (ORCPT ); Mon, 29 Oct 2012 00:34:26 -0400 Received: from /spool/local by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 28 Oct 2012 22:34:25 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 28 Oct 2012 22:34:01 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 11F503E40026; Sun, 28 Oct 2012 22:33:00 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9T4X0xl176516; Sun, 28 Oct 2012 22:33:00 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9T4WxSV026160; Sun, 28 Oct 2012 22:33:00 -0600 Received: from us.ibm.com ([9.115.122.193]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q9T4WsGn025955; Sun, 28 Oct 2012 22:32:55 -0600 Received: by us.ibm.com (sSMTP sendmail emulation); Mon, 29 Oct 2012 12:32:49 +0800 From: zwu.kernel@gmail.com To: linux-fsdevel@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, linuxram@linux.vnet.ibm.com, viro@zeniv.linux.org.uk, david@fromorbit.com, tytso@mit.edu, cmm@us.ibm.com, wuzhy@linux.vnet.ibm.com, wenqing.lz@taobao.com, Dave Chinner Subject: [RFC v4+ hot_track 17/19] xfs: add hot tracking support Date: Mon, 29 Oct 2012 12:30:59 +0800 Message-Id: <1351485061-12297-18-git-send-email-zwu.kernel@gmail.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1351485061-12297-1-git-send-email-zwu.kernel@gmail.com> References: <1351485061-12297-1-git-send-email-zwu.kernel@gmail.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12102904-5406-0000-0000-00000180FC7E Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Dave Chinner Connect up the VFS hot tracking support so XFS filesystems can make use of it. Signed-off-by: Dave Chinner --- fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index deee09e..96d93c2 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -217,6 +217,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 inode 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 26a09bd..48b3bed 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -61,6 +61,7 @@ #include #include #include +#include static const struct super_operations xfs_super_operations; static kmem_zone_t *xfs_ioend_zone; @@ -114,6 +115,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 inode tracking */ /* * Table driven mount option parser. @@ -371,6 +373,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."); @@ -1005,6 +1009,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); cancel_delayed_work_sync(&mp->m_sync_work); xfs_unmountfs(mp); @@ -1407,7 +1414,16 @@ 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_syncd_stop: xfs_syncd_stop(mp); out_filestream_unmount: