Skip to content

Commit 2c3f3dc

Browse files
author
Al Viro
committed
switch rbd and libceph to p_log-based primitives
Signed-off-by: Al Viro <[email protected]>
1 parent 3fbb8d5 commit 2c3f3dc

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

drivers/block/rbd.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6363,10 +6363,9 @@ static int rbd_parse_param(struct fs_parameter *param,
63636363
token = fs_parse(NULL, &rbd_parameters, param, &result);
63646364
dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
63656365
if (token < 0) {
6366-
if (token == -ENOPARAM) {
6367-
return invalf(NULL, "rbd: Unknown parameter '%s'",
6368-
param->key);
6369-
}
6366+
if (token == -ENOPARAM)
6367+
return inval_plog(&log, "Unknown parameter '%s'",
6368+
param->key);
63706369
return token;
63716370
}
63726371

@@ -6379,9 +6378,8 @@ static int rbd_parse_param(struct fs_parameter *param,
63796378
case Opt_alloc_size:
63806379
if (result.uint_32 < SECTOR_SIZE)
63816380
goto out_of_range;
6382-
if (!is_power_of_2(result.uint_32)) {
6383-
return invalf(NULL, "rbd: alloc_size must be a power of 2");
6384-
}
6381+
if (!is_power_of_2(result.uint_32))
6382+
return inval_plog(&log, "alloc_size must be a power of 2");
63856383
opt->alloc_size = result.uint_32;
63866384
break;
63876385
case Opt_lock_timeout:
@@ -6417,7 +6415,7 @@ static int rbd_parse_param(struct fs_parameter *param,
64176415
return 0;
64186416

64196417
out_of_range:
6420-
return invalf(NULL, "rbd: %s out of range", param->key);
6418+
return inval_plog(&log, "%s out of range", param->key);
64216419
}
64226420

64236421
/*

net/ceph/ceph_common.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(ceph_destroy_options);
337337

338338
/* get secret from key store */
339339
static int get_secret(struct ceph_crypto_key *dst, const char *name,
340-
struct fs_context *fc)
340+
struct p_log *log)
341341
{
342342
struct key *ukey;
343343
int key_err;
@@ -351,19 +351,19 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name,
351351
key_err = PTR_ERR(ukey);
352352
switch (key_err) {
353353
case -ENOKEY:
354-
errorf(fc, "libceph: Failed due to key not found: %s",
354+
error_plog(log, "Failed due to key not found: %s",
355355
name);
356356
break;
357357
case -EKEYEXPIRED:
358-
errorf(fc, "libceph: Failed due to expired key: %s",
358+
error_plog(log, "Failed due to expired key: %s",
359359
name);
360360
break;
361361
case -EKEYREVOKED:
362-
errorf(fc, "libceph: Failed due to revoked key: %s",
362+
error_plog(log, "Failed due to revoked key: %s",
363363
name);
364364
break;
365365
default:
366-
errorf(fc, "libceph: Failed due to key error %d: %s",
366+
error_plog(log, "Failed due to key error %d: %s",
367367
key_err, name);
368368
}
369369
err = -EPERM;
@@ -385,13 +385,14 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name,
385385
int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
386386
struct fs_context *fc)
387387
{
388+
struct p_log log = {.prefix = "libceph", .log = fc ? fc->log : NULL};
388389
int ret;
389390

390391
/* ip1[:port1][,ip2[:port2]...] */
391392
ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON,
392393
&opt->num_mon);
393394
if (ret) {
394-
errorf(fc, "libceph: Failed to parse monitor IPs: %d", ret);
395+
error_plog(&log, "Failed to parse monitor IPs: %d", ret);
395396
return ret;
396397
}
397398

@@ -404,6 +405,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
404405
{
405406
struct fs_parse_result result;
406407
int token, err;
408+
struct p_log log = {.prefix = "libceph", .log = fc ? fc->log : NULL};
407409

408410
token = fs_parse(fc, &ceph_parameters, param, &result);
409411
dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
@@ -417,7 +419,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
417419
&opt->my_addr,
418420
1, NULL);
419421
if (err) {
420-
errorf(fc, "libceph: Failed to parse ip: %d", err);
422+
error_plog(&log, "Failed to parse ip: %d", err);
421423
return err;
422424
}
423425
opt->flags |= CEPH_OPT_MYIP;
@@ -426,7 +428,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
426428
case Opt_fsid:
427429
err = parse_fsid(param->string, &opt->fsid);
428430
if (err) {
429-
errorf(fc, "libceph: Failed to parse fsid: %d", err);
431+
error_plog(&log, "Failed to parse fsid: %d", err);
430432
return err;
431433
}
432434
opt->flags |= CEPH_OPT_FSID;
@@ -445,7 +447,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
445447
return -ENOMEM;
446448
err = ceph_crypto_key_unarmor(opt->key, param->string);
447449
if (err) {
448-
errorf(fc, "libceph: Failed to parse secret: %d", err);
450+
error_plog(&log, "Failed to parse secret: %d", err);
449451
return err;
450452
}
451453
break;
@@ -456,10 +458,10 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
456458
opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
457459
if (!opt->key)
458460
return -ENOMEM;
459-
return get_secret(opt->key, param->string, fc);
461+
return get_secret(opt->key, param->string, &log);
460462

461463
case Opt_osdtimeout:
462-
warnf(fc, "libceph: Ignoring osdtimeout");
464+
warn_plog(&log, "Ignoring osdtimeout");
463465
break;
464466
case Opt_osdkeepalivetimeout:
465467
/* 0 isn't well defined right now, reject it */
@@ -530,7 +532,7 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
530532
return 0;
531533

532534
out_of_range:
533-
return invalf(fc, "libceph: %s out of range", param->key);
535+
return inval_plog(&log, "%s out of range", param->key);
534536
}
535537
EXPORT_SYMBOL(ceph_parse_param);
536538

0 commit comments

Comments
 (0)