]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: propagate dirent flags to rgw (from cls), other fixes
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 26 Sep 2014 16:48:17 +0000 (09:48 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 16 Jan 2015 22:36:26 +0000 (14:36 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw.cc
src/cls/rgw/cls_rgw_types.h
src/rgw/rgw_admin.cc
src/rgw/rgw_common.h
src/rgw/rgw_json_enc.cc
src/rgw/rgw_rados.cc

index 1a838901e15889530ff283fc0b139a45a1399a26..61944d48ca37d265661dbdeac52cbe04d5727dd7 100644 (file)
@@ -450,7 +450,7 @@ int rgw_bucket_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
     uint64_t ver;
     decode_list_index_key(kiter->first, &key, &ver);
 
-    if (!op.list_versions && (!entry.is_current() || !entry.exists)) {
+    if (!op.list_versions && !entry.is_visible()) {
       continue;
     }
     m[key] = entry;
index b0c0dee5935208e21e268ffda7dfb99984a48ae0..80cf95cf0adddc4b6db2ff2e87e14266bb05e0b0 100644 (file)
@@ -304,7 +304,15 @@ struct rgw_bucket_dir_entry {
     DECODE_FINISH(bl);
   }
 
-  bool is_current() { return (flags & RGW_BUCKET_DIRENT_FLAG_CURRENT) != 0; }
+  bool is_current() {
+    int test_flags = RGW_BUCKET_DIRENT_FLAG_VER | RGW_BUCKET_DIRENT_FLAG_CURRENT;
+    return (flags & RGW_BUCKET_DIRENT_FLAG_VER) == 0 ||
+           (flags & test_flags) == test_flags;
+  }
+  bool is_delete_marker() { return (flags & RGW_BUCKET_DIRENT_FLAG_DELETE_MARKER) != 0; }
+  bool is_visible() {
+    return is_current() && !is_delete_marker();
+  }
 
   void dump(Formatter *f) const;
   static void generate_test_instances(list<rgw_bucket_dir_entry*>& o);
index e34d1a12fd78c6c90c12b3a40dca34dc64edc6a4..aac7dec6020823bd0828be2fec721653c4d082a9 100644 (file)
@@ -2089,6 +2089,7 @@ next:
             }
           }
         }
+        formatter->dump_int("flags", entry.flags);
 
         formatter->close_section();
         formatter->flush(cout);
index 9e275bb350f72f556248088df9194d27ede86a4e..f6c1e17d44e3e740ac39c6cb408bffbba391b103 100644 (file)
@@ -1003,8 +1003,9 @@ struct RGWObjEnt {
   string etag;
   string content_type;
   string tag;
+  uint32_t flags;
 
-  RGWObjEnt() : size(0) {}
+  RGWObjEnt() : size(0), flags(0) {}
 
   void dump(Formatter *f) const;
 };
index b88ae81abbd8f8baefdace34b28216876bd1bfbe..c4d4437481353955aa07ec960ba5c20074565fad 100644 (file)
@@ -577,6 +577,7 @@ void RGWObjEnt::dump(Formatter *f) const
   encode_json("etag", etag, f);
   encode_json("content_type", content_type, f);
   encode_json("tag", tag, f);
+  encode_json("flags", flags, f);
 }
 
 void RGWBucketEnt::dump(Formatter *f) const
index 65855702c0c8654e6efc5912427277465e36bd30..f4221359cfdfd8c4ffa1d9e89d6273acbacef2ce 100644 (file)
@@ -6538,6 +6538,7 @@ int RGWRados::cls_bucket_list(rgw_bucket& bucket, rgw_obj_key& start, const stri
     e.owner_display_name = dirent.meta.owner_display_name;
     e.content_type = dirent.meta.content_type;
     e.tag = dirent.tag;
+    e.flags = dirent.flags;
 
     /* oh, that shouldn't happen! */
     if (e.key.empty()) {