summaryrefslogtreecommitdiffstats
path: root/src/objclass (follow)
Commit message (Collapse)AuthorAgeFilesLines
* objclass: add cls_get_osd_min_alloc_size helperMykola Golub2019-06-232-0/+8
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* objclass: add cls_get_min_compatible_client helperMykola Golub2019-06-232-0/+7
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* objclass: add cls_cxx_truncate methodMykola Golub2019-06-232-0/+11
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* src/: define ceph_release_t and use itKefu Chai2019-05-042-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | we have following pains when it comes to ceph release related programming: * we use int, uint8_t, uint32_t, unsigned int for representing the ceph release, i.e., jewel, luminous, nautilus, in different places in our source tree. * we always need to add a comment aside of `uint8_t release` to help the folks to understand that it is CEPH_RELEASE_*. * also we keep forgetting that "os << release" actually prints the release as an ASCII. * and it's painful to remember that we have to translate the release number using `ceph_release_name()` before print it out in the human readable format. * we replicate the n+2 upgrade policy in multiple places in this change, `ceph_release_t` and some helper functions are intruduced to alleviate the pains above. * add a scoped enum for representing ceph releases, so the release is typed . which means that we can attach different function to it. and in future, we can even replace `ceph_release_t` with a class if we need to support more fancy features which cannot be implemented using free functions. * add `ostream<<()` operator for `ceph_release_t`, so we can simply send it to `ostream` * add `can_upgrade_from()` so we don't need to repeat ourselves. * move ceph_release_from_name() to ceph_release.{h,cc}, as currently, ceph_release.cc uses `ceph_release_name()` for implementing `ostream<<()`, and after this change, `ceph_release_from_name()` will return `ceph_release_t`, so if we keep `ceph_release_from_name()` where it was, these two headers will be included by each other, which is a no-go. * reimplement `ceph_release_from_name()` using a loop. before this change, `ceph_release_from_name()` was implemented using a manually unrolled if-else structure, which is more performant, but the downside is that, it replicates mapping between release number and its name. so after this change, a loop is used instead. as this function is not used in the critical path, so this change should not have visible impact on the performance. * always use ceph_release_t::unknown as the default value of the "release" member variables. before this change, sometimes, we use "0" and sometimes we use "1", after inspecting the code, i found that "0" is good enough to cover all the use cases. and since "0" is a magic number in this context, it is replaced using `ceph_release_t::unknown`. to facilidate the checking against `ceph_release_t::unknown`, `operator!()` is added. * ceph::to_string() and ceph::to_integer<>() are added to help to remove the asssumption of the underlying type of `ceph_release_t`, ideally, users of `ceph_release_t` should not use `static_cast<>` to cast it into integer types, instead, they should use `ceph::to_integer<>()` to do this job. if, in future, we want to use a `class` to represent `ceph_release_t`, we can get this done with minimum change, if `ceph::to_string()` and `ceph::to_string()` are used. we can not specialize them in `std` naming space. as it's claimed that it's undefined behavior to do so. see https://en.cppreference.com/w/cpp/language/extending_std . Signed-off-by: Kefu Chai <kchai@redhat.com>
* objclass: Update objclass.h to work without using namespaceAdam C. Emerson2019-03-291-25/+26
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* objclass: fix cls_get_snapset_seq for cache tier caseMykola Golub2019-02-191-1/+2
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* src/cls/cas: add has_chunk opmyoungwon oh2019-01-262-0/+17
| | | | Signed-off-by: Myoungwon Oh <omwmw@sk.com>
* objclass: expose the required OSD release settingJason Dillaman2018-09-192-0/+7
| | | | | | | This can be utilized to determine when it's safe to enable new cls features. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* osd: decrement old chunk's reference count if the chunk has a reference.myoungwon oh2018-09-071-1/+1
| | | | Signed-off-by: Myoungwon Oh <omwmw@sk.com>
* osd: using fingerprint OID if fingerprint is setmyoungwon oh2018-09-072-0/+29
| | | | | | | | cas class is introduced(cas class includes a write_or_get op) This operation increase the reference count if the chunk is already stored. Signed-off-by: Myoungwon Oh <omwmw@sk.com>
* cls/rbd: add assert_snapc_seq methodMykola Golub2018-08-152-0/+11
| | | | Signed-off-by: Mykola Golub <mgolub@suse.com>
* core: use const_iterator for decodeKefu Chai2018-05-172-9/+9
| | | | Signed-off-by: Kefu Chai <kchai@redhat.com>
* objclass-sdk: expose __cls_init() to the worldKefu Chai2018-04-211-6/+0
| | | | | | | the __cls_init() function should be visible. otherwise we cannot call it to register the cls methods Signed-off-by: Kefu Chai <kchai@redhat.com>
* core: resurrect the old check on dout's levels where possible.Radoslaw Zarzynski2018-02-271-1/+1
| | | | Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
* objclass: Use unqualified encode/decodeAdam C. Emerson2018-01-101-25/+25
| | | | | | | This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* osd: add processed_subop_count for cls_cxx_subop_version()Casey Bodley2017-10-301-1/+1
| | | | | | | | | | | | | | | | | | | cls_log_add() relies on cls_cxx_subop_version() to generate unique keys for log entries with the same timestamp. because cls calls back into do_osd_ops(), resetting current_osd_subop_num means that cls_log_add() will keep seeing the same subop version and generating the same keys. this causes the following failure in ceph_test_cls_log: [ RUN ] cls_rgw.test_log_add_same_time /home/cbodley/ceph/src/test/cls_log/test_cls_log.cc:144: Failure Expected: 10 To be equal to: (int)entries.size() Which is: 1 [ FAILED ] cls_rgw.test_log_add_same_time (1180 ms) Fixes: http://tracker.ceph.com/issues/21964 Signed-off-by: Casey Bodley <cbodley@redhat.com>
* cls: remove error handling for get_random_bytesCasey Bodley2017-10-091-1/+2
| | | | Signed-off-by: Casey Bodley <cbodley@redhat.com>
* osd/PG: add get_last_user_version()Sage Weil2017-10-061-1/+1
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* Merge pull request #16648 from ovh/bp-kill-str-convSage Weil2017-08-101-6/+6
|\ | | | | | | | | | | osdc, class_api: kill implicit string conversions Reviewed-by: Gregory Farnum <gfarnum@redhat.com>
| * class_api.cc: kill implicit string conversionPiotr Dałek2017-07-281-6/+6
| | | | | | | | | | | | This gets rid of implicit c-string to std::string conversions, as they are expensive and unnecessary anyway. Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
* | objclass: add 'more' param to omap listingYehuda Sadeh2017-07-292-6/+14
|/ | | | Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
* objclass-sdk: create SDK for Ceph object classesNeha Ojha2017-04-271-53/+1
| | | | | | | | Creates an installable version of "src/include/rados/objclass.h" that allows object classes to be built outside of the Ceph tree. cls_sdk is an example of such an object class. Signed-off-by: Neha Ojha <nojha@redhat.com>
* objclass: Utterly destroy g_ceph_contextAdam C. Emerson2016-12-221-6/+5
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* osd: Remove g_conf and g_ceph_contextAdam C. Emerson2016-12-221-0/+1
| | | | | | So begins the ruthless annihilation of g_ceph_context. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* dout: Use dout_contextAdam C. Emerson2016-12-221-0/+1
| | | | | | | As a transition for g_ceph_context removal, make all dout macros depends on a local macro. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* src: rename ReplicatedPG to PrimaryLogPGSamuel Just2016-12-141-33/+33
| | | | | | | | It's been confusing for a long time that EC pools are implemented by ReplicatedPG. What PG/ReplicatedPG really implement is the concept of a PG where consistency is managed by the primary via a log. Signed-off-by: Samuel Just <sjust@redhat.com>
* embedded: Add RADOS classes to embedded cephd libraryBassam Tabbara2016-11-291-0/+15
| | | | | | | | | | | | | | | | | | | RADOS classes can now be statically compiled and added to the embedded cephd library. The RADOS ClassHandler now has an option to skip calling dlclose just like PluginRegistry. All RADOS classes where changed to use a CLS_INIT macro that will either use __cls_init or classname_cls_init. this enables the static compiling of all RADOS classes in a single library. Also global method definitions where moved to inside cls_init. Also added a few aconfig defines including WITH_EMBEDDED, WITH_CEPHFS, WITH_RBD, and WITH_KVS. Note that WITH_RBD was not defined before and the ceph-dencoder was broken when it was turned on. Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
* objclass: expose client features to cls opsSage Weil2016-10-182-0/+7
| | | | Signed-off-by: Sage Weil <sage@redhat.com>
* rgw: remove unused variablesYan Jun2016-08-051-3/+0
| | | | | | remove the unused bufferlist variables Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
* objclass: add cls_get_featuresSage Weil2016-05-312-0/+7
| | | | | | Expose cls methods to the current OSDMap features set. Signed-off-by: Sage Weil <sage@redhat.com>
* Merge pull request #8550 from xiexingguo/xxg-wip-clsSage Weil2016-05-041-3/+6
|\ | | | | | | | | objclass: honour do_osd_ops() results before going any further Reviewed-by: Sage Weil <sage@redhat.com>
| * objclass: honour do_osd_ops() results before going any furtherxie xingguo2016-04-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This is because: 1. all the other methods are doing the same. 2. the origin results of do_osd_ops() may get overwritten by -ENOMEM, which is misleading. 3. if the class methods return negative results, normally it's not the responsibility for the caller being in charge of freeing out buffers. Therefore this change saves our some efforts and avoids potential memory leaks(Though I doubt this shall happen). Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
* | objclass: add method to list watchersMykola Golub2016-04-262-0/+28
|/ | | | Signed-off-by: Mykola Golub <mgolub@mirantis.com>
* objclass: add cls_cxx_read2/cls_cxx_write2Jason Dillaman2016-03-312-0/+18
| | | | | | These new methods support passing op flags (e.g. cache hints). Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* objclass: add cls_cxx_stat2()Yehuda Sadeh2016-03-052-0/+27
| | | | | | allows retrieving high definition mtime Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
* cls: new force-promotion flag for class methodsJason Dillaman2015-10-091-3/+4
| | | | | | | | | | Class methods that use the cls_get_request_origin should not be proxied to a base tier -- otherwise the origin will reflect the cache tier instead of the client. Fixes: #13380 Signed-off-by: Jason Dillaman <dillaman@redhat.com>
* osd: separate filter init from constructionJohn Spray2015-08-271-3/+8
| | | | | | | | ...so that implementations can readily handle decode errors in client args and return an error code. Signed-off-by: John Spray <john.spray@redhat.com>
* objclass: enable unregistering filter factoryJohn Spray2015-08-272-5/+19
| | | | Signed-off-by: John Spray <john.spray@redhat.com>
* osd: expose PGLSFilter in objclass interfaceJohn Spray2015-08-262-0/+41
| | | | Signed-off-by: John Spray <john.spray@redhat.com>
* objclass/class_api.cc: fix buffer out-of-bounds accessDanny Al-Gaaf2015-07-171-1/+1
| | | | | | | | | | | | | Fix for: CID 1297864 (#1 of 1): Out-of-bounds access (OVERRUN) overrun-buffer-arg: Overrunning array buf of 25 bytes by passing it to a function which accesses it at byte offset 25 using argument 25. cls_gen_rand_base64(): index_parm: Pointer dest is directly accessed by indexing it with size. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
* src/: add CEPH_OSD_OP_READ_SYNCSamuel Just2014-01-221-2/+2
| | | | | | | EC pools won't support SYNC reads. This means that TMAP and friends along with reads from an object class will not be supported. Signed-off-by: Samuel Just <sam.just@inktank.com>
* osd: use TrackedOp::get_req() instead of direct access to the request.Greg Farnum2013-09-201-1/+1
| | | | Signed-off-by: Greg Farnum <greg@inktank.com>
* osd: provide better version bounds for cls_current_version and ENOENT repliesGreg Farnum2013-09-031-1/+1
| | | | | | | | | | | | | | | | Following the changes to when we set or increase the user_version, we want to continue to return the best lower bound we can on the version of any newly-created object. For ENOENT replies that means returning info.last_user_version instead of the (potentially-zero) ctx->user_at_version. Similarly, for cls_current_version we want to return the last version on the PG rather than the last update to the object in order to provide sensible version ordering across object deletes and creates. Update the versions doc so it continues to be precise. Signed-off-by: Greg Farnum <greg@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
* ReplicatedPG: add OpContext::user_at_versionGreg Farnum2013-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | Set this up with the existing at_version member, but only increase it for user_modify ops. Use this when logging the PG's user_version. In order to maintain compatibility with old clients on classic pools, we force user_version to follow at_version whenever it's updated. Now that we have and are maintaining this PG user version, use it for the user version on ops that get ENOENT back, when short-circuiting replies as part of reply_op_error()[1], or when replying to repops in eval_repop; further use it for the cls_current_version() function. This is a small semantic change for that function, as previously it would generally return the same value as the user would get sent back via MOSDOpReply -- but I don't think it was something you could count on. We now define it as being the user version of the PG at the start of the op, and as a bonus it is defined even for read ops (the at_version is only filled in on write operations). [1]: We tweak PGLog to make it easier to retrieve both user and PG versions. Signed-off-by: Greg Farnum <greg@inktank.com>
* objclass: move cls_log into class_api.ccSage Weil2013-08-172-33/+21
| | | | | | | | | | | | Not sure why but this seems to resolve a linking problem when loading classes: 2013-08-17 13:28:19.015776 7fb2bcffa700 0 _load_class could not open class /usr/lib/rados-classes/libcls_hello.so (dlopen failed): /usr/lib/rados-classes/libcls_hello.so: undefined symbol: cls_log 2013-08-17 13:28:19.015786 7fb2bcffa700 -1 osd.4 12 class hello open got (5) Input/output error In any case, it's simpler. Signed-off-by: Sage Weil <sage@inktank.com>
* Merge remote-tracking branch 'origin/master' into wip-rgw-geoYehuda Sadeh2013-07-041-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/Makefile.am src/include/rados/librados.hpp src/rgw/rgw_admin.cc src/rgw/rgw_bucket.cc src/rgw/rgw_common.cc src/rgw/rgw_common.h src/rgw/rgw_json_enc.cc src/rgw/rgw_main.cc src/rgw/rgw_op.h src/rgw/rgw_rados.cc src/rgw/rgw_tools.cc src/rgw/rgw_user.cc src/rgw/rgw_user.h Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
| * objclass/class_debug.cc: reduce scope of 'n' in cls_log()Danny Al-Gaaf2013-05-161-2/+2
| | | | | | | | Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
* | objclass: provide new api for unique subop versioningYehuda Sadeh2013-05-082-0/+34
| | | | | | | | | | | | | | | | | | | | We need to be able to generate a unique identifier for each subop. This can be useful e.g., if we want to keep multiple omap data entries indexed by the same key. The unique id is being generated by the current object id and the current osd subop count. For write operations it's unique. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
* | cls_version: create a new objclassYehuda Sadeh2013-05-082-0/+37
|/ | | | | | New objclass to track and modify objects versions. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
* Validate format strings for CLS_ERR/CLS_LOGDan Mick2013-01-311-1/+2
| | | | | | | | | | | cls_log needed __attribute__((format(printf..)) to allow the compiler to crosscheck format strings and arguments. After adding that, there needed to be a bunch of fixups for %ll, and a few changes for missing arguments, etc. uncovered by the checking. Fixes: #3970 Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>