Skip to contentSkip to conversation

cifs: add mount option to enable local caching

RFC PATCH In review Suresh Jayaraman 3 participants 4 messages Jun 22, 2010 – Jun 25, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 10/10 cifs: add mount option to enable local caching

Add a mount option 'fsc' to enable local caching on CIFS.

As the cifs-utils (userspace) changes are not done yet, this patch enables 'fsc' by default to assist testing.

---
 fs/cifs/cifs_fs_sb.h |    1 +
 fs/cifs/connect.c    |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
fs/cifs/cifs_fs_sb.h +1 -0
index 246a167..9e77145 100644
@@ -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 */
fs/cifs/connect.c +8 -0
index 4844dbd..6c6ff3c 100644
@@ -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, const char *devname,
 	/* 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, const char *devname,
 			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 *pvolume_info,
 		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;
Signature · 1 line
1.6.4.2
#2 lore raw
In reply to Suresh Jayaraman
Quoted 5 lines · Suresh Jayaraman

Add a mount option 'fsc' to enable local caching on CIFS.

As the cifs-utils (userspace) changes are not done yet, this patch enables 'fsc' by default to assist testing.

[...]

Quoted 11 lines
fs/cifs/connect.c +2 -0
@@ -1332,6 +1336,8 @@ cifs_parse_mount_options(char *options, const char *devname,
  			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);

fs/cifs/connect.c static void setup_cifs_sb(struct smb_vol *pvolume_info, · line 2418

Quoted 8 lines
fs/cifs/connect.c +2 -0
@@ -2405,6 +2411,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
  		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;

I reworked the CIFS mount option parsing a while back; I'm not sure whether that patch was going to be in the 2.6.35 tree or not (the window just opened, didn't it?).

Jeff, Steve, can you confirm if that patch is going to be in 2.6.35?

Patch refs: http://patchwork.ozlabs.org/patch/53059/ and http://patchwork.ozlabs.org/patch/53674/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 24 lines · Scott Lovenberg
Quoted 6 lines · Suresh Jayaraman

Add a mount option 'fsc' to enable local caching on CIFS.

As the cifs-utils (userspace) changes are not done yet, this patch enables
'fsc' by default to assist testing.

[...]

Quoted 16 lines
fs/cifs/connect.c +2 -0
@@ -1332,6 +1336,8 @@ cifs_parse_mount_options(char *options, const
 char *devname,
              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);
fs/cifs/connect.c +1 -0
@@ -2405,6 +2411,8 @@ static void setup_cifs_sb(struct smb_vol
 *pvolume_info,
          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)
Quoted 8 lines
Quoted 5 lines
fs/cifs/connect.c +1 -0
+        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;

I reworked the CIFS mount option parsing a while back; I'm not sure whether that patch was going to be in the 2.6.35 tree or not (the window just opened, didn't it?).

Not a problem, I could redo this patch alone when the reworked option parsing patches get in.

Quoted 5 lines

Jeff, Steve, can you confirm if that patch is going to be in 2.6.35?

Patch refs: http://patchwork.ozlabs.org/patch/53059/ and
http://patchwork.ozlabs.org/patch/53674/

Thanks,

Signature · 1 line
Suresh Jayaraman