diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-03-14 13:04:00 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-03-24 10:04:36 -0400 |
commit | 3389bb8bf76180eecaffdfa7dd5b35fa4a2ce9b5 (patch) | |
tree | df274847cbd18b73bf45dde17dd17dd6a1e18a9b /drivers | |
parent | 4dae76705fc8f9854bb732f9944e7ff9ba7a8e9f (diff) |
xen/blkback: Make optional features be really optional.
They were using the xenbus_dev_fatal() function which would
change the state of the connection immediately. Which is not
what we want when we advertise optional features.
So make 'feature-discard','feature-barrier','feature-flush-cache'
optional.
Suggested-by: Jan Beulich <JBeulich@suse.com>
[v1: Made the discard function void and static]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index d417c13e027e..89860f34a7ec 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -381,12 +381,12 @@ int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, | |||
381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", | 381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", |
382 | "%d", state); | 382 | "%d", state); |
383 | if (err) | 383 | if (err) |
384 | xenbus_dev_fatal(dev, err, "writing feature-flush-cache"); | 384 | dev_warn(&dev->dev, "writing feature-flush-cache (%d)", err); |
385 | 385 | ||
386 | return err; | 386 | return err; |
387 | } | 387 | } |
388 | 388 | ||
389 | int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | 389 | static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) |
390 | { | 390 | { |
391 | struct xenbus_device *dev = be->dev; | 391 | struct xenbus_device *dev = be->dev; |
392 | struct xen_blkif *blkif = be->blkif; | 392 | struct xen_blkif *blkif = be->blkif; |
@@ -400,17 +400,15 @@ int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | |||
400 | "discard-granularity", "%u", | 400 | "discard-granularity", "%u", |
401 | q->limits.discard_granularity); | 401 | q->limits.discard_granularity); |
402 | if (err) { | 402 | if (err) { |
403 | xenbus_dev_fatal(dev, err, | 403 | dev_warn(&dev->dev, "writing discard-granularity (%d)", err); |
404 | "writing discard-granularity"); | 404 | return; |
405 | goto out; | ||
406 | } | 405 | } |
407 | err = xenbus_printf(xbt, dev->nodename, | 406 | err = xenbus_printf(xbt, dev->nodename, |
408 | "discard-alignment", "%u", | 407 | "discard-alignment", "%u", |
409 | q->limits.discard_alignment); | 408 | q->limits.discard_alignment); |
410 | if (err) { | 409 | if (err) { |
411 | xenbus_dev_fatal(dev, err, | 410 | dev_warn(&dev->dev, "writing discard-alignment (%d)", err); |
412 | "writing discard-alignment"); | 411 | return; |
413 | goto out; | ||
414 | } | 412 | } |
415 | state = 1; | 413 | state = 1; |
416 | /* Optional. */ | 414 | /* Optional. */ |
@@ -418,17 +416,14 @@ int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | |||
418 | "discard-secure", "%d", | 416 | "discard-secure", "%d", |
419 | blkif->vbd.discard_secure); | 417 | blkif->vbd.discard_secure); |
420 | if (err) { | 418 | if (err) { |
421 | xenbus_dev_fatal(dev, err, | 419 | dev_warn(dev-dev, "writing discard-secure (%d)", err); |
422 | "writting discard-secure"); | 420 | return; |
423 | goto out; | ||
424 | } | 421 | } |
425 | } | 422 | } |
426 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", | 423 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", |
427 | "%d", state); | 424 | "%d", state); |
428 | if (err) | 425 | if (err) |
429 | xenbus_dev_fatal(dev, err, "writing feature-discard"); | 426 | dev_warn(&dev->dev, "writing feature-discard (%d)", err); |
430 | out: | ||
431 | return err; | ||
432 | } | 427 | } |
433 | int xen_blkbk_barrier(struct xenbus_transaction xbt, | 428 | int xen_blkbk_barrier(struct xenbus_transaction xbt, |
434 | struct backend_info *be, int state) | 429 | struct backend_info *be, int state) |
@@ -439,7 +434,7 @@ int xen_blkbk_barrier(struct xenbus_transaction xbt, | |||
439 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", | 434 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", |
440 | "%d", state); | 435 | "%d", state); |
441 | if (err) | 436 | if (err) |
442 | xenbus_dev_fatal(dev, err, "writing feature-barrier"); | 437 | dev_warn(&dev->dev, "writing feature-barrier (%d)", err); |
443 | 438 | ||
444 | return err; | 439 | return err; |
445 | } | 440 | } |
@@ -671,14 +666,12 @@ again: | |||
671 | return; | 666 | return; |
672 | } | 667 | } |
673 | 668 | ||
674 | err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); | 669 | /* If we can't advertise it is OK. */ |
675 | if (err) | 670 | xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); |
676 | goto abort; | ||
677 | 671 | ||
678 | err = xen_blkbk_discard(xbt, be); | 672 | xen_blkbk_discard(xbt, be); |
679 | 673 | ||
680 | /* If we can't advertise it is OK. */ | 674 | xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); |
681 | err = xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); | ||
682 | 675 | ||
683 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", | 676 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", |
684 | (unsigned long long)vbd_sz(&be->blkif->vbd)); | 677 | (unsigned long long)vbd_sz(&be->blkif->vbd)); |