add new module parameter 'enable_oplocks'

Thus spake Jeff Layton:

"Making that a module parm would allow you to set that parameter at boot
time without needing to add special startup scripts. IMO, all of the
procfile "switches" under /proc/fs/cifs should be module parms
instead."

This patch doesn't alter the default behavior (Oplocks are enabled by
default).

To disable oplocks when loading the module, use

   modprobe cifs enable_oplocks=0

(any of '0' or 'n' or 'N' conventions can be used).

To disable oplocks at runtime using the new interface, use

   echo 0 > /sys/module/cifs/parameters/enable_oplocks

The older /proc/fs/cifs/OplockEnabled interface will be deprecated
after two releases. A subsequent patch will add an warning message
about this deprecation.

Changes since v2:
   - make enable_oplocks a 'bool'

Changes since v1:
   - eliminate the use of extra variable by renaming the old one to
     enable_oplocks and make it an 'int' type.

Reported-by: Alexander Swen <alex@swen.nu>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
Steve French
2011-10-12 17:47:03 -05:00
parent ba749e6d52
commit e75047344e
5 changed files with 13 additions and 8 deletions

View File

@@ -511,7 +511,7 @@ static const struct file_operations cifsFYI_proc_fops = {
static int cifs_oplock_proc_show(struct seq_file *m, void *v)
{
seq_printf(m, "%d\n", oplockEnabled);
seq_printf(m, "%d\n", enable_oplocks);
return 0;
}
@@ -530,9 +530,9 @@ static ssize_t cifs_oplock_proc_write(struct file *file,
if (rc)
return rc;
if (c == '0' || c == 'n' || c == 'N')
oplockEnabled = 0;
enable_oplocks = false;
else if (c == '1' || c == 'y' || c == 'Y')
oplockEnabled = 1;
enable_oplocks = true;
return count;
}