From: Glauber Costa Subject: [RFC 3/5] parse options at mount operation Date: Mon, 25 Jul 2011 19:16:42 +0400 Message-ID: <1311607004-15434-4-git-send-email-glommer@parallels.com> References: <1311607004-15434-1-git-send-email-glommer@parallels.com> Cc: Pavel Emelyanov , Al Viro , Hugh Dickins , Nick Piggin , Andrea Arcangeli , Rik van Riel , Dave Hansen , David Chinner , Glauber Costa To: linux-fsdevel@vger.kernel.org Return-path: Received: from mailhub.sw.ru ([195.214.232.25]:12848 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595Ab1GYPSZ (ORCPT ); Mon, 25 Jul 2011 11:18:25 -0400 In-Reply-To: <1311607004-15434-1-git-send-email-glommer@parallels.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This patch presents a proposed use of the just introduced interface. The caller is expected to have passed a vfs_dcache_size=%d option. If this is not true, nothing should be changed. If such an option is present, however, two things can happen: * A new dentry group (mob) is created, rooted at the given mount point. It has the size specified in the arguments. * An existing dentry group (mob) is modified, such that the argument passed reflects the new maximum number of dentries. Note that the existance of bind mounts allow us to specify dentry groups starting at any arbitrary point in the hierarchy. --- fs/namespace.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 3ccd264..0d8a53b 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2275,6 +2275,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, struct path path; int retval = 0; int mnt_flags = 0; + int dcache_size = 0; /* Discard magic */ if ((flags & MS_MGC_MSK) == MS_MGC_VAL) @@ -2298,6 +2299,10 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, if (retval) goto dput_out; + + dcache_size = path.mnt->dcache_size; + vfs_parse_options(data_page, path.mnt); + /* Default to relatime unless overriden */ if (!(flags & MS_NOATIME)) mnt_flags |= MNT_RELATIME; @@ -2334,6 +2339,17 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, else retval = do_new_mount(&path, type_page, flags, mnt_flags, dev_name, data_page); + + + if (retval || !path.mnt->dcache_size) + goto dput_out; + + if (!dentry_is_mob_root(path.mnt->mnt_mountpoint)) + dcache_new_mob(path.mnt->mnt_mountpoint); + if (dcache_size != path.mnt->dcache_size) + dcache_set_mob_size(path.mnt->mnt_mountpoint, path.mnt->dcache_size); + + dput_out: path_put(&path); return retval; -- 1.7.5.1