From 496c38ff33285af67729f615c7edb9a2ca5367bd Mon Sep 17 00:00:00 2001 From: mxdInspur Date: Sat, 31 Aug 2019 15:33:38 +0800 Subject: [PATCH] librbd: adjust the logic of validate_striping Signed-off-by: mxdInspur --- src/librbd/image/CreateRequest.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/librbd/image/CreateRequest.cc b/src/librbd/image/CreateRequest.cc index 686e7639474..44428868ad5 100644 --- a/src/librbd/image/CreateRequest.cc +++ b/src/librbd/image/CreateRequest.cc @@ -71,11 +71,9 @@ int validate_striping(CephContext *cct, uint8_t order, uint64_t stripe_unit, lderr(cct) << "must specify both (or neither) of stripe-unit and " << "stripe-count" << dendl; return -EINVAL; - } else if (stripe_unit || stripe_count) { - if ((1ull << order) % stripe_unit || stripe_unit > (1ull << order)) { - lderr(cct) << "stripe unit is not a factor of the object size" << dendl; - return -EINVAL; - } + } else if (stripe_unit && ((1ull << order) % stripe_unit || stripe_unit > (1ull << order))) { + lderr(cct) << "stripe unit is not a factor of the object size" << dendl; + return -EINVAL; } return 0; } -- 2.39.5