1 From: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
2 Subject: [RFC][PATCH 10/10] cifs: add mount option to enable local caching
3 Date: Tue, 22 Jun 2010 20:55:09 +0530
5 Message-ID: <1277220309-3757-1-git-send-email-sjayaraman@suse.de>
7 Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
8 linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
9 To: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
10 X-From: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Tue Jun 22 17:25:29 2010
11 Return-path: <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
12 Envelope-to: glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org
13 Received: from vger.kernel.org ([209.132.180.67])
14 by lo.gmane.org with esmtp (Exim 4.69)
15 (envelope-from <linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>)
17 for glkc-linux-cifs-1dZseelyfdZg9hUCZPvPmw@public.gmane.org; Tue, 22 Jun 2010 17:25:28 +0200
18 Received: (majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org) by vger.kernel.org via listexpand
19 id S1755015Ab0FVPZ1 (ORCPT <rfc822;glkc-linux-cifs@m.gmane.org>);
20 Tue, 22 Jun 2010 11:25:27 -0400
21 Received: from victor.provo.novell.com ([137.65.250.26]:48639 "EHLO
22 victor.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
23 with ESMTP id S1754070Ab0FVPZ1 (ORCPT
24 <rfc822;groupwise-SJayaraman-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org:0:0>);
25 Tue, 22 Jun 2010 11:25:27 -0400
26 X-Greylist: delayed 316 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Jun 2010 11:25:26 EDT
27 Received: from localhost (prv-ext-foundry1int.gns.novell.com [137.65.251.240])
28 by victor.provo.novell.com with ESMTP; Tue, 22 Jun 2010 09:25:11 -0600
29 X-Mailer: git-send-email 1.6.4.2
31 Sender: linux-cifs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
33 List-ID: <linux-cifs.vger.kernel.org>
34 X-Mailing-List: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
35 Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1001750>
37 Add a mount option 'fsc' to enable local caching on CIFS.
39 As the cifs-utils (userspace) changes are not done yet, this patch enables
40 'fsc' by default to assist testing.
42 Signed-off-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
44 fs/cifs/cifs_fs_sb.h | 1 +
45 fs/cifs/connect.c | 8 ++++++++
46 2 files changed, 9 insertions(+), 0 deletions(-)
48 diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
49 index 246a167..9e77145 100644
50 --- a/fs/cifs/cifs_fs_sb.h
51 +++ b/fs/cifs/cifs_fs_sb.h
53 #define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */
54 #define CIFS_MOUNT_NOPOSIXBRL 0x2000 /* mandatory not posix byte range lock */
55 #define CIFS_MOUNT_NOSSYNC 0x4000 /* don't do slow SMBflush on every sync*/
56 +#define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */
59 struct cifsTconInfo *tcon; /* primary mount */
60 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
61 index 4844dbd..6c6ff3c 100644
62 --- a/fs/cifs/connect.c
63 +++ b/fs/cifs/connect.c
64 @@ -98,6 +98,7 @@ struct smb_vol {
67 bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
68 + bool fsc:1; /* enable fscache */
71 bool sockopt_tcp_nodelay:1;
72 @@ -843,6 +844,9 @@ cifs_parse_mount_options(char *options, const char *devname,
73 /* default to using server inode numbers where available */
76 + /* XXX: default to fsc for testing until mount.cifs pieces are done */
82 @@ -1332,6 +1336,8 @@ cifs_parse_mount_options(char *options, const char *devname,
83 printk(KERN_WARNING "CIFS: Mount option noac not "
84 "supported. Instead set "
85 "/proc/fs/cifs/LookupCacheEnabled to 0\n");
86 + } else if (strnicmp(data, "fsc", 3) == 0) {
89 printk(KERN_WARNING "CIFS: Unknown mount option %s\n",
91 @@ -2405,6 +2411,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
92 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID;
93 if (pvolume_info->dynperm)
94 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM;
95 + if (pvolume_info->fsc)
96 + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE;
97 if (pvolume_info->direct_io) {
98 cFYI(1, "mounting share using direct i/o");
99 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;