ceph: ensure Boolean options support both senses

Many ceph-related Boolean options offer the ability to both enable
and disable a feature.  For all those that don't offer this, add
a new option so that they do.

Note that ceph_show_options()--which reports mount options currently
in effect--only reports the option if it is different from the
default value.

Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Alex Elder 2012-02-15 07:43:54 -06:00
parent d3002b974c
commit cffaba15cd
2 changed files with 20 additions and 0 deletions

View File

@ -130,10 +130,12 @@ enum {
Opt_nodirstat, Opt_nodirstat,
Opt_rbytes, Opt_rbytes,
Opt_norbytes, Opt_norbytes,
Opt_asyncreaddir,
Opt_noasyncreaddir, Opt_noasyncreaddir,
Opt_dcache, Opt_dcache,
Opt_nodcache, Opt_nodcache,
Opt_ino32, Opt_ino32,
Opt_noino32,
}; };
static match_table_t fsopt_tokens = { static match_table_t fsopt_tokens = {
@ -153,10 +155,12 @@ static match_table_t fsopt_tokens = {
{Opt_nodirstat, "nodirstat"}, {Opt_nodirstat, "nodirstat"},
{Opt_rbytes, "rbytes"}, {Opt_rbytes, "rbytes"},
{Opt_norbytes, "norbytes"}, {Opt_norbytes, "norbytes"},
{Opt_asyncreaddir, "asyncreaddir"},
{Opt_noasyncreaddir, "noasyncreaddir"}, {Opt_noasyncreaddir, "noasyncreaddir"},
{Opt_dcache, "dcache"}, {Opt_dcache, "dcache"},
{Opt_nodcache, "nodcache"}, {Opt_nodcache, "nodcache"},
{Opt_ino32, "ino32"}, {Opt_ino32, "ino32"},
{Opt_noino32, "noino32"},
{-1, NULL} {-1, NULL}
}; };
@ -232,6 +236,9 @@ static int parse_fsopt_token(char *c, void *private)
case Opt_norbytes: case Opt_norbytes:
fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES; fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES;
break; break;
case Opt_asyncreaddir:
fsopt->flags &= ~CEPH_MOUNT_OPT_NOASYNCREADDIR;
break;
case Opt_noasyncreaddir: case Opt_noasyncreaddir:
fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR; fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
break; break;
@ -244,6 +251,9 @@ static int parse_fsopt_token(char *c, void *private)
case Opt_ino32: case Opt_ino32:
fsopt->flags |= CEPH_MOUNT_OPT_INO32; fsopt->flags |= CEPH_MOUNT_OPT_INO32;
break; break;
case Opt_noino32:
fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
break;
default: default:
BUG_ON(token); BUG_ON(token);
} }

View File

@ -201,7 +201,9 @@ enum {
Opt_ip, Opt_ip,
Opt_last_string, Opt_last_string,
/* string args above */ /* string args above */
Opt_share,
Opt_noshare, Opt_noshare,
Opt_crc,
Opt_nocrc, Opt_nocrc,
}; };
@ -217,7 +219,9 @@ static match_table_t opt_tokens = {
{Opt_key, "key=%s"}, {Opt_key, "key=%s"},
{Opt_ip, "ip=%s"}, {Opt_ip, "ip=%s"},
/* string args above */ /* string args above */
{Opt_share, "share"},
{Opt_noshare, "noshare"}, {Opt_noshare, "noshare"},
{Opt_crc, "crc"},
{Opt_nocrc, "nocrc"}, {Opt_nocrc, "nocrc"},
{-1, NULL} {-1, NULL}
}; };
@ -399,10 +403,16 @@ ceph_parse_options(char *options, const char *dev_name,
opt->mount_timeout = intval; opt->mount_timeout = intval;
break; break;
case Opt_share:
opt->flags &= ~CEPH_OPT_NOSHARE;
break;
case Opt_noshare: case Opt_noshare:
opt->flags |= CEPH_OPT_NOSHARE; opt->flags |= CEPH_OPT_NOSHARE;
break; break;
case Opt_crc:
opt->flags &= ~CEPH_OPT_NOCRC;
break;
case Opt_nocrc: case Opt_nocrc:
opt->flags |= CEPH_OPT_NOCRC; opt->flags |= CEPH_OPT_NOCRC;
break; break;