From patchwork Mon Jul 5 12:43:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suresh Jayaraman X-Patchwork-Id: 110248 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o65Chrrd000527 for ; Mon, 5 Jul 2010 12:43:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758810Ab0GEMnx (ORCPT ); Mon, 5 Jul 2010 08:43:53 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:35212 "EHLO victor.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753790Ab0GEMnw (ORCPT ); Mon, 5 Jul 2010 08:43:52 -0400 Received: from localhost (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP; Mon, 05 Jul 2010 06:43:39 -0600 From: Suresh Jayaraman To: Steve French Cc: linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, David Howells Subject: [PATCH 09/09] cifs: add mount option to enable local caching Date: Mon, 5 Jul 2010 18:13:36 +0530 Message-Id: <1278333816-30885-1-git-send-email-sjayaraman@suse.de> X-Mailer: git-send-email 1.6.4.2 In-Reply-To: References: Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 05 Jul 2010 12:43:53 +0000 (UTC) Index: cifs-2.6/fs/cifs/cifs_fs_sb.h =================================================================== --- cifs-2.6.orig/fs/cifs/cifs_fs_sb.h +++ cifs-2.6/fs/cifs/cifs_fs_sb.h @@ -35,6 +35,7 @@ #define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */ #define CIFS_MOUNT_NOPOSIXBRL 0x2000 /* mandatory not posix byte range lock */ #define CIFS_MOUNT_NOSSYNC 0x4000 /* don't do slow SMBflush on every sync*/ +#define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */ struct cifs_sb_info { struct cifsTconInfo *tcon; /* primary mount */ Index: cifs-2.6/fs/cifs/connect.c =================================================================== --- cifs-2.6.orig/fs/cifs/connect.c +++ cifs-2.6/fs/cifs/connect.c @@ -98,6 +98,7 @@ struct smb_vol { bool noblocksnd:1; bool noautotune:1; bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ + bool fsc:1; /* enable fscache */ unsigned int rsize; unsigned int wsize; bool sockopt_tcp_nodelay:1; @@ -843,6 +844,9 @@ cifs_parse_mount_options(char *options, /* default to using server inode numbers where available */ vol->server_ino = 1; + /* XXX: default to fsc for testing until mount.cifs pieces are done */ + vol->fsc = 1; + if (!options) return 1; @@ -1332,6 +1336,8 @@ cifs_parse_mount_options(char *options, printk(KERN_WARNING "CIFS: Mount option noac not " "supported. Instead set " "/proc/fs/cifs/LookupCacheEnabled to 0\n"); + } else if (strnicmp(data, "fsc", 3) == 0) { + vol->fsc = true; } else printk(KERN_WARNING "CIFS: Unknown mount option %s\n", data); @@ -2405,6 +2411,8 @@ static void setup_cifs_sb(struct smb_vol cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; if (pvolume_info->dynperm) cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DYNPERM; + if (pvolume_info->fsc) + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_FSCACHE; if (pvolume_info->direct_io) { cFYI(1, "mounting share using direct i/o"); cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO;