]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PGTransaction: Modify append/write function can handle fadvise flags.
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 25 Nov 2014 06:51:14 +0000 (14:51 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 12 Dec 2014 06:23:35 +0000 (14:23 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/osd/ECTransaction.h
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedPG.cc

index 7b104c7e254f40fe484c3688a32e9fd777dfc778..e0a3afa6b4af53630c17d2962f29335ddf2cf804 100644 (file)
@@ -28,8 +28,9 @@ public:
     hobject_t oid;
     uint64_t off;
     bufferlist bl;
-    AppendOp(const hobject_t &oid, uint64_t off, bufferlist &bl)
-      : oid(oid), off(off), bl(bl) {}
+    uint32_t fadvise_flags;
+    AppendOp(const hobject_t &oid, uint64_t off, bufferlist &bl, uint32_t flags)
+      : oid(oid), off(off), bl(bl), fadvise_flags(flags) {}
   };
   struct CloneOp {
     hobject_t source;
@@ -110,14 +111,15 @@ public:
     const hobject_t &hoid,
     uint64_t off,
     uint64_t len,
-    bufferlist &bl) {
+    bufferlist &bl,
+    uint32_t fadvise_flags) {
     if (len == 0) {
       touch(hoid);
       return;
     }
     written += len;
     assert(len == bl.length());
-    ops.push_back(AppendOp(hoid, off, bl));
+    ops.push_back(AppendOp(hoid, off, bl, fadvise_flags));
   }
   void stash(
     const hobject_t &hoid,
index dea075aeccbd792a505813fce36c130af6c6edec..8b6c397750c2c0f37fa3179649bebf0d5d661933 100644 (file)
        const hobject_t &hoid, ///< [in] object to write
        uint64_t off,          ///< [in] off at which to write
        uint64_t len,          ///< [in] len to write from bl
-       bufferlist &bl         ///< [in] bl to write will be claimed to len
+       bufferlist &bl,        ///< [in] bl to write will be claimed to len
+       uint32_t fadvise_flags = 0 ///< [in] fadvise hint
        ) { assert(0); }
      virtual void omap_setkeys(
        const hobject_t &hoid,         ///< [in] object to write
        const hobject_t &hoid, ///< [in] object to write
        uint64_t off,          ///< [in] off at which to write
        uint64_t len,          ///< [in] len to write from bl
-       bufferlist &bl         ///< [in] bl to write will be claimed to len
-       ) { write(hoid, off, len, bl); }
+       bufferlist &bl,        ///< [in] bl to write will be claimed to len
+       uint32_t fadvise_flags ///< [in] fadvise hint
+       ) { write(hoid, off, len, bl, fadvise_flags); }
 
      /// to_append *must* have come from the same PGBackend (same concrete type)
      virtual void append(
index 97e69dd0c646f2f6634ab3eb192d59c9a9553187..fcf51ed76678ad7645217e2c4650628f45bb3c08 100644 (file)
@@ -321,7 +321,8 @@ public:
     const hobject_t &hoid,
     uint64_t off,
     uint64_t len,
-    bufferlist &bl
+    bufferlist &bl,
+    uint32_t fadvise_flags
     ) {
     written += len;
     t->write(get_coll_ct(hoid), hoid, off, len, bl);
index 8b587c13603bb055c165c26a12f3a186f26f60cc..856fb99cb216dd326c34145999fc847aa98541ef 100644 (file)
@@ -4037,9 +4037,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
        if (result < 0)
          break;
        if (pool.info.require_rollback()) {
-         t->append(soid, op.extent.offset, op.extent.length, osd_op.indata);
+         t->append(soid, op.extent.offset, op.extent.length, osd_op.indata, op.flags);
        } else {
-         t->write(soid, op.extent.offset, op.extent.length, osd_op.indata);
+         t->write(soid, op.extent.offset, op.extent.length, osd_op.indata, op.flags);
        }
        write_update_size_and_usage(ctx->delta_stats, oi, ctx->modified_ranges,
                                    op.extent.offset, op.extent.length, true);
@@ -4072,7 +4072,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
            }
          }
          ctx->mod_desc.create();
-         t->append(soid, op.extent.offset, op.extent.length, osd_op.indata);
+         t->append(soid, op.extent.offset, op.extent.length, osd_op.indata, op.flags);
          if (obs.exists) {
            map<string, bufferlist> to_set = ctx->obc->attr_cache;
            map<string, boost::optional<bufferlist> > &overlay =
@@ -4094,7 +4094,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          if (obs.exists) {
            t->truncate(soid, 0);
          }
-         t->write(soid, op.extent.offset, op.extent.length, osd_op.indata);
+         t->write(soid, op.extent.offset, op.extent.length, osd_op.indata, op.flags);
        }
        if (!obs.exists) {
          ctx->delta_stats.num_objects++;
@@ -6126,7 +6126,8 @@ void ReplicatedPG::_write_copy_chunk(CopyOpRef cop, PGBackend::PGTransaction *t)
       cop->results.temp_oid,
       cop->temp_cursor.data_offset,
       cop->data.length(),
-      cop->data);
+      cop->data,
+      0);
     cop->data.clear();
   }
   if (!pool.info.require_rollback()) {
@@ -11322,7 +11323,7 @@ void ReplicatedPG::hit_set_persist()
   bufferlist boi(sizeof(ctx->new_obs.oi));
   ::encode(ctx->new_obs.oi, boi);
 
-  ctx->op_t->append(oid, 0, bl.length(), bl);
+  ctx->op_t->append(oid, 0, bl.length(), bl, 0);
   setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, OI_ATTR, boi);
   setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, SS_ATTR, bss);
   ctx->log.push_back(