]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: load striping information when opening image
authorSage Weil <sage@inktank.com>
Fri, 5 Oct 2012 23:57:16 +0000 (16:57 -0700)
committerSage Weil <sage@inktank.com>
Mon, 15 Oct 2012 22:34:02 +0000 (15:34 -0700)
Silently tolerate an -ENOEXEC or -EINVAL (which means striping is not
present or is not supported by the osd class).

Signed-off-by: Sage Weil <sage@inktank.com>
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h

index 52fd126d0b5bd69da678149b82c4c3c03d27ffd6..41e07352910d13579e30c0153b60c173b7210fb1 100644 (file)
@@ -46,6 +46,7 @@ namespace librbd {
       refresh_lock("librbd::ImageCtx::refresh_lock"),
       old_format(true),
       order(0), size(0), features(0),  id(image_id), parent(NULL),
+      stripe_unit(0), stripe_count(0),
       object_cacher(NULL), writeback_handler(NULL), object_set(NULL)
   {
     md_ctx.dup(p);
@@ -123,6 +124,14 @@ namespace librbd {
                   << cpp_strerror(r) << dendl;
        return r;
       }
+
+      r = cls_client::get_stripe_unit_count(&md_ctx, header_oid,
+                                           &stripe_unit, &stripe_count);
+      if (r < 0 && r != -ENOEXEC && r != -EINVAL) {
+       lderr(cct) << "error reading striping metadata: "
+                  << cpp_strerror(r) << dendl;
+       return r;
+      }
     } else {
       header_oid = old_header_name(name);
     }
index 649bfc5fd41f60f4bb6c1986e188ddb11673980d..58891bdb05904a772853449d1c244d2259c95260 100644 (file)
@@ -76,6 +76,7 @@ namespace librbd {
     std::string id; // only used for new-format images
     parent_info parent_md;
     ImageCtx *parent;
+    uint64_t stripe_unit, stripe_count;
 
     ObjectCacher *object_cacher;
     LibrbdWriteback *writeback_handler;