aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2010-12-01 04:12:28 -0500
committerSteve French <sfrench@us.ibm.com>2010-12-02 14:32:11 -0500
commit6d20e8406f0942228a73000663c2b33f488103ea (patch)
tree2469267c2ee10c4c723eaa01b1f24c8d0f704870 /fs/cifs/connect.c
parent8cb280c90f9cfaab3ba3afbace0b1711dee80d0c (diff)
cifs: add attribute cache timeout (actimeo) tunable
Currently, the attribute cache timeout for CIFS is hardcoded to 1 second. This means that the client might have to issue a QPATHINFO/QFILEINFO call every 1 second to verify if something has changes, which seems too expensive. On the other hand, if the timeout is hardcoded to a higher value, workloads that expect strict cache coherency might see unexpected results. Making attribute cache timeout as a tunable will allow us to make a tradeoff between performance and cache metadata correctness depending on the application/workload needs. Add 'actimeo' tunable that can be used to tune the attribute cache timeout. The default timeout is set to 1 second. Also, display actimeo option value in /proc/mounts. It appears to me that 'actimeo' and the proposed (but not yet merged) 'strictcache' option cannot coexist, so care must be taken that we reset the other option if one of them is set. Changes since last post: - fix option parsing and handle possible values correcly Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 32fa4d9b5dbc..bb17ee2ba782 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -105,6 +105,7 @@ struct smb_vol {
105 unsigned int wsize; 105 unsigned int wsize;
106 bool sockopt_tcp_nodelay:1; 106 bool sockopt_tcp_nodelay:1;
107 unsigned short int port; 107 unsigned short int port;
108 unsigned long actimeo; /* attribute cache timeout (jiffies) */
108 char *prepath; 109 char *prepath;
109 struct sockaddr_storage srcaddr; /* allow binding to a local IP */ 110 struct sockaddr_storage srcaddr; /* allow binding to a local IP */
110 struct nls_table *local_nls; 111 struct nls_table *local_nls;
@@ -840,6 +841,8 @@ cifs_parse_mount_options(char *options, const char *devname,
840 /* default to using server inode numbers where available */ 841 /* default to using server inode numbers where available */
841 vol->server_ino = 1; 842 vol->server_ino = 1;
842 843
844 vol->actimeo = CIFS_DEF_ACTIMEO;
845
843 if (!options) 846 if (!options)
844 return 1; 847 return 1;
845 848
@@ -1214,6 +1217,16 @@ cifs_parse_mount_options(char *options, const char *devname,
1214 printk(KERN_WARNING "CIFS: server net" 1217 printk(KERN_WARNING "CIFS: server net"
1215 "biosname longer than 15 truncated.\n"); 1218 "biosname longer than 15 truncated.\n");
1216 } 1219 }
1220 } else if (strnicmp(data, "actimeo", 7) == 0) {
1221 if (value && *value) {
1222 vol->actimeo = HZ * simple_strtoul(value,
1223 &value, 0);
1224 if (vol->actimeo > CIFS_MAX_ACTIMEO) {
1225 cERROR(1, "CIFS: attribute cache"
1226 "timeout too large");
1227 return 1;
1228 }
1229 }
1217 } else if (strnicmp(data, "credentials", 4) == 0) { 1230 } else if (strnicmp(data, "credentials", 4) == 0) {
1218 /* ignore */ 1231 /* ignore */
1219 } else if (strnicmp(data, "version", 3) == 0) { 1232 } else if (strnicmp(data, "version", 3) == 0) {
@@ -2571,6 +2584,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
2571 cFYI(1, "file mode: 0x%x dir mode: 0x%x", 2584 cFYI(1, "file mode: 0x%x dir mode: 0x%x",
2572 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); 2585 cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
2573 2586
2587 cifs_sb->actimeo = pvolume_info->actimeo;
2588
2574 if (pvolume_info->noperm) 2589 if (pvolume_info->noperm)
2575 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; 2590 cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
2576 if (pvolume_info->setuids) 2591 if (pvolume_info->setuids)