diff options
| -rw-r--r-- | fs/ceph/super.c | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index c1ea38e5aebd..3100c909cbb1 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #include "ceph_debug.h" | 2 | #include "ceph_debug.h" |
| 3 | 3 | ||
| 4 | #include <linux/backing-dev.h> | 4 | #include <linux/backing-dev.h> |
| 5 | #include <linux/ctype.h> | ||
| 5 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
| 6 | #include <linux/inet.h> | 7 | #include <linux/inet.h> |
| 7 | #include <linux/in6.h> | 8 | #include <linux/in6.h> |
| @@ -150,9 +151,7 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
| 150 | struct ceph_mount_args *args = client->mount_args; | 151 | struct ceph_mount_args *args = client->mount_args; |
| 151 | 152 | ||
| 152 | if (args->flags & CEPH_OPT_FSID) | 153 | if (args->flags & CEPH_OPT_FSID) |
| 153 | seq_printf(m, ",fsidmajor=%llu,fsidminor%llu", | 154 | seq_printf(m, ",fsid=" FSID_FORMAT, PR_FSID(&args->fsid)); |
| 154 | le64_to_cpu(*(__le64 *)&args->fsid.fsid[0]), | ||
| 155 | le64_to_cpu(*(__le64 *)&args->fsid.fsid[8])); | ||
| 156 | if (args->flags & CEPH_OPT_NOSHARE) | 155 | if (args->flags & CEPH_OPT_NOSHARE) |
| 157 | seq_puts(m, ",noshare"); | 156 | seq_puts(m, ",noshare"); |
| 158 | if (args->flags & CEPH_OPT_DIRSTAT) | 157 | if (args->flags & CEPH_OPT_DIRSTAT) |
| @@ -322,8 +321,6 @@ const char *ceph_msg_type_name(int type) | |||
| 322 | * mount options | 321 | * mount options |
| 323 | */ | 322 | */ |
| 324 | enum { | 323 | enum { |
| 325 | Opt_fsidmajor, | ||
| 326 | Opt_fsidminor, | ||
| 327 | Opt_wsize, | 324 | Opt_wsize, |
| 328 | Opt_rsize, | 325 | Opt_rsize, |
| 329 | Opt_osdtimeout, | 326 | Opt_osdtimeout, |
| @@ -338,6 +335,7 @@ enum { | |||
| 338 | Opt_congestion_kb, | 335 | Opt_congestion_kb, |
| 339 | Opt_last_int, | 336 | Opt_last_int, |
| 340 | /* int args above */ | 337 | /* int args above */ |
| 338 | Opt_fsid, | ||
| 341 | Opt_snapdirname, | 339 | Opt_snapdirname, |
| 342 | Opt_name, | 340 | Opt_name, |
| 343 | Opt_secret, | 341 | Opt_secret, |
| @@ -354,8 +352,6 @@ enum { | |||
| 354 | }; | 352 | }; |
| 355 | 353 | ||
| 356 | static match_table_t arg_tokens = { | 354 | static match_table_t arg_tokens = { |
| 357 | {Opt_fsidmajor, "fsidmajor=%ld"}, | ||
| 358 | {Opt_fsidminor, "fsidminor=%ld"}, | ||
| 359 | {Opt_wsize, "wsize=%d"}, | 355 | {Opt_wsize, "wsize=%d"}, |
| 360 | {Opt_rsize, "rsize=%d"}, | 356 | {Opt_rsize, "rsize=%d"}, |
| 361 | {Opt_osdtimeout, "osdtimeout=%d"}, | 357 | {Opt_osdtimeout, "osdtimeout=%d"}, |
| @@ -369,6 +365,7 @@ static match_table_t arg_tokens = { | |||
| 369 | {Opt_readdir_max_bytes, "readdir_max_bytes=%d"}, | 365 | {Opt_readdir_max_bytes, "readdir_max_bytes=%d"}, |
| 370 | {Opt_congestion_kb, "write_congestion_kb=%d"}, | 366 | {Opt_congestion_kb, "write_congestion_kb=%d"}, |
| 371 | /* int args above */ | 367 | /* int args above */ |
| 368 | {Opt_fsid, "fsid=%s"}, | ||
| 372 | {Opt_snapdirname, "snapdirname=%s"}, | 369 | {Opt_snapdirname, "snapdirname=%s"}, |
| 373 | {Opt_name, "name=%s"}, | 370 | {Opt_name, "name=%s"}, |
| 374 | {Opt_secret, "secret=%s"}, | 371 | {Opt_secret, "secret=%s"}, |
| @@ -384,6 +381,36 @@ static match_table_t arg_tokens = { | |||
| 384 | {-1, NULL} | 381 | {-1, NULL} |
| 385 | }; | 382 | }; |
| 386 | 383 | ||
| 384 | static int parse_fsid(const char *str, struct ceph_fsid *fsid) | ||
| 385 | { | ||
| 386 | int i = 0; | ||
| 387 | char tmp[3]; | ||
| 388 | int err = -EINVAL; | ||
| 389 | int d; | ||
| 390 | |||
| 391 | dout("parse_fsid '%s'\n", str); | ||
| 392 | tmp[2] = 0; | ||
| 393 | while (*str && i < 16) { | ||
| 394 | if (ispunct(*str)) { | ||
| 395 | str++; | ||
| 396 | continue; | ||
| 397 | } | ||
| 398 | if (!isxdigit(str[0]) || !isxdigit(str[1])) | ||
| 399 | break; | ||
| 400 | tmp[0] = str[0]; | ||
| 401 | tmp[1] = str[1]; | ||
| 402 | if (sscanf(tmp, "%x", &d) < 1) | ||
| 403 | break; | ||
| 404 | fsid->fsid[i] = d & 0xff; | ||
| 405 | i++; | ||
| 406 | str += 2; | ||
| 407 | } | ||
| 408 | |||
| 409 | if (i == 16) | ||
| 410 | err = 0; | ||
| 411 | dout("parse_fsid ret %d got fsid " FSID_FORMAT, err, PR_FSID(fsid)); | ||
| 412 | return err; | ||
| 413 | } | ||
| 387 | 414 | ||
| 388 | static struct ceph_mount_args *parse_mount_args(int flags, char *options, | 415 | static struct ceph_mount_args *parse_mount_args(int flags, char *options, |
| 389 | const char *dev_name, | 416 | const char *dev_name, |
| @@ -467,12 +494,6 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
| 467 | dout("got token %d\n", token); | 494 | dout("got token %d\n", token); |
| 468 | } | 495 | } |
| 469 | switch (token) { | 496 | switch (token) { |
| 470 | case Opt_fsidmajor: | ||
| 471 | *(__le64 *)&args->fsid.fsid[0] = cpu_to_le64(intval); | ||
| 472 | break; | ||
| 473 | case Opt_fsidminor: | ||
| 474 | *(__le64 *)&args->fsid.fsid[8] = cpu_to_le64(intval); | ||
| 475 | break; | ||
| 476 | case Opt_ip: | 497 | case Opt_ip: |
| 477 | err = ceph_parse_ips(argstr[0].from, | 498 | err = ceph_parse_ips(argstr[0].from, |
| 478 | argstr[0].to, | 499 | argstr[0].to, |
| @@ -483,6 +504,11 @@ static struct ceph_mount_args *parse_mount_args(int flags, char *options, | |||
| 483 | args->flags |= CEPH_OPT_MYIP; | 504 | args->flags |= CEPH_OPT_MYIP; |
| 484 | break; | 505 | break; |
| 485 | 506 | ||
| 507 | case Opt_fsid: | ||
| 508 | err = parse_fsid(argstr[0].from, &args->fsid); | ||
| 509 | if (err == 0) | ||
| 510 | args->flags |= CEPH_OPT_FSID; | ||
| 511 | break; | ||
| 486 | case Opt_snapdirname: | 512 | case Opt_snapdirname: |
| 487 | kfree(args->snapdir_name); | 513 | kfree(args->snapdir_name); |
| 488 | args->snapdir_name = kstrndup(argstr[0].from, | 514 | args->snapdir_name = kstrndup(argstr[0].from, |
