From: Sage Weil Date: Tue, 23 Dec 2008 20:29:04 +0000 (-0800) Subject: os: start_sync osd operation X-Git-Tag: v0.6~6^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1419f0021827f374abf449ae68e4fd6fda421cd0;p=ceph.git os: start_sync osd operation If a client has a time sensitive operation, it can include a start_sync in the op vector to start an immediate commit to disk. It should then get the ONDISK ack sooner. --- diff --git a/src/ebofs/Ebofs.cc b/src/ebofs/Ebofs.cc index da753a710a9f..17d34f34aa2a 100644 --- a/src/ebofs/Ebofs.cc +++ b/src/ebofs/Ebofs.cc @@ -2493,6 +2493,11 @@ unsigned Ebofs::_apply_transaction(Transaction& t) int op = t.get_op(); switch (op) { + case Transaction::OP_STARTSYNC: + dirty = true; + commit_cond.Signal(); + break; + case Transaction::OP_TOUCH: { coll_t cid = t.get_cid(); diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index e2190f6e2a8f..ed9684575407 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -1112,6 +1112,7 @@ enum { /* fancy write */ CEPH_OSD_OP_APPEND = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 6, + CEPH_OSD_OP_STARTSYNC = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 7, }; static inline int ceph_osd_op_type_lock(int op) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index bdc3a850f25b..c5e46e710056 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -694,6 +694,10 @@ unsigned FileStore::_apply_transaction(Transaction& t) _collection_rmattr(t.get_cid(), t.get_attrname()); break; + case Transaction::OP_STARTSYNC: + _start_sync(); + break; + default: cerr << "bad op " << op << std::endl; assert(0); @@ -1431,6 +1435,12 @@ void FileStore::sync_entry() lock.Unlock(); } +void FileStore::_start_sync() +{ + dout(10) << "start_sync" << dendl; + sync_cond.Signal(); +} + void FileStore::sync() { Mutex::Locker l(lock); diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 9f6fabc13690..69ede33204bc 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -115,6 +115,8 @@ class FileStore : public JournalingObjectStore { int _do_clone_range(int from, int to, __u64 off, __u64 len); int _remove(coll_t cid, pobject_t oid); + void _start_sync(); + void sync(); void sync(Context *onsafe); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 3877d50aec2e..ac077d449fda 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -98,6 +98,9 @@ public: static const int OP_COLL_RMATTR = 25; // cid, attrname static const int OP_COLL_SETATTRS = 26; // cid, attrset + static const int OP_STARTSYNC = 27; // start a sync + + private: /* int len; @@ -158,6 +161,10 @@ public: return attrsets[attrsetp++]; } + void start_sync() { + int op = OP_STARTSYNC; + ops.push_back(op); + } void touch(coll_t cid, pobject_t oid) { int op = OP_TOUCH; ops.push_back(op); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 46f519f2156d..dbb4777dc391 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1131,6 +1131,9 @@ int ReplicatedPG::prepare_simple_op(ObjectStore::Transaction& t, osd_reqid_t req } break; + case CEPH_OSD_OP_STARTSYNC: + t.start_sync(); + break; default: return -EINVAL;