diff options
192 files changed, 6281 insertions, 3627 deletions
diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 6609acbd5a8..e7fcd7201bb 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -1,28 +1,2 @@ -v0.68 +v0.69 ~~~~~ - -* 'ceph osd crush set <id> <weight> <loc..>' no longer adds the osd to the - specified location, as that's a job for 'ceph osd crush add'. It will - however continue to work just the same as long as the osd already exists - in the crush map. - -* The OSD now enforces that class write methods cannot both mutate an - object and return data. The rbd.assign_bid method, the lone - offender, has been removed. This breaks compatibility with - pre-bobtail librbd clients by preventing them from creating new - images. - -* librados now returns on commit instead of ack for synchronous calls. - This is a bit safer in the case where both OSDs and the client crash, and - is probably how it should have been acting from the beginning. Users are - unlikely to notice but it could result in lower performance in some - circumstances. Those who care should switch to using the async interfaces, - which let you specify safety semantics precisely. - -* The C++ librados AioComplete::get_version() method was incorrectly - returning an int (usually 32-bits). To avoid breaking library - compatibility, a get_version64() method is added that returns the - full-width value. The old method is deprecated and will be removed - in a future release. Users of the C++ librados API that make use of - the get_version() method should modify their code to avoid getting a - value that is truncated from 64 to to 32 bits.
\ No newline at end of file diff --git a/admin/doc-requirements.txt b/admin/doc-requirements.txt index b088df083db..ce4654c6600 100644 --- a/admin/doc-requirements.txt +++ b/admin/doc-requirements.txt @@ -1,3 +1,3 @@ -Sphinx >=1.1.2 +Sphinx == 1.1.3 -e git+https://github.com/ceph/sphinx-ditaa.git#egg=sphinx-ditaa -e git+https://github.com/ceph/asphyxiate.git#egg=asphyxiate diff --git a/configure.ac b/configure.ac index cfe9e841e17..d2bf5959881 100644 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,13 @@ AC_DEFUN([AC_CHECK_CC_FLAG], AC_CHECK_CC_FLAG([-Wtype-limits], [WARN_TYPE_LIMITS]) AC_CHECK_CC_FLAG([-Wignored-qualifiers], [WARN_IGNORED_QUALIFIERS]) +# Checks for architecture stuff +AM_CONDITIONAL([ENABLE_FPU_NEON], [case $target_cpu in arm*) true;; *) false;; esac]) + +# Check for compiler VTA support +AX_CHECK_COMPILE_FLAG([-fvar-tracking-assignments], [HAS_VTA_SUPPORT=1], [HAS_VTA_SUPPORT=0]) +AM_CONDITIONAL(COMPILER_HAS_VTA, [test "$HAS_VTA_SUPPORT" = 1]) + # Checks for libraries. ACX_PTHREAD AC_CHECK_LIB([uuid], [uuid_parse], [true], AC_MSG_FAILURE([libuuid not found])) diff --git a/doc/changelog/v0.67.3.txt b/doc/changelog/v0.67.3.txt new file mode 100644 index 00000000000..d6b1f2b2742 --- /dev/null +++ b/doc/changelog/v0.67.3.txt @@ -0,0 +1,700 @@ +commit 408cd61584c72c0d97b774b3d8f95c6b1b06341a +Author: Gary Lowell <gary.lowell@inktank.com> +Date: Mon Sep 9 12:50:11 2013 -0700 + + v0.67.3 + +commit 17a7342b3b935c06610c58ab92a9a1d086923d32 +Merge: b4252bf 10433bb +Author: Sage Weil <sage@inktank.com> +Date: Sat Sep 7 13:34:45 2013 -0700 + + Merge pull request #574 from dalgaaf/fix/da-dumpling-cherry-picks + + init-radosgw*: fix status return value if radosgw isn't running + + Reviewed-by: Sage Weil <sage@inktank.com> + +commit 10433bbe72dbf8eae8fae836e557a043610eb54e +Author: Danny Al-Gaaf <danny.al-gaaf@bisect.de> +Date: Sat Sep 7 11:30:15 2013 +0200 + + init-radosgw*: fix status return value if radosgw isn't running + + Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de> + (cherry picked from commit b5137baf651eaaa9f67e3864509e437f9d5c3d5a) + +commit b4252bff79150a95e9d075dd0b5e146ba9bf2ee5 +Author: Samuel Just <sam.just@inktank.com> +Date: Thu Aug 22 11:19:37 2013 -0700 + + FileStore: add config option to disable the wbthrottle + + Backport: dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + Reviewed-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 3528100a53724e7ae20766344e467bf762a34163) + +commit 699324e0910e5e07a1ac68df8cf1108e5671ec15 +Author: Samuel Just <sam.just@inktank.com> +Date: Thu Aug 22 11:19:52 2013 -0700 + + WBThrottle: use fdatasync instead of fsync + + Backport: dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + Reviewed-by: Sage Weil <sage@inktank.com> + (cherry picked from commit d571825080f0bff1ed3666e95e19b78a738ecfe8) + +commit 074717b4b49ae1a55bc867e5c34d43c51edc84a5 +Author: Samuel Just <sam.just@inktank.com> +Date: Thu Aug 29 15:08:58 2013 -0700 + + PGLog: initialize writeout_from in PGLog constructor + + Fixes: 6151 + Backport: dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + Introduced: f808c205c503f7d32518c91619f249466f84c4cf + Reviewed-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 42d65b0a7057696f4b8094f7c686d467c075a64d) + +commit c22d980cf42e580818dc9f526327518c0ddf8ff5 +Author: Samuel Just <sam.just@inktank.com> +Date: Tue Aug 27 08:49:14 2013 -0700 + + PGLog: maintain writeout_from and trimmed + + This way, we can avoid omap_rmkeyrange in the common append + and trim cases. + + Fixes: #6040 + Backport: Dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + (cherry picked from commit f808c205c503f7d32518c91619f249466f84c4cf) + +commit 53c7ab4db00ec7034f5aa555231f9ee167f43201 +Author: Samuel Just <sam.just@inktank.com> +Date: Tue Aug 27 07:27:26 2013 -0700 + + PGLog: don't maintain log_keys_debug if the config is disabled + + Fixes: #6040 + Backport: Dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + (cherry picked from commit 1c0d75db1075a58d893d30494a5d7280cb308899) + +commit 40dc489351383c2e35b91c3d4e76b633309716df +Author: Samuel Just <sam.just@inktank.com> +Date: Mon Aug 26 23:19:45 2013 -0700 + + PGLog: move the log size check after the early return + + There really are stl implementations (like the one on my ubuntu 12.04 + machine) which have a list::size() which is linear in the size of the + list. That assert, therefore, is quite expensive! + + Fixes: #6040 + Backport: Dumpling + Signed-off-by: Samuel Just <sam.just@inktank.com> + (cherry picked from commit fe68b15a3d82349f8941f5b9f70fcbb5d4bc7f97) + +commit 4261eb5ec105b9c27605360910602dc367fd79f5 +Author: Sage Weil <sage@inktank.com> +Date: Tue Aug 13 17:16:08 2013 -0700 + + rbd.cc: relicense as LGPL2 + + All past authors for rbd.cc have consented to relicensing from GPL to + LGPL2 via email: + + --- + + Date: Sat, 27 Jul 2013 01:59:36 +0200 + From: Sylvain Munaut <s.munaut@whatever-company.com> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I hereby consent to the relicensing of any contribution I made to the + aforementioned rbd.cc file from GPL to LGPL2.1. + + (I hope that'll be impressive enough, I did my best :p) + + btw, tnt@246tNt.com and s.munaut@whatever-company.com are both me. + + Cheers, + + Sylvain + + --- + + Date: Fri, 26 Jul 2013 17:00:48 -0700 + From: Yehuda Sadeh <yehuda@inktank.com> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent. + + --- + + Date: Fri, 26 Jul 2013 17:02:24 -0700 + From: Josh Durgin <josh.durgin@inktank.com> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent. + + --- + + Date: Fri, 26 Jul 2013 18:17:46 -0700 + From: Stanislav Sedov <stas@freebsd.org> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent. + + Thanks for taking care of it! + + --- + + Date: Fri, 26 Jul 2013 18:24:15 -0700 + From: Colin McCabe <cmccabe@alumni.cmu.edu> + + I consent. + + cheers, + Colin + + --- + + Date: Sat, 27 Jul 2013 07:08:12 +0200 + From: Christian Brunner <christian@brunner-muc.de> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent + + Christian + + --- + + Date: Sat, 27 Jul 2013 12:17:34 +0300 + From: Stratos Psomadakis <psomas@grnet.gr> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + Hi, + + I consent with the GPL -> LGL2.1 re-licensing. + + Thanks + Stratos + + --- + + Date: Sat, 27 Jul 2013 16:13:13 +0200 + From: Wido den Hollander <wido@42on.com> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent! + + You have my permission to re-license the code I wrote for rbd.cc to LGPL2.1 + + --- + + Date: Sun, 11 Aug 2013 10:40:32 +0200 + From: Danny Al-Gaaf <danny.al-gaaf@bisect.de> + Subject: Re: btw + + Hi Sage, + + I agree to switch the license of ceph_argparse.py and rbd.cc from GPL2 + to LGPL2. + + Regards + + Danny Al-Gaaf + + --- + + Date: Tue, 13 Aug 2013 17:15:24 -0700 + From: Dan Mick <dan.mick@inktank.com> + Subject: Re: Ceph rbd.cc GPL -> LGPL2 license change + + I consent to relicense any contributed code that I wrote under LGPL2.1 license. + + --- + + ...and I consent too. Drop the exception from COPYING and debian/copyright + files. + + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 2206f55761c675b31078dea4e7dd66f2666d7d03) + +commit 211c5f13131e28b095a1f3b72426128f1db22218 +Author: Yehuda Sadeh <yehuda@inktank.com> +Date: Fri Aug 23 15:39:20 2013 -0700 + + rgw: flush pending data when completing multipart part upload + + Fixes: #6111 + Backport: dumpling + When completing the part upload we need to flush any data that we + aggregated and didn't flush yet. With earlier code didn't have to deal + with it as for multipart upload we didn't have any pending data. + What we do now is we call the regular atomic data completion + function that takes care of it. + + Reviewed-by: Josh Durgin <josh.durgin@inktank.com> + Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> + (cherry picked from commit 9a551296e0811f2b65972377b25bb28dbb42f575) + +commit 1a9651010aab51c9be2edeccd80e9bd11f5177ce +Author: Yehuda Sadeh <yehuda@inktank.com> +Date: Mon Aug 26 19:46:43 2013 -0700 + + rgw: check object name after rebuilding it in S3 POST + + Fixes: #6088 + Backport: bobtail, cuttlefish, dumpling + + When posting an object it is possible to provide a key + name that refers to the original filename, however we + need to verify that in the end we don't end up with an + empty object name. + + Reviewed-by: Josh Durgin <josh.durgin@inktank.com> + Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> + (cherry picked from commit c8ec532fadc0df36e4b265fe20a2ff3e35319744) + +commit 1bd74a020b93f154b2d4129d512f6334387de7c7 +Author: Sage Weil <sage@inktank.com> +Date: Thu Aug 22 17:46:45 2013 -0700 + + mon/MonClient: release pending outgoing messages on shutdown + + This fixes a small memory leak when we have messages queued for the mon + when we shut down. It is harmless except for the valgrind leak check + noise that obscures real leaks. + + Backport: dumpling + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 309569a6d0b7df263654b7f3f15b910a72f2918d) + +commit 24f2669783e2eb9d9af5ecbe106efed93366ba63 +Author: Yehuda Sadeh <yehuda@inktank.com> +Date: Thu Aug 29 13:06:33 2013 -0700 + + rgw: change watch init ordering, don't distribute if can't + + Backport: dumpling + + Moving back the watch initialization after the zone init, + as the zone info holds the control pool name. Since zone + init might need to create a new system object (that needs + to distribute cache), don't try to distribute cache if + watch is not yet initialized. + + Reviewed-by: Sage Weil <sage@inktank.com> + Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> + (cherry picked from commit 1d1f7f18dfbdc46fdb09a96ef973475cd29feef5) + +commit a708c8ab52e5b1476405a1f817c23b8845fbaab3 +Author: Sage Weil <sage@inktank.com> +Date: Fri Aug 30 09:41:29 2013 -0700 + + ceph-post-file: use mktemp instead of tempfile + + tempfile is a debian thing, apparently; mktemp is present everywhere. + + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit e60d4e09e9f11e3c34a05cd122341e06c7c889bb) + +commit 625f13ee0d6cca48d61dfd65e00517d092552d1c +Author: Sage Weil <sage@inktank.com> +Date: Wed Aug 28 09:50:11 2013 -0700 + + mon: discover mon addrs, names during election state too + + Currently we only detect new mon addrs and names during the probing phase. + For non-trivial clusters, this means we can get into a sticky spot when + we discover enough peers to form an quorum, but not all of them, and the + undiscovered ones are enough to break the mon ranks and prevent an + election. + + One way to work around this is to continue addr and name discovery during + the election. We should also consider making the ranks less sensitive to + the undefined addrs; that is a separate change. + + Fixes: #4924 + Backport: dumpling + Signed-off-by: Sage Weil <sage@inktank.com> + Tested-by: Bernhard Glomm <bernhard.glomm@ecologic.eu> + (cherry picked from commit c24028570015cacf1d9e154ffad80bec06a61e7c) + +commit 83cfd4386c1fd0fa41aea345704e27f82b524ece +Author: Dan Mick <dan.mick@inktank.com> +Date: Thu Aug 22 17:30:24 2013 -0700 + + ceph_rest_api.py: create own default for log_file + + common/config thinks the default log_file for non-daemons should be "". + Override that so that the default is + /var/log/ceph/{cluster}-{name}.{pid}.log + since ceph-rest-api is more of a daemon than a client. + + Fixes: #6099 + Backport: dumpling + Signed-off-by: Dan Mick <dan.mick@inktank.com> + (cherry picked from commit 2031f391c3df68e0d9e381a1ef3fe58d8939f0a8) + +commit 8a1da62d9564a32f7b8963fe298e1ac3ad0ea3d9 +Author: Sage Weil <sage@inktank.com> +Date: Fri Aug 16 17:59:11 2013 -0700 + + ceph-post-file: single command to upload a file to cephdrop + + Use sftp to upload to a directory that only this user and ceph devs can + access. + + Distribute an ssh key to connect to the account. This will let us revoke + the key in the future if we feel the need. Also distribute a known_hosts + file so that users have some confidence that they are connecting to the + real ceph drop account and not some third party. + + Signed-off-by: Sage Weil <sage@inktank.com> + Reviewed-by: Dan Mick <dan.mick@inktank.com> + (cherry picked from commit d08e05e463f1f7106a1f719d81b849435790a3b9) + +commit 3f8663477b585dcb528fdd7047c50d9a52d24b95 +Author: Gary Lowell <glowell@inktank.com> +Date: Thu Aug 22 13:29:32 2013 -0700 + + ceph.spec.in: remove trailing paren in previous commit + + Signed-off-by: Gary Lowell <gary.lowell@inktank.com> + +commit 23fb908cb3ac969c874ac12755d20ed2f636e1b9 +Author: Gary Lowell <glowell@inktank.com> +Date: Thu Aug 22 11:07:16 2013 -0700 + + ceph.spec.in: Don't invoke debug_package macro on centos. + + If the redhat-rpm-config package is installed, the debuginfo rpms will + be built by default. The build will fail when the package installed + and the specfile also invokes the macro. + + Signed-off-by: Gary Lowell <gary.lowell@inktank.com> + +commit 11f5853d8178ab60ab948d373c1a1f67324ce3bd +Author: Sage Weil <sage@inktank.com> +Date: Sat Aug 24 14:04:09 2013 -0700 + + osd: install admin socket commands after signals + + This lets us tell by the presence of the admin socket commands whether + a signal will make us shut down cleanly. See #5924. + + Signed-off-by: Sage Weil <sage@inktank.com> + Reviewed-by: Samuel Just <sam.just@inktank.com> + (cherry picked from commit c5b5ce120a8ce9116be52874dbbcc39adec48b5c) + +commit 39adc0195e6016ce36828885515be1bffbc10ae1 +Author: Sage Weil <sage@inktank.com> +Date: Tue Aug 20 22:39:09 2013 -0700 + + ceph-disk: partprobe after creating journal partition + + At least one user reports that a partprobe is needed after creating the + journal partition. It is not clear why sgdisk is not doing it, but this + fixes ceph-disk for them, and should be harmless for other users. + + Fixes: #5599 + Tested-by: lurbs in #ceph + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 2af59d5e81c5e3e3d7cfc50d9330d7364659c5eb) + (cherry picked from commit 3e42df221315679605d68b2875aab6c7eb6b3cc4) + +commit 6a4fe7b9b068ae990d6404921a46631fe9ebcd31 +Author: Sage Weil <sage@inktank.com> +Date: Tue Aug 20 11:27:23 2013 -0700 + + mon/Paxos: always refresh after any store_state + + If we store any new state, we need to refresh the services, even if we + are still in the midst of Paxos recovery. This is because the + subscription path will share any committed state even when paxos is + still recovering. This prevents a race like: + + - we have maps 10..20 + - we drop out of quorum + - we are elected leader, paxos recovery starts + - we get one LAST with committed states that trim maps 10..15 + - we get a subscribe for map 10..20 + - we crash because 10 is no longer on disk because the PaxosService + is out of sync with the on-disk state. + + Fixes: #6045 + Backport: dumpling + Signed-off-by: Sage Weil <sage@inktank.com> + Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> + (cherry picked from commit 981eda9f7787c83dc457f061452685f499e7dd27) + +commit 13d396e46ed9200e4b9f21db2f0a8efbc5998d82 +Author: Sage Weil <sage@inktank.com> +Date: Tue Aug 20 11:27:09 2013 -0700 + + mon/Paxos: return whether store_state stored anything + + Signed-off-by: Sage Weil <sage@inktank.com> + Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> + (cherry picked from commit 7e0848d8f88f156a05eef47a9f730b772b64fbf2) + +commit f248383bacff76203fa94716cfdf6cf766da24a7 +Author: Sage Weil <sage@inktank.com> +Date: Tue Aug 20 11:26:57 2013 -0700 + + mon/Paxos: cleanup: use do_refresh from handle_commit + + This avoid duplicated code by using the helper created exactly for this + purpose. + + Signed-off-by: Sage Weil <sage@inktank.com> + Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com> + (cherry picked from commit b9dee2285d9fe8533fa98c940d5af7b0b81f3d33) + +commit 02608a12d4e7592784148a62a47d568efc24079d +Author: Sage Weil <sage@inktank.com> +Date: Thu Aug 15 21:48:06 2013 -0700 + + osdc/ObjectCacher: do not merge rx buffers + + We do not try to merge rx buffers currently. Make that explicit and + documented in the code that it is not supported. (Otherwise the + last_read_tid values will get lost and read results won't get applied + to the cache properly.) + + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 1c50c446152ab0e571ae5508edb4ad7c7614c310) + +commit 0e2bfe71965eeef29b47e8032637ea820a7ce49c +Author: Sage Weil <sage@inktank.com> +Date: Thu Aug 15 21:47:18 2013 -0700 + + osdc/ObjectCacher: match reads with their original rx buffers + + Consider a sequence like: + + 1- start read on 100~200 + 100~200 state rx + 2- truncate to 200 + 100~100 state rx + 3- start read on 200~200 + 100~100 state rx + 200~200 state rx + 4- get 100~200 read result + + Currently this makes us crash on + + osdc/ObjectCacher.cc: 738: FAILED assert(bh->length() <= start+(loff_t)length-opos) + + when processing the second 200~200 bufferhead (it is too big). The + larger issue, though, is that we should not be looking at this data at + all; it has been truncated away. + + Fix this by marking each rx buffer with the read request that is sent to + fill it, and only fill it from that read request. Then the first reply + will fill the first 100~100 extend but not touch the other extent; the + second read will do that. + + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit b59f930ae147767eb4c9ff18c3821f6936a83227) + +commit 6b51c960715971a0351e8203d4896cb0c4138a3f +Author: Sage Weil <sage@inktank.com> +Date: Thu Aug 22 15:54:48 2013 -0700 + + mon/Paxos: fix another uncommitted value corner case + + It is possible that we begin the paxos recovery with an uncommitted + value for, say, commit 100. During last/collect we discover 100 has been + committed already. But also, another node provides an uncommitted value + for 101 with the same pn. Currently, we refuse to learn it, because the + pn is not strictly > than our current uncommitted pn... even though it is + the next last_committed+1 value that we need. + + There are two possible fixes here: + + - make this a >= as we can accept newer values from the same pn. + - discard our uncommitted value metadata when we commit the value. + + Let's do both! + + Fixes: #6090 + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit fe5010380a3a18ca85f39403e8032de1dddbe905) + +commit b3a280d5af9d06783d2698bd434940de94ab0fda +Author: Sage Weil <sage@inktank.com> +Date: Fri Aug 23 11:45:35 2013 -0700 + + os: make readdir_r buffers larger + + PATH_MAX isn't quite big enough. + + Backport: dumpling, cuttlefish, bobtail + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 99a2ff7da99f8cf70976f05d4fe7aa28dd7afae5) + +commit 989a664ef0d1c716cab967f249112f595cf98c43 +Author: Sage Weil <sage@inktank.com> +Date: Fri Aug 23 11:45:08 2013 -0700 + + os: fix readdir_r buffer size + + The buffer needs to be big or else we're walk all over the stack. + + Backport: dumpling, cuttlefish, bobtail + Signed-off-by: Sage Weil <sage@inktank.com> + (cherry picked from commit 2df66d9fa214e90eb5141df4d5755b57e8ba9413) + + Conflicts: + + src/os/BtrfsFileStoreBackend.cc + +commit a4cca31c82bf0e84272e01eb1b3188dfdb5b5615 +Author: Yehuda Sadeh <yehuda@inktank.com> +Date: Thu Aug 22 10:53:12 2013 -0700 + + rgw: fix crash when creating new zone on init + + Moving the watch/notify init before the zone init, + as we might need to send a notification. + + Reviewed-by: Sage Weil <sage@inktank.com> + Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> + (cherry picked from commit 3d55534268de7124d29bd365ea65da8d2f63e501) + +commit 4cf6996803ef66f2b6083f73593259d45e2740a3 +Author: Yehuda Sadeh <yehuda@inktank.com> +Date: Mon Aug 19 08:40:16 2013 -0700 + + rgw: change cache / watch-notify init sequence + + Fixes: #6046 + We were initializing the watch-notify (through the cache + init) before reading the zone info which was much too + early, as we didn't have the control pool name yet. Now + simplifying init/cleanup a bit, cache doesn't call watch/notify + init and cleanup directly, but rather states its need + through a virtual callback. + + Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> + Reviewed-by: Sage Weil <sage@inktank.com> + (cherry picked from commit d26ba3ab0374e77847c742dd00cb3bc9301214c2) + +commit aea6de532b0b843c3a8bb76d10bab8476f0d7c09 +Author: Alexandre Oliva <oliva@gnu.org> +Date: Thu Aug 22 03:40:22 2013 -0300 + + enable mds rejoin with active inodes' old parent xattrs + + When the parent xattrs of active inodes that the mds attempts to open + during rejoin lack pool info (struct_v < 5), this field will be filled + in with -1, causing the mds to retry fetching a backtrace with a pool + number that matches the expected value, which fails and causes the + err==-ENOENT branch to be taken and retry pool 1, which succeeds, but + with pool -1, and so keeps on bouncing between the two retry cases + forever. + + This patch arranges for the mds to go along with pool -1 instead of + insisting that it be refetched, enabling it to complete recovery + instead of eating cpu, network bandwidth and metadata osd's resources + like there's no tomorrow, in what AFAICT is an infinite and very busy + loop. + + This is not a new problem: I've had it even before upgrading from + Cuttlefish to Dumpling, I'd just never managed to track it down, and + force-unmounting the filesystem and then restarting the mds was an + easier (if inconvenient) work-around, particularly because it always + hit when the filesystem was under active, heavy-ish use (or there + wouldn't be much reason for caps recovery ;-) + + There are two issues not addressed in this patch, however. One is + that nothing seems to proactively update the parent xattr when it is + found to be outdated, so it remains out of date forever. Not even + renaming top-level directories causes the xattrs to be recursively + rewritten. AFAICT that's a bug. + + The other is that inodes that don't have a parent xattr (created by + even older versions of ceph) are reported as non-existing in the mds + rejoin message, because the absence of the parent xattr is signaled as + a missing inode (?failed to reconnect caps for missing inodes?). I + suppose this may cause more serious recovery problems. + + I suppose a global pass over the filesystem tree updating parent + xattrs that are out-of-date would be desirable, if we find any parent + xattrs still lacking current information; it might make sense to + activate it as a background thread from the backtrace decoding + function, when it finds a parent xattr that's too out-of-date, or as a + separate client (ceph-fsck?). + + Backport: dumpling, cuttlefish + Signed-off-by: Alexandre Oliva <oliva@gnu.org> + Reviewed-by: Zheng, Yan <zheng.z.yan@intel.com> + (cherry picked from commit 617dc36d477fd83b2d45034fe6311413aa1866df) + +commit 0738bdf92f5e5eb93add152a4135310ac7ea1c91 +Author: David Disseldorp <ddiss@suse.de> +Date: Mon Jul 29 17:05:44 2013 +0200 + + mds: remove waiting lock before merging with neighbours + + CephFS currently deadlocks under CTDB's ping_pong POSIX locking test + when run concurrently on multiple nodes. + The deadlock is caused by failed removal of a waiting_locks entry when + the waiting lock is merged with an existing lock, e.g: + + Initial MDS state (two clients, same file): + held_locks -- start: 0, length: 1, client: 4116, pid: 7899, type: 2 + start: 2, length: 1, client: 4110, pid: 40767, type: 2 + waiting_locks -- start: 1, length: 1, client: 4116, pid: 7899, type: 2 + + Waiting lock entry 4116@1:1 fires: + handle_client_file_setlock: start: 1, length: 1, + client: 4116, pid: 7899, type: 2 + + MDS state after lock is obtained: + held_locks -- start: 0, length: 2, client: 4116, pid: 7899, type: 2 + start: 2, length: 1, client: 4110, pid: 40767, type: 2 + waiting_locks -- start: 1, length: 1, client: 4116, pid: 7899, type: 2 + + Note that the waiting 4116@1:1 lock entry is merged with the existing + 4116@0:1 held lock to become a 4116@0:2 held lock. However, the now + handled 4116@1:1 waiting_locks entry remains. + + When handling a lock request, the MDS calls adjust_locks() to merge + the new lock with available neighbours. If the new lock is merged, + then the waiting_locks entry is not located in the subsequent + remove_waiting() call because adjust_locks changed the new lock to + include the old locks. + This fix ensures that the waiting_locks entry is removed prior to + modification during merge. + + Signed-off-by: David Disseldorp <ddiss@suse.de> + Reviewed-by: Greg Farnum <greg@inktank.com> + (cherry picked from commit 476e4902907dfadb3709ba820453299ececf990b) + +commit a0ac88272511d670b5c3756dda2d02c93c2e9776 +Author: Dan Mick <dan.mick@inktank.com> +Date: Tue Aug 20 11:10:42 2013 -0700 + + mon/PGMap: OSD byte counts 4x too large (conversion to bytes overzealous) + + Fixes: #6049 + Signed-off-by: Dan Mick <dan.mick@inktank.com> + (cherry picked from commit eca53bbf583027397f0d5e050a76498585ecb059) + +commit 87b19c33ce29e2ca4fc49a2adeb12d3f14ca90a9 +Author: Alfredo Deza <alfredo.deza@inktank.com> +Date: Fri Aug 23 08:56:07 2013 -0400 + + ceph-disk: specify the filetype when mounting + + Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com> + Reviewed-by: Sage Weil <sage@inktank.com> + (cherry picked from commit f040020fb2a7801ebbed23439159755ff8a3edbd) diff --git a/doc/dev/corpus.rst b/doc/dev/corpus.rst index 92f480a01a3..64f71c12fdf 100644 --- a/doc/dev/corpus.rst +++ b/doc/dev/corpus.rst @@ -22,71 +22,71 @@ We can generate an object corpus for a particular version of ceph like so. #. Checkout a clean repo (best not to do this where you normally work):: - git clone ceph.git - cd ceph - git submodule update --init + git clone ceph.git + cd ceph + git submodule update --init #. Build with flag to dump objects to /tmp/foo:: - rm -rf /tmp/foo ; mkdir /tmp/foo - ./do_autogen.sh -e /tmp/foo - make + rm -rf /tmp/foo ; mkdir /tmp/foo + ./do_autogen.sh -e /tmp/foo + make #. Start via vstart:: - cd src - MON=3 OSD=3 MDS=3 RGW=1 ./vstart.sh -n -x + cd src + MON=3 OSD=3 MDS=3 RGW=1 ./vstart.sh -n -x #. Use a much functionality of the cluster as you can, to exercise as many object encoder methods as possible:: - ./rados -p rbd bench 10 write -b 123 - ./ceph osd out 0 - ./init-ceph stop osd.1 - for f in ../qa/workunits/cls/*.sh ; do PATH=".:$PATH" $f ; done - ../qa/workunits/rados/test.sh - ./ceph_test_librbd - ./ceph_test_libcephfs - ./init-ceph restart mds.a + ./rados -p rbd bench 10 write -b 123 + ./ceph osd out 0 + ./init-ceph stop osd.1 + for f in ../qa/workunits/cls/*.sh ; do PATH=".:$PATH" $f ; done + ../qa/workunits/rados/test.sh + ./ceph_test_librbd + ./ceph_test_libcephfs + ./init-ceph restart mds.a Do some more stuff with rgw if you know how. #. Stop:: - ./stop.sh + ./stop.sh #. Import the corpus (this will take a few minutes):: - test/encoding/import.sh /tmp/foo `./ceph-dencoder version` ../ceph-object-corpus/archive - test/encoding/import-generated.sh ../ceph-object-corpus/archive + test/encoding/import.sh /tmp/foo `./ceph-dencoder version` ../ceph-object-corpus/archive + test/encoding/import-generated.sh ../ceph-object-corpus/archive #. Prune it! There will be a bazillion copies of various objects, and we only want a representative sample.:: - pushd ../ceph-object-corpus - bin/prune-archive.sh - popd + pushd ../ceph-object-corpus + bin/prune-archive.sh + popd #. Verify the tests pass:: - make check-local + make check-local #. Commit it to the corpus repo and push:: - pushd ../ceph-object-corpus - git checkout -b wip-new - git add archive/`../src/ceph-dencoder version` - git commit -m `../src/ceph-dencoder version` - git remote add cc ceph.com:/git/ceph-object-corpus.git - git push cc wip-new - popd + pushd ../ceph-object-corpus + git checkout -b wip-new + git add archive/`../src/ceph-dencoder version` + git commit -m `../src/ceph-dencoder version` + git remote add cc ceph.com:/git/ceph-object-corpus.git + git push cc wip-new + popd #. Go test it out:: - cd my/regular/tree - cd ceph-object-corpus - git fetch origin - git checkout wip-new - cd ../src - make check-local + cd my/regular/tree + cd ceph-object-corpus + git fetch origin + git checkout wip-new + cd ../src + make check-local #. If everything looks good, update the submodule master branch, and commit the submodule in ceph.git. diff --git a/doc/dev/osd_internals/erasure_coding/pgbackend.rst b/doc/dev/osd_internals/erasure_coding/pgbackend.rst index 4519ee34f9c..c16354f5116 100644 --- a/doc/dev/osd_internals/erasure_coding/pgbackend.rst +++ b/doc/dev/osd_internals/erasure_coding/pgbackend.rst @@ -79,10 +79,13 @@ Core Changes: APPEND, DELETE, (SET|RM)ATTR log entries. - The filestore needs to be able to deal with multiply versioned hobjects. This probably means adapting the filestore internally to - use a vhobject which is basically a pair<version_t, hobject_t>. The - version needs to be included in the on-disk filename. An interface - needs to be added to get all versions of a particular hobject_t or - the most recently versioned instance of a particular hobject_t. + use a ghobject which is basically a tuple<hobject_t, gen_t, + shard_t>. The gen_t + shard_t need to be included in the on-disk + filename. gen_t is a unique object identifier to make sure there + are no name collisions when object N is created + + deleted + created again. An interface needs to be added to get all + versions of a particular hobject_t or the most recently versioned + instance of a particular hobject_t. PGBackend Interfaces: @@ -178,7 +181,7 @@ acting set have different pieces of the erasure coding scheme and are not interchangeable. Worse, crush might cause chunk 2 to be written to an osd which happens already to contain an (old) copy of chunk 4. This means that the OSD and PG messages need to work in terms of a -type like pair<chunk_id_t, pg_t> in order to distinguish different pg +type like pair<shard_t, pg_t> in order to distinguish different pg chunks on a single OSD. Because the mapping of object name to object in the filestore must @@ -188,14 +191,14 @@ include the chunk id in the object key. Core changes: -- The filestore `vhobject_t needs to also include a chunk id +- The filestore `ghobject_t needs to also include a chunk id <http://tracker.ceph.com/issues/5862>`_ making it more like - tuple<hobject_t, version_t, chunk_id_t>. -- coll_t needs to include a chunk_id_t. + tuple<hobject_t, gen_t, shard_t>. +- coll_t needs to include a shard_t. - The `OSD pg_map and similar pg mappings need to work in terms of a cpg_t <http://tracker.ceph.com/issues/5863>`_ (essentially - pair<pg_t, chunk_id_t>). Similarly, pg->pg messages need to include - a chunk_id_t + pair<pg_t, shard_t>). Similarly, pg->pg messages need to include + a shard_t - For client->PG messages, the OSD will need a way to know which PG chunk should get the message since the OSD may contain both a primary and non-primary chunk for the same pg @@ -254,10 +257,10 @@ Core changes: - Ensure that crush behaves as above for INDEP. -`Recovery <http://tracker.ceph.com/issues/5857>`_ +Recovery -------- -The logic for recovering an object depends on the backend. With +See `Issue #5857`_. The logic for recovering an object depends on the backend. With the current replicated strategy, we first pull the object replica to the primary and then concurrently push it out to the replicas. With the erasure coded strategy, we probably want to read the @@ -271,6 +274,7 @@ PGBackend impementation will have to be able to direct the search for pg replicas with unrecoverable object chunks and to be able to determine whether a particular object is recoverable. + Core changes: - s/unfound/unrecoverable @@ -281,10 +285,10 @@ PGBackend interfaces: - recoverable() - recover_object() -`Backfill <http://tracker.ceph.com/issues/5856>`_ +Backfill -------- -For the most part, backfill itself should behave similarly between +See `Issue #5856`_. For the most part, backfill itself should behave similarly between replicated and erasure coded pools with a few exceptions: 1. We probably want to be able to backfill multiple osds concurrently @@ -311,3 +315,7 @@ PGBackend interfaces: - choose_backfill(): allows the implementation to determine which osds should be backfilled in a particular interval. + + +.. _Issue #5857: http://tracker.ceph.com/issues/5857 +.. _Issue #5856: http://tracker.ceph.com/issues/5856
\ No newline at end of file diff --git a/doc/dev/osd_internals/snaps.rst b/doc/dev/osd_internals/snaps.rst index a1e9020ba02..63b1bc0503c 100644 --- a/doc/dev/osd_internals/snaps.rst +++ b/doc/dev/osd_internals/snaps.rst @@ -70,18 +70,19 @@ See ReplicatedPG::SnapTrimmer, SnapMapper This trimming is performed asynchronously by the snap_trim_wq while the pg is clean and not scrubbing. - 1. The next snap in PG::snaptrimq is selected for trimming - 2. We determine the next object for trimming out of PG::snap_mapper. + #. The next snap in PG::snaptrimq is selected for trimming + #. We determine the next object for trimming out of PG::snap_mapper. For each object, we create a log entry and repop updating the object info and the snap set (including adjusting the overlaps). - 3. We also locally update our *SnapMapper* instance with the object's + #. We also locally update our *SnapMapper* instance with the object's new snaps. - 4. The log entry containing the modification of the object also + #. The log entry containing the modification of the object also contains the new set of snaps, which the replica uses to update its own *SnapMapper* instance. - 6. The primary shares the info with the replica, which persists + #. The primary shares the info with the replica, which persists the new set of purged_snaps along with the rest of the info. + Recovery -------- Because the trim operations are implemented using repops and log entries, diff --git a/doc/dev/release-process.rst b/doc/dev/release-process.rst index 656d5ca76c5..b48934831bb 100644 --- a/doc/dev/release-process.rst +++ b/doc/dev/release-process.rst @@ -26,7 +26,7 @@ Prior to building, it's necessary to update the pbuilder seed tarballs:: The release key should be present:: pub 4096R/17ED316D 2012-05-20 - uid Ceph Release Key <sage@newdream.net> + uid Ceph Release Key <sage@newdream.net> 3. Set up build area @@ -48,24 +48,25 @@ Checkout the submodules:: 4. Update Build version numbers ================================ -Substitute the ceph release number where indicated below by the string 0.xx:: +Substitute the ceph release number where indicated below by the string ``0.xx``. Edit configure.ac and update the version number. Example diff:: - -AC_INIT([ceph], [0.54], [ceph-devel@vger.kernel.org]) - +AC_INIT([ceph], [0.55], [ceph-devel@vger.kernel.org]) + -AC_INIT([ceph], [0.54], [ceph-devel@vger.kernel.org]) + +AC_INIT([ceph], [0.55], [ceph-devel@vger.kernel.org]) Update the version number in the debian change log:: - DEBEMAIL user@host dch -v 0.xx-1 + DEBEMAIL user@host dch -v 0.xx-1 Commit the changes:: - git commit -a + git commit -a Tag the release:: - ../ceph-build/tag-release v0.xx + ../ceph-build/tag-release v0.xx + 5. Create Makefiles =================== @@ -74,7 +75,7 @@ The actual configure options used to build packages are in the ``ceph.spec.in`` and ``debian/rules`` files. At this point we just need to create a Makefile.:: - ./do_autogen.sh + ./do_autogen.sh 6. Run the release scripts @@ -84,7 +85,8 @@ This creates tarballs and copies them, with other needed files to the build hosts listed in deb_hosts and rpm_hosts, runs a local build script, then rsyncs the results back tot the specified release directory.:: - ../ceph-build/do_release.sh /tmp/release + ../ceph-build/do_release.sh /tmp/release + 7. Create RPM Repo ================== @@ -92,35 +94,38 @@ script, then rsyncs the results back tot the specified release directory.:: Copy the rpms to the destination repo, creates the yum repository rpm and indexes.:: - ../ceph-build/push_to_rpm_repo.sh /tmp/release /tmp/rpm-repo 0.xx + ../ceph-build/push_to_rpm_repo.sh /tmp/release /tmp/rpm-repo 0.xx + 8. Create debian repo ===================== The key-id used below is the id of the ceph release key from step 2:: - mkdir /tmp/debian-repo - ../ceph-build/gen_reprepro_conf.sh /tmp/debian-repo key-id - ../ceph-build/push_to_deb_repo.sh /tmp/release /tmp/debian-repo 0.xx main + mkdir /tmp/debian-repo + ../ceph-build/gen_reprepro_conf.sh /tmp/debian-repo key-id + ../ceph-build/push_to_deb_repo.sh /tmp/release /tmp/debian-repo 0.xx main + 9. Push repos to ceph.org ========================== For a development release:: - rcp ceph-0.xx.tar.bz2 ceph-0.xx.tar.gz \ - ceph_site@ceph.com:ceph.com/downloads/. - rsync -av /tmp/rpm-repo/0.xx/ ceph_site@ceph.com:ceph.com/rpm-testing - rsync -av /tmp/debian-repo/ ceph_site@ceph.com:ceph.com/debian-testing + rcp ceph-0.xx.tar.bz2 ceph-0.xx.tar.gz \ + ceph_site@ceph.com:ceph.com/downloads/. + rsync -av /tmp/rpm-repo/0.xx/ ceph_site@ceph.com:ceph.com/rpm-testing + rsync -av /tmp/debian-repo/ ceph_site@ceph.com:ceph.com/debian-testing For a stable release, replace {CODENAME} with the release codename (e.g., ``argonaut`` or ``bobtail``):: - rcp ceph-0.xx.tar.bz2 \ - ceph_site@ceph.com:ceph.com/downloads/ceph-0.xx{CODENAME}.tar.bz2 - rcp ceph-0.xx.tar.gz \ - ceph_site@ceph.com:ceph.com/downloads/ceph-0.xx{CODENAME}.tar.gz - rsync -av /tmp/rpm-repo/0.xx/ ceph_site@ceph.com:ceph.com/rpm-{CODENAME} - rsync -auv /tmp/debian-repo/ ceph_site@ceph.com:ceph.com/debian-{CODENAME} + rcp ceph-0.xx.tar.bz2 \ + ceph_site@ceph.com:ceph.com/downloads/ceph-0.xx{CODENAME}.tar.bz2 + rcp ceph-0.xx.tar.gz \ + ceph_site@ceph.com:ceph.com/downloads/ceph-0.xx{CODENAME}.tar.gz + rsync -av /tmp/rpm-repo/0.xx/ ceph_site@ceph.com:ceph.com/rpm-{CODENAME} + rsync -auv /tmp/debian-repo/ ceph_site@ceph.com:ceph.com/debian-{CODENAME} + 10. Update Git ============== @@ -148,15 +153,16 @@ Similarly, for a development release, for both ``teuthology.git`` and ``ceph-qa- Stable release -------------- -For ``ceph.git``: +For ``ceph.git``:: + + git push origin stable - git push origin stable Point release ------------- -Just push the new tag: +Just push the new tag:: - git push origin v0.xx + git push origin v0.xx diff --git a/doc/dev/repo-lab-access.rst b/doc/dev/repo-lab-access.rst index 706f02e395c..2d1b328325a 100644 --- a/doc/dev/repo-lab-access.rst +++ b/doc/dev/repo-lab-access.rst @@ -4,11 +4,11 @@ Notes on Ceph repositories and test lab Special branches ---------------- -* ``master'': current tip (integration branch) -* ``next'': pending release (feature frozen, bugfixes only) -* ``last'': last/previous release -* ``dumpling'', ``cuttlefish'', ``bobtail'', ``argonaut'', etc.: stable release branches -* ``dumpling-next'': backports for stable release, pending testing +* ``master``: current tip (integration branch) +* ``next``: pending release (feature frozen, bugfixes only) +* ``last``: last/previous release +* ``dumpling``, ``cuttlefish``, ``bobtail``, ``argonaut``, etc.: stable release branches +* ``dumpling-next``: backports for stable release, pending testing Rules ----- @@ -18,7 +18,7 @@ The source repos are all on github. * Any branch pushed to ceph.git will kick off builds that will either run unit tests or generate packages for gitbuilder.ceph.com. Try not to generate unnecessary load. For private, unreviewed work, - only push to branches named ``wip-*''. This avoids colliding with + only push to branches named ``wip-*``. This avoids colliding with any special branches. * Nothing should every reach a special branch unless it has been @@ -34,7 +34,7 @@ The source repos are all on github. Reviewed-by: directly to the commit so that it is also visible when the patch is cherry-picked for backports. -* All backports should use ``git cherry-pick -x'' to capture which +* All backports should use ``git cherry-pick -x`` to capture which commit they are cherry-picking from. @@ -63,21 +63,21 @@ Locking machines * All tests pull their builds from gitbuilder.ceph.com. * Anybody can lock machines with ``teuthology-lock --lock-many NUM - --machine-type TYPE''. + --machine-type TYPE``. -* Machines are locked as ``whoami''@``hostname -s''. --owner to +* Machines are locked as ``whoami''@``hostname -s``. --owner to choose otherwise. -* Automated tests current run on the ``plana''; please avoid locking +* Automated tests current run on the ``plana``; please avoid locking these for personal use. -* To unlock, please use ``teuthology-nuke -t list.yaml -r -u'', which +* To unlock, please use ``teuthology-nuke -t list.yaml -r -u``, which will reboot and clean up any leftover test state before unlocking - (or fail to unlock). It looks for a ``targets::'' section in the + (or fail to unlock). It looks for a ``targets::`` section in the yaml, so the regular job yaml will work. You can get a list of all - locked machines with ``teuthology-lock --list-targets''. + locked machines with ``teuthology-lock --list-targets``. -* ``teuthology-lock -a --brief'' or ``teuthology-lock --summary'' to +* ``teuthology-lock -a --brief`` or ``teuthology-lock --summary`` to see what is locked and by whom. * Be conscientious about scheduling entire qa runs. Coordinate @@ -85,4 +85,4 @@ Locking machines ceph-qa-suite.git and teuthology.git. * Results for scheduled runs appear in /a/$jobname on the teuthology - machine. ``ls -alt | head'' to find them. + machine. ``ls -alt | head`` to find them. diff --git a/doc/dev/versions.rst b/doc/dev/versions.rst index 4fc4d8a12b2..bf5ee252cd5 100644 --- a/doc/dev/versions.rst +++ b/doc/dev/versions.rst @@ -1,6 +1,7 @@ -============== +================== Public OSD Version -============== +================== + We maintain two versions on disk: an eversion_t pg_log.head and a version_t info.user_version. Each object is tagged with both the pg version and user_version it was last modified with. The PG version is @@ -13,11 +14,11 @@ user_at_version is modified only in ReplicatedPG::prepare_transaction when the op was a "user modify" (a non-watch write), and the durable user_version is updated according to the following rules: 1) set user_at_version to the maximum of ctx->new_obs.oi.user_version+1 - and info.last_user_version+1. +and info.last_user_version+1. 2) set user_at_version to the maximum of itself and - ctx->at_version.version. +ctx->at_version.version. 3) ctx->new_obs.oi.user_version = ctx->user_at_version (to change the - object's user_version) +object's user_version) This set of update semantics mean that for traditional pools the user_version will be equal to the past reassert_version, while for diff --git a/doc/man/8/ceph-conf.rst b/doc/man/8/ceph-conf.rst index 7b4f83a9282..48d63d8fb07 100644 --- a/doc/man/8/ceph-conf.rst +++ b/doc/man/8/ceph-conf.rst @@ -84,4 +84,3 @@ See also ======== :doc:`ceph <ceph>`\(8), -:doc:`mkcephfs <mkcephfs>`\(8) diff --git a/doc/man/8/ceph-osd.rst b/doc/man/8/ceph-osd.rst index 451ca6d956b..9a08bef7e04 100644 --- a/doc/man/8/ceph-osd.rst +++ b/doc/man/8/ceph-osd.rst @@ -46,8 +46,7 @@ Options .. option:: --mkfs - Create an empty object repository. Normally invoked by - :doc:`mkcephfs <mkcephfs>`\(8). This also initializes the journal + Create an empty object repository. This also initializes the journal (if one is defined). .. option:: --mkkey diff --git a/doc/man/8/ceph-post-file.rst b/doc/man/8/ceph-post-file.rst index 5625843eaa6..f16fbd8a63c 100644 --- a/doc/man/8/ceph-post-file.rst +++ b/doc/man/8/ceph-post-file.rst @@ -1,6 +1,6 @@ -======================================== +================================================== ceph-post-file -- post files for ceph developers -======================================== +================================================== .. program:: ceph-post-file diff --git a/doc/man/8/ceph.rst b/doc/man/8/ceph.rst index 634c82c433e..661d93ad5b7 100644 --- a/doc/man/8/ceph.rst +++ b/doc/man/8/ceph.rst @@ -95,4 +95,3 @@ See also ======== :doc:`ceph <ceph>`\(8), -:doc:`mkcephfs <mkcephfs>`\(8) diff --git a/doc/man/8/crushtool.rst b/doc/man/8/crushtool.rst index 187352a5c04..5a3fc09adc0 100644 --- a/doc/man/8/crushtool.rst +++ b/doc/man/8/crushtool.rst @@ -114,4 +114,3 @@ See also :doc:`ceph <ceph>`\(8), :doc:`osdmaptool <osdmaptool>`\(8), -:doc:`mkcephfs <mkcephfs>`\(8) diff --git a/doc/man/8/mkcephfs.rst b/doc/man/8/mkcephfs.rst deleted file mode 100644 index 054a8deae1d..00000000000 --- a/doc/man/8/mkcephfs.rst +++ /dev/null @@ -1,123 +0,0 @@ -======================================= - mkcephfs -- create a ceph file system -======================================= - -.. program:: mkcephfs - -Synopsis -======== - -| **mkcephfs** -c *ceph.conf* [ --mkfs ] [ -a, --all-hosts [ -k - */path/to/admin.keyring* ] ] - - -Description -=========== - -**mkcephfs** is used to create an empty Ceph file system, possibly -spanning multiple hosts. The ceph.conf file describes the composition -of the entire Ceph cluster, including which hosts are participating, -which daemons run where, and which paths are used to store file system -data or metadata. - -The mkcephfs tool can be used in two ways. If -a is used, it will use -ssh and scp to connect to remote hosts on your behalf and do the setup -of the entire cluster. This is the easiest solution, but can also be -inconvenient (if you don't have ssh to connect without prompting for -passwords) or slow (if you have a large cluster). - -Alternatively, you can run each setup phase manually. First, you need -to prepare a monmap that will be shared by each node:: - - # prepare - master# mkdir /tmp/foo - master# mkcephfs -c /etc/ceph/ceph.conf \ - --prepare-monmap -d /tmp/foo - -Share the ``/tmp/foo`` directory with other nodes in whatever way is -convenient for you. On each OSD and MDS node:: - - osdnode# mkcephfs --init-local-daemons osd -d /tmp/foo - mdsnode# mkcephfs --init-local-daemons mds -d /tmp/foo - -Collect the contents of the /tmp/foo directories back onto a single -node, and then:: - - master# mkcephfs --prepare-mon -d /tmp/foo - -Finally, distribute ``/tmp/foo`` to all monitor nodes and, on each of -those nodes:: - - monnode# mkcephfs --init-local-daemons mon -d /tmp/foo - - -Options -======= - -.. option:: -a, --allhosts - - Performs the necessary initialization steps on all hosts in the - cluster, executing commands via SSH. - -.. option:: -c ceph.conf, --conf=ceph.conf - - Use the given conf file instead of the default ``/etc/ceph/ceph.conf``. - -.. option:: -k /path/to/keyring - - When ``-a`` is used, we can specify a location to copy the - client.admin keyring, which is used to administer the cluster. The - default is ``/etc/ceph/keyring`` (or whatever is specified in the - config file). - -.. option:: --mkfs - - Create and mount the file systems specified in the ceph.conf for - OSD data storage using mkfs.$type. The ``devs`` option in ceph.conf - must specify the device(s) and the ``osd mkfs type`` option must - specify the file system type (normally one of btrfs, xfs, or ext4). - -.. option:: --no-copy-conf - - By default, mkcephfs with -a will copy the new configuration to - /etc/ceph/ceph.conf on each node in the cluster. This option - disables that behavior. - -Subcommands -=========== - -The sub-commands performed during cluster setup can be run individually with - -.. option:: --prepare-monmap -d dir -c ceph.conf - - Create an initial monmap with a random fsid/uuid and store it and - the ceph.conf in dir. - -.. option:: --init-local-daemons type -d dir - - Initialize any daemons of type type on the local host using the - monmap in dir. For types osd and mds, the resulting authentication - keys will be placed in dir. For type mon, the initial data files - generated by --prepare-mon (below) are expected in dir. - -.. option:: --prepare-mon -d dir - - Prepare the initial monitor data based on the monmap, OSD, and MDS - authentication keys collected in dir, and put the result in dir. - - -Availability -============ - -**mkcephfs** is part of the Ceph distributed file system. Please refer -to the Ceph documentation at http://ceph.com/docs for more -information. - - -See also -======== - -:doc:`ceph <ceph>`\(8), -:doc:`monmaptool <monmaptool>`\(8), -:doc:`osdmaptool <osdmaptool>`\(8), -:doc:`crushtool <crushtool>`\(8) diff --git a/doc/man/8/monmaptool.rst b/doc/man/8/monmaptool.rst index 8415ba4136a..42af2faea8b 100644 --- a/doc/man/8/monmaptool.rst +++ b/doc/man/8/monmaptool.rst @@ -103,4 +103,3 @@ See also :doc:`ceph <ceph>`\(8), :doc:`crushtool <crushtool>`\(8), -:doc:`mkcephfs <mkcephfs>`\(8) diff --git a/doc/man/8/osdmaptool.rst b/doc/man/8/osdmaptool.rst index 27ffb6eba72..c815e485685 100644 --- a/doc/man/8/osdmaptool.rst +++ b/doc/man/8/osdmaptool.rst @@ -73,4 +73,3 @@ See also :doc:`ceph <ceph>`\(8), :doc:`crushtool <crushtool>`\(8), -:doc:`mkcephfs <mkcephfs>`\(8) diff --git a/doc/rados/man/index.rst b/doc/rados/man/index.rst index d7bbe9d3acb..e4f0f23bfa2 100644 --- a/doc/rados/man/index.rst +++ b/doc/rados/man/index.rst @@ -21,3 +21,9 @@ ../../man/8/monmaptool.rst ../../man/8/osdmaptool.rst ../../man/8/rados.rst + + +.. toctree:: + :hidden: + + ../../man/8/ceph-post-file.rst
\ No newline at end of file diff --git a/doc/rados/operations/add-or-rm-mons.rst b/doc/rados/operations/add-or-rm-mons.rst index 0a15781c6ea..17ae9d86b85 100644 --- a/doc/rados/operations/add-or-rm-mons.rst +++ b/doc/rados/operations/add-or-rm-mons.rst @@ -164,7 +164,7 @@ a cluster that has placement groups that are persistently not ``active + clean`` ceph mon dump ssh {mon-host} -#. Stop the ``ceph-mon'' daemon and extract a copy of the monap file. :: +#. Stop the ``ceph-mon`` daemon and extract a copy of the monap file. :: service ceph stop mon || stop ceph-mon-all ceph-mon -i {mon-id} --extract-monmap {map-path} diff --git a/doc/radosgw/config-ref.rst b/doc/radosgw/config-ref.rst index 790fafdc854..ea650f0683a 100644 --- a/doc/radosgw/config-ref.rst +++ b/doc/radosgw/config-ref.rst @@ -3,9 +3,9 @@ ====================================== The following settings may added to the Ceph configuration file (i.e., usually -``ceph.conf``) under the ``[client.radosgw.gateway]`` section. The settings may -contain default values. If you do not specify each setting in the Ceph -configuration file, the default value will be set automatically. +``ceph.conf``) under the ``[client.radosgw.{instance-name}]`` section. The +settings may contain default values. If you do not specify each setting in the +Ceph configuration file, the default value will be set automatically. ``rgw data`` @@ -91,70 +91,222 @@ configuration file, the default value will be set automatically. :Default: None +``rgw print continue`` -``rgw swift url`` +:Description: Enable ``100-continue`` if it is operational. +:Type: Boolean +:Default: ``true`` + + +``rgw remote addr param`` + +:Description: The remote address parameter. For example, the HTTP field + containing the remote address, or the ``X-Forwarded-For`` + address if a reverse proxy is operational. -:Description: The URL for the Ceph Object Gateway Swift API. :Type: String -:Default: None - +:Default: ``REMOTE_ADDR`` -``rgw swift url prefix`` -:Description: The URL prefix for the Swift API. -:Default: ``swift`` -:Example: http://fqdn.com/swift +``rgw op thread timeout`` + +:Description: The timeout in seconds for open threads. +:Type: Integer +:Default: 600 -``rgw swift auth url`` +``rgw op thread suicide timeout`` + +:Description: The time ``timeout`` in seconds before a Ceph Object Gateway + process dies. Disbled if set to ``0``. -:Description: Default URL for verifying v1 auth tokens (if not using internal - Swift auth). +:Type: Integer +:Default: ``0`` -:Type: String -:Default: None +``rgw thread pool size`` + +:Description: The size of the thread pool. +:Type: Integer +:Default: 100 threads. -``rgw swifth auth entry`` -:Description: The entry point for a Swift auth URL. -:Type: String -:Default: ``auth`` +``rgw num control oids`` +:Description: The number of notification objects used for cache synchronization + between different ``rgw`` instances. -``rgw keystone url`` +:Type: Integer +:Default: ``8`` + + +``rgw init timeout`` + +:Description: The number of seconds before Ceph Object Gateway gives up on + initialization. + +:Type: Integer +:Default: ``30`` + + +``rgw mime types file`` + +:Description: The path and location of the MIME types. Used for Swift + auto-detection of object types. -:Description: The URL for the Keystone server. :Type: String -:Default: None +:Default: ``/etc/mime.types`` -``rgw keystone admin token`` +``rgw gc max objs`` + +:Description: The maximum number of objects that may be handled by + garbage collection in one garbage collection processing cycle. + +:Type: Integer +:Default: ``32`` + + +``rgw gc obj min wait`` + +:Description: The minimum wait time before the object may be removed + and handled by garbage collection processing. + +:Type: Integer +:Default: ``2 * 3600`` + + +``rgw gc processor max time`` + +:Description: The maximum time between the beginning of two consecutive garbage + collection processing cycles. + +:Type: Integer +:Default: ``3600`` + + +``rgw gc processor period`` + +:Description: The cycle time for garbage collection processing. +:Type: Integer +:Default: ``3600`` + + +``rgw s3 success create obj status`` + +:Description: The alternate success status response for ``create-obj``. +:Type: Integer +:Default: ``0`` + + +``rgw resolve cname`` + +:Description: Whether ``rgw`` should use DNS CNAME record of the request + hostname field (if hostname is not equal to ``rgw dns name``). + +:Type: Boolean +:Default: ``false`` + + +``rgw object stripe size`` + +:Description: The size of an object stripe for Ceph Object Gateway objects. + See `Architecture`_ for details on striping. + +:Type: Integer +:Default: ``4 << 20`` + + +``rgw extended http attrs`` + +:Description: Add new set of attributes that could be set on an object. These + extra attributes can be set through HTTP header fields when + putting the objects. If set, these attributes will return as HTTP + fields when doing GET/HEAD on the object. -:Description: The Keystone admin token (shared secret). :Type: String :Default: None +:Example: "content_foo, content_bar" -``rgw keystone accepted roles`` +``rgw exit timeout secs`` -:Description: The roles requires to serve requests. -:Type: String -:Default: ``Member, admin`` +:Description: Number of seconds to wait for a process before exiting + unconditionally. +:Type: Integer +:Default: ``120`` -``rgw keystone token cache size`` -:Description: The maximum number of entries in each Keystone token cache. +``rgw get obj window size`` + +:Description: The window size in bytes for a single object request. :Type: Integer -:Default: ``10000`` +:Default: ``16 << 20`` -``rgw keystone revocation interval`` +``rgw get obj max req size`` + +:Description: The maximum request size of a single get operation sent to the + Ceph Storage Cluster. -:Description: The number of seconds between token revocation checks. :Type: Integer -:Default: ``15 * 60`` +:Default: ``4 << 20`` + + +``rgw relaxed s3 bucket names`` + +:Description: Enables relaxed S3 bucket names rules for US region buckets. +:Type: Boolean +:Default: ``false`` + + +``rgw list buckets max chunk`` + +:Description: The maximum number of buckets to retrieve in a single operation + when listing user buckets. + +:Type: Integer +:Default: ``1000`` + + +``rgw num zone opstate shards`` + +:Description: The maximum number of shards for keeping inter-region copy + progress information. + +:Type: Integer +:Default: ``128`` + + +``rgw opstate ratelimit sec`` + +:Description: The minimum time between opstate updates on a single upload. + ``0`` disables the ratelimit. + +:Type: Integer +:Default: ``30`` + + +``rgw curl wait timeout ms`` + +:Description: The timeout in milliseconds for certain ``curl`` calls. +:Type: Integer +:Default: ``1000`` + + +``rgw copy obj progress`` + +:Description: Enables output of object progress during long copy operations. +:Type: Boolean +:Default: ``true`` + + +``rgw copy obj progress every bytes`` + +:Description: The minimum bytes between copy progress output. +:Type: Integer +:Default: ``1024 * 1024`` ``rgw admin entry`` @@ -162,69 +314,337 @@ configuration file, the default value will be set automatically. :Description: The entry point for an admin request URL. :Type: String :Default: ``admin`` - -``rgw enforce swift acls`` -:Description: Enforces the Swift Access Control List (ACL) settings. -:Type: Boolean -:Default: ``true`` +Regions +======= + +In Ceph v0.67 and beyond, Ceph Object Gateway supports federated deployments and +a global namespace via the notion of regions. A region defines the geographic +location of one or more Ceph Object Gateway instances within one or more zones. + + +Configuring regions differs from typical configuration procedures, because not +all of the settings end up in a Ceph configuration file. In Ceph v0.67 and +beyond, you can list regions, get a region configuration and set a region +configuration. + + +List Regions +------------ + +A Ceph cluster contains a list of regions. To list the regions, execute:: + + sudo radosgw-admin regions list + +The ``radosgw-admin`` returns a JSON formatted list of regions. + +.. code-block:: javascript + + { "default_info": { "default_region": "default"}, + "regions": [ + "default"]} + + +Get a Region Map +---------------- + +To list the details of each region, execute:: + + sudo radosgw-admin region-map get -``rgw swift token expiration`` +.. note:: If you receive a ``failed to read region map`` error, run + ``sudo radosgw-admin region-map update`` first. -:Description: The time in seconds for expiring a Swift token. -:Type: Integer -:Default: ``24 * 3600`` +Get a Region +------------ -``rgw print continue`` +To view the configuration of a region, execute:: -:Description: Enable ``100-continue`` if it is operational. -:Type: Boolean -:Default: ``true`` + radosgw-admin region get [--rgw-region=<region>] +The ``default`` region looks like this: -``rgw remote addr param`` +.. code-block:: javascript -:Description: The remote address parameter. For example, the HTTP field - containing the remote address, or the ``X-Forwarded-For`` - address if a reverse proxy is operational. + {"name": "default", + "api_name": "", + "is_master": "true", + "endpoints": [], + "master_zone": "", + "zones": [ + {"name": "default", + "endpoints": [], + "log_meta": "false", + "log_data": "false"} + ], + "placement_targets": [ + {"name": "default-placement", + "tags": [] }], + "default_placement": "default-placement"} + +Set a Region +------------ + +Defining a region consists of creating a JSON object, specifying at least the +required settings: + +#. ``name``: The name of the region. Required. + +#. ``api_name``: The API name for the region. Optional. + +#. ``is_master``: Determines if the region is the master region. Required. + **note:** You can only have one master region. + +#. ``endpoints``: A list of all the endpoints in the region. For example, + you may use multiple domain names to refer to the same region. Remember to + escape the forward slashes (``\/``). You may also specify a + port (``fgdn:port``) for each endpoint. Optional. + +#. ``master_zone``: The master zone for the region. Optional. Uses the default + zone if not specified. **note:** You can only have one master zone per + region. + +#. ``zones``: A list of all zones within the region. Each zone has a + name (required), a list of endpoints (optional), and whether or not the + gateway will log metadata and data operations (false by default). + +#. ``placement_targets``: A list of placement targets (optional). Each + placement target contains a name (required) and a list of tags (optional). + +#. ``default_placement``: The set of default placement pools for the object + index and object data. Set to ``default-placement`` by default. + +To set a region, create a JSON object consisting of the required fields, save +the object to a file (e.g., ``region.json``); then, execute the following +command:: + + + sudo radosgw-admin region set --infile region.json + +Where ``region.json`` is the JSON file you created. + +.. important:: The ``default`` region ``is_master`` setting is ``true`` by + default. If you create a new region and want to make it the master region, + you must either set the ``default`` region ``is_master`` setting to + ``false``, or delete the ``default`` region. + +Finally, update the map. :: + + sudo radosgw-admin region-map update + + +Set a Region Map +---------------- + +Setting a region map consists of creating a JSON object consisting of one or more +regions, and setting the ``master_region`` for the cluster. Each region in the +region map consists of a key/value pair, where the ``key`` setting is equivalent to +the ``name`` setting for an individual region configuration, and the ``val`` is +a JSON object consisting of an individual region configuration. + +You may only have one region with ``is_master`` equal to ``true``, and it must be +specified as the ``master_region`` at the end of the region map. The following +JSON object is an example of a default region map. + + +.. code-block:: javascript + + { "regions": [ + { "key": "default", + "val": { "name": "default", + "api_name": "", + "is_master": "true", + "endpoints": [], + "master_zone": "", + "zones": [ + { "name": "default", + "endpoints": [], + "log_meta": "false", + "log_data": "false"}], + "placement_targets": [ + { "name": "default-placement", + "tags": []}], + "default_placement": "default-placement" + } + } + ], + "master_region": "default" + } + +To set a region map, execute the following:: + + sudo radosgw-admin region-map set --infile regionmap.json + +Where ``regionmap.json`` is the JSON file you created. Ensure that you have +zones created for the ones specified in the region map. Finally, update the map. +:: + + sudo radosgw-admin regionmap update + + +Zones +===== + +In Ceph v0.67 and beyond, Ceph Object Gateway supports the notion of zones. A +zone defines a logical group consisting of one or more Ceph Object Gateway +instances. + +Configuring zones differs from typical configuration procedures, because not +all of the settings end up in a Ceph configuration file. In Ceph v0.67 and +beyond, you can list zones, get a zone configuration and set a zone +configuration. + + +List Zones +---------- + +To list the zones in a cluster, execute:: + + sudo radosgw-admin zone list + + +Get a Zone +---------- + +To get the configuration of a zone, execute:: + + sudo radosgw-admin zone [--rgw-zone=<zone>] + +The ``default`` zone looks like this: + +.. code-block:: javascript + + { "domain_root": ".rgw", + "control_pool": ".rgw.control", + "gc_pool": ".rgw.gc", + "log_pool": ".log", + "intent_log_pool": ".intent-log", + "usage_log_pool": ".usage", + "user_keys_pool": ".users", + "user_email_pool": ".users.email", + "user_swift_pool": ".users.swift", + "user_uid_pool": ".users.uid", + "system_key": { "access_key": "", "secret_key": ""}, + "placement_pools": [ + { "key": "default-placement", + "val": { "index_pool": ".rgw.buckets.index", + "data_pool": ".rgw.buckets"} + } + ] + } + + +Set a Zone +---------- + +Configuring a zone involves specifying a series of Ceph Object Gateway pools. +For consistency, we recommend using a pool prefix that is +the same as the zone name. See `Pools`_ for details of configuring pools. + +To set a zone, create a JSON object consisting of the pools, save +the object to a file (e.g., ``zone.json``); then, execute the following +command, replacing ``{zone-name}`` with the name of the zone:: + + sudo radosgw-admin zone set --rgw-zone={zone-name} --infile zone.json +Where ``zone.json`` is the JSON file you created. + + +Region/Zone Settings +==================== + +You may include the following settings in your Ceph configuration +file under each ``[client.radosgw.{instance-name}]`` instance. + + +.. versionadded:: v.67 + +``rgw zone`` + +:Description: The name of the zone for the gateway instance. :Type: String -:Default: ``REMOTE_ADDR`` +:Default: None -``rgw op thread timeout`` - -:Description: The timeout in seconds for open threads. -:Type: Integer -:Default: 600 - +.. versionadded:: v.67 -``rgw op thread suicide timeout`` - -:Description: The time ``timeout`` in seconds before a Ceph Object Gateway - process dies. Disbled if set to ``0``. +``rgw region`` -:Type: Integer -:Default: ``0`` +:Description: The name of the region for the gateway instance. +:Type: String +:Default: None -``rgw thread pool size`` +.. versionadded:: v.67 -:Description: The size of the thread pool. -:Type: Integer -:Default: 100 threads. +``rgw default region info oid`` +:Description: The OID for storing the default region. We do not recommend + changing this setting. + +:Type: String +:Default: ``default.region`` -``rgw num control oids`` -:Description: The number of notification objects used for cache synchronization - between different ``rgw`` instances. -:Type: Integer -:Default: ``8`` +Pools +===== + +Ceph zones map to a series of Ceph Storage Cluster pools. + +.. topic:: Manually Created Pools vs. Generated Pools + + If you provide write capabilities to the user key for your Ceph Object + Gateway, the gateway has the ability to create pools automatically. This + is convenient, but the Ceph Object Storage Cluster uses the default + values for the number of placement groups (which may not be ideal) or the + values you specified in your Ceph configuration file. If you allow the + Ceph Object Gateway to create pools automatically, ensure that you have + reasonable defaults for the number of placement groups. See + `Pool Configuration`_ for details. See `Cluster Pools`_ for details on + creating pools. + +The default pools for the Ceph Object Gateway's default zone include: + +- ``.rgw`` +- ``.rgw.control`` +- ``.rgw.gc`` +- ``.log`` +- ``.intent-log`` +- ``.usage`` +- ``.users`` +- ``.users.email`` +- ``.users.swift`` +- ``.users.uid`` + +You have significant discretion in determining how you want a zone to access +pools. You can create pools on a per zone basis, or use the same pools for +multiple zones. As a best practice, we recommend having a separate set of pools +for your master zone and your secondary zones in each region. When creating +pools for a specific zone, consider prepending the region name and zone name to +the default pool names. For example: + +- ``.region1-zone1.rgw`` +- ``.region1-zone1.rgw.control`` +- ``.region1-zone1.rgw.gc`` +- ``.region1-zone1.log`` +- ``.region1-zone1.intent-log`` +- ``.region1-zone1.usage`` +- ``.region1-zone1.users`` +- ``.region1-zone1.users.email`` +- ``.region1-zone1.users.swift`` +- ``.region1-zone1.users.uid`` + + +Ceph Object Gateways store data for the bucket index (``index_pool``) and bucket +data (``data_pool``) in placement pools. These may overlap--i.e., you may use +the same pool for the the index and the data. The index pool for default +placement is ``.rgw.buckets.index`` and for the data pool for default placement +is ``.rgw.buckets``. See `Zones`_ for details on specifying pools in a zone +configuration. .. deprecated:: v.67 @@ -243,11 +663,12 @@ configuration file, the default value will be set automatically. .. versionadded:: v.67 -``rgw zone`` +``rgw region root pool`` -:Description: The name of the zone for the gateway instance. +:Description: The pool for storing all region-specific information. :Type: String -:Default: None +:Default: ``.rgw.root`` + .. versionadded:: v.67 @@ -259,30 +680,56 @@ configuration file, the default value will be set automatically. :Default: ``.rgw.root`` -.. versionadded:: v.67 +Swift Settings +============== -``rgw region`` +``rgw enforce swift acls`` -:Description: The name of the region for the gateway instance. +:Description: Enforces the Swift Access Control List (ACL) settings. +:Type: Boolean +:Default: ``true`` + + +``rgw swift token expiration`` + +:Description: The time in seconds for expiring a Swift token. +:Type: Integer +:Default: ``24 * 3600`` + + +``rgw swift url`` + +:Description: The URL for the Ceph Object Gateway Swift API. :Type: String :Default: None + -.. versionadded:: v.67 +``rgw swift url prefix`` -``rgw region root pool`` +:Description: The URL prefix for the Swift API. +:Default: ``swift`` +:Example: http://fqdn.com/swift + -:Description: The pool for storing all region-specific information. -:Type: String -:Default: ``.rgw.root`` +``rgw swift auth url`` +:Description: Default URL for verifying v1 auth tokens (if not using internal + Swift auth). -.. versionadded:: v.67 +:Type: String +:Default: None -``rgw default region info oid`` -:Description: The OID for storing the default region. +``rgw swift auth entry`` + +:Description: The entry point for a Swift auth URL. :Type: String -:Default: ``default.region`` +:Default: ``auth`` + + + +Logging Settings +================ ``rgw log nonexistent bucket`` @@ -401,134 +848,41 @@ configuration file, the default value will be set automatically. :Default: ``false`` -``rgw init timeout`` - -:Description: The number of seconds before Ceph Object Gateway gives up on - initialization. +``rgw data log window`` +:Description: The data log entries window in seconds. :Type: Integer :Default: ``30`` -``rgw mime types file`` - -:Description: The path and location of the MIME types. Used for Swift - auto-detection of object types. - -:Type: String -:Default: ``/etc/mime.types`` - - -``rgw gc max objs`` - -:Description: The maximum number of objects that may be handled by - garbage collection in one garbage collection processing cycle. - -:Type: Integer -:Default: ``32`` - - -``rgw gc obj min wait`` - -:Description: The minimum wait time before the object may be removed - and handled by garbage collection processing. - -:Type: Integer -:Default: ``2 * 3600`` - - -``rgw gc processor max time`` - -:Description: The maximum time between the beginning of two consecutive garbage - collection processing cycles. - -:Type: Integer -:Default: ``3600`` - - -``rgw gc processor period`` - -:Description: The cycle time for garbage collection processing. -:Type: Integer -:Default: ``3600`` - - -``rgw s3 success create obj status`` +``rgw data log changes size`` -:Description: The alternate success status response for ``create-obj``. +:Description: The number of in-memory entries to hold for the data changes log. :Type: Integer -:Default: ``0`` - - -``rgw resolve cname`` - -:Description: Whether ``rgw`` should use DNS CNAME record of the request - hostname field (if hostname is not equal to ``rgw dns name``). - -:Type: Boolean -:Default: ``false`` +:Default: ``1000`` -``rgw object stripe size`` +``rgw data log num shards`` -:Description: The size of an object stripe for Ceph Object Gateway objects. - See `Architecture`_ for details on striping. +:Description: The number of shards (objects) on which to keep the + data changes log. :Type: Integer -:Default: ``4 << 20`` - +:Default: ``128`` -``rgw extended http attrs`` -:Description: Add new set of attributes that could be set on an object. These - extra attributes can be set through HTTP header fields when - putting the objects. If set, these attributes will return as HTTP - fields when doing GET/HEAD on the object. +``rgw data log obj prefix`` +:Description: The object name prefix for the data log. :Type: String -:Default: None -:Example: "content_foo, content_bar" - - -``rgw exit timeout secs`` - -:Description: Number of seconds to wait for a process before exiting - unconditionally. - -:Type: Integer -:Default: ``120`` - - -``rgw get obj window size`` - -:Description: The window size in bytes for a single object request. -:Type: Integer -:Default: ``16 << 20`` - - -``rgw get obj max req size`` - -:Description: The maximum request size of a single get operation sent to the - Ceph Storage Cluster. - -:Type: Integer -:Default: ``4 << 20`` - - -``rgw relaxed s3 bucket names`` - -:Description: Enables relaxed S3 bucket names rules for US region buckets. -:Type: Boolean -:Default: ``false`` - +:Default: ``data_log`` -``rgw list buckets max chunk`` -:Description: The maximum number of buckets to retrieve in a single operation - when listing user buckets. +``rgw replica log obj prefix`` -:Type: Integer -:Default: ``1000`` +:Description: The object name prefix for the replica log. +:Type: String +:Default: ``replica log`` ``rgw md log max shards`` @@ -538,80 +892,47 @@ configuration file, the default value will be set automatically. :Default: ``64`` -``rgw num zone opstate shards`` - -:Description: The maximum number of shards for keeping inter-region copy - progress information. - -:Type: Integer -:Default: ``128`` +Keystone Settings +================= -``rgw opstate ratelimit sec`` -:Description: The minimum time between opstate updates on a single upload. - ``0`` disables the ratelimit. - -:Type: Integer -:Default: ``30`` - - -``rgw curl wait timeout ms`` - -:Description: The timeout in milliseconds for certain ``curl`` calls. -:Type: Integer -:Default: ``1000`` - - -``rgw copy obj progress`` +``rgw keystone url`` -:Description: Enables output of object progress during long copy operations. -:Type: Boolean -:Default: ``true`` +:Description: The URL for the Keystone server. +:Type: String +:Default: None -``rgw copy obj progress every bytes`` +``rgw keystone admin token`` -:Description: The minimum bytes between copy progress output. -:Type: Integer -:Default: ``1024 * 1024`` +:Description: The Keystone admin token (shared secret). +:Type: String +:Default: None -``rgw data log window`` +``rgw keystone accepted roles`` -:Description: The data log entries window in seconds. -:Type: Integer -:Default: ``30`` +:Description: The roles requires to serve requests. +:Type: String +:Default: ``Member, admin`` -``rgw data log changes size`` +``rgw keystone token cache size`` -:Description: The number of in-memory entries to hold for the data changes log. +:Description: The maximum number of entries in each Keystone token cache. :Type: Integer -:Default: ``1000`` - +:Default: ``10000`` -``rgw data log num shards`` -:Description: The number of shards (objects) on which to keep the - data changes log. +``rgw keystone revocation interval`` +:Description: The number of seconds between token revocation checks. :Type: Integer -:Default: ``128`` - - -``rgw data log obj prefix`` - -:Description: The object name prefix for the data log. -:Type: String -:Default: ``data_log`` - - -``rgw replica log obj prefix`` +:Default: ``15 * 60`` -:Description: The object name prefix for the replica log. -:Type: String -:Default: ``replica log`` -.. _Architecture: ../../architecture#data-striping
\ No newline at end of file +.. _Architecture: ../../architecture#data-striping +.. _Pool Configuration: ../../rados/configuration/pool-pg-config-ref/ +.. _Cluster Pools: ../../rados/operations/pools
\ No newline at end of file diff --git a/doc/release-notes.rst b/doc/release-notes.rst index 92254cf95e6..accc61e112d 100644 --- a/doc/release-notes.rst +++ b/doc/release-notes.rst @@ -2,6 +2,109 @@ Release Notes =============== +v0.68 +----- + +Upgrading +~~~~~~~~~ + +* 'ceph osd crush set <id> <weight> <loc..>' no longer adds the osd to the + specified location, as that's a job for 'ceph osd crush add'. It will + however continue to work just the same as long as the osd already exists + in the crush map. + +* The OSD now enforces that class write methods cannot both mutate an + object and return data. The rbd.assign_bid method, the lone + offender, has been removed. This breaks compatibility with + pre-bobtail librbd clients by preventing them from creating new + images. + +* librados now returns on commit instead of ack for synchronous calls. + This is a bit safer in the case where both OSDs and the client crash, and + is probably how it should have been acting from the beginning. Users are + unlikely to notice but it could result in lower performance in some + circumstances. Those who care should switch to using the async interfaces, + which let you specify safety semantics precisely. + +* The C++ librados AioComplete::get_version() method was incorrectly + returning an int (usually 32-bits). To avoid breaking library + compatibility, a get_version64() method is added that returns the + full-width value. The old method is deprecated and will be removed + in a future release. Users of the C++ librados API that make use of + the get_version() method should modify their code to avoid getting a + value that is truncated from 64 to to 32 bits. + + + +Notable Changes +~~~~~~~~~~~~~~~ + +* ceph-fuse: fix problem with readahead vs truncate race (Yan, Zheng) +* ceph-post-file: new command to easily share logs or other files with ceph devs +* ceph: parse CEPH_ARGS env variable +* librados: fix async aio completion wakeup +* librados: hello_world example (Greg Farnum) +* librados: sync calls now return on commit (instead of ack) (Greg Farnum) +* mds: fix mds rejoin with legacy parent backpointer xattrs (Alexandre Oliva) +* mds: fix rare restart/failure race during fs creation +* mds: notify clients about deleted files (so they can release from their cache) (Yan, Zheng) +* mds: several bug fixes with clustered mds (Yan, Zheng) +* mon: allow logging level of cluster log (/var/log/ceph/ceph.log) to be adjusted +* mon: do not expose uncommitted state from 'osd crush {add,set} ...' (Joao Luis) +* mon: fix byte counts (off by factor of 4) (Dan Mick, Joao Luis) +* mon: fix paxos corner case +* mon: modify 'auth add' semantics to make a bit more sense (Joao Luis) +* mon: new 'osd perf' command to dump recent performance information (Samuel Just) +* mon: new and improved 'ceph -s' or 'ceph status' command (more info, easier to read) +* monc: fix small memory leak +* new wireshark patches pulled into the tree (Kevin Jones) +* objecter: fix possible hang when cluster is unpaused (Josh Durgin) +* osd: 'osd recover clone overlap limit' option to limit cloning during recovery (Samuel Just) +* osd: cls_hello OSD class example +* osd: experiemental support for ZFS (zfsonlinux.org) (Yan, Zheng) +* osd: instrument peering states (David Zafman) +* osd: properly enforce RD/WR flags for rados classes +* osd: remove old pg log on upgrade (Samuel Just) +* rgw: complete in-progress requests before shutting down +* rgw: fix S3 auth with response-* query string params (Sylvain Munaut, Yehuda Sadeh) +* sysvinit: add condrestart command (Dan van der Ster) + + +v0.67.3 "Dumpling" +------------------ + +This point release fixes a few important performance regressions with +the OSD (both with CPU and disk utilization), as well as several other +important but less common problems. We recommend that all production users +upgrade. + +Notable Changes +~~~~~~~~~~~~~~~ + +* ceph-disk: partprobe after creation journal partition +* ceph-disk: specify fs type when mounting +* ceph-post-file: new utility to help share logs and other files with ceph developers +* libcephfs: fix truncate vs readahead race (crash) +* mds: fix flock/fcntl lock deadlock +* mds: fix rejoin loop when encountering pre-dumpling backpointers +* mon: allow name and addr discovery during election stage +* mon: always refresh after Paxos store_state (fixes recovery corner case) +* mon: fix off-by-4x bug with osd byte counts +* osd: add and disable 'pg log keys debug' by default +* osd: add option to disable throttling +* osd: avoid leveldb iterators for pg log append and trim +* osd: fix readdir_r invocations +* osd: use fdatasync instead of sync +* radosgw: fix sysvinit script return status +* rbd: relicense as LGPL2 +* rgw: flush pending data on multipart upload +* rgw: recheck object name during S3 POST +* rgw: reorder init/startup +* rpm: fix debuginfo package build + +For more detailed information, see :download:`the complete changelog <changelog/v0.67.3.txt>`. + + v0.67.2 "Dumpling" ------------------ @@ -165,11 +268,11 @@ In addition to the above notes about upgrading from v0.66: * The 'ceph osd tell ...' and 'ceph mon tell ...' commands are no longer supported. Any callers should use:: - ceph tell osd.<id or *> ... - ceph tell mon.<id or name or *> ... + ceph tell osd.<id or *> ... + ceph tell mon.<id or name or *> ... The 'ceph mds tell ...' command is still there, but will soon also - transition to 'ceph tell mds.<id or name or *> ...' + transition to 'ceph tell mds.<id or name or \*> ...' * The 'ceph osd crush add ...' command used to take one of two forms:: @@ -194,7 +297,7 @@ In addition to the above notes about upgrading from v0.66: renamed to 'mon osd min down {reporters|reports}', and the documentation has been updated to reflect that these options apply to the monitors (who process failure reports) and not OSDs. If you - have adjusted these settings, please update your ``ceph.conf'' + have adjusted these settings, please update your ``ceph.conf`` accordingly. @@ -398,11 +501,11 @@ Upgrading * The 'ceph osd tell ...' and 'ceph mon tell ...' commands are no longer supported. Any callers should use:: - ceph tell osd.<id or *> ... - ceph tell mon.<id or name or *> ... + ceph tell osd.<id or *> ... + ceph tell mon.<id or name or *> ... The 'ceph mds tell ...' command is still there, but will soon also - transition to 'ceph tell mds.<id or name or *> ...' + transition to 'ceph tell mds.<id or name or \*> ...' * The 'ceph osd crush add ...' command used to take one of two forms:: @@ -496,7 +599,7 @@ Upgrading renamed to 'mon osd min down {reporters|reports}', and the documentation has been updated to reflect that these options apply to the monitors (who process failure reports) and not OSDs. If you - have adjusted these settings, please update your ``ceph.conf'' + have adjusted these settings, please update your ``ceph.conf`` accordingly. Notable Changes diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 00000000000..c3a8d695a1b --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/qa/workunits/mon/rbd_snaps_ops.sh b/qa/workunits/mon/rbd_snaps_ops.sh new file mode 100755 index 00000000000..29e94df7cad --- /dev/null +++ b/qa/workunits/mon/rbd_snaps_ops.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# attempt to trigger #6047 + + +cmd_no=0 +expect() +{ + cmd_no=$(($cmd_no+1)) + cmd="$1" + expected=$2 + echo "[$cmd_no] $cmd" + eval $cmd + ret=$? + if [[ $ret -ne $expected ]]; then + echo "[$cmd_no] unexpected return '$ret', expected '$expected'" + exit 1 + fi +} + +expect 'ceph osd pool create test 256 256' 0 +expect 'ceph osd pool mksnap test snapshot' 0 +expect 'ceph osd pool rmsnap test snapshot' 0 + +expect 'rbd --pool=test create --size=102400 image' 0 +expect 'rbd --pool=test snap create image@snapshot' 22 + +expect 'ceph osd pool delete test test --yes-i-really-really-mean-it' 0 +expect 'ceph osd pool create test 256 256' 0 +expect 'rbd --pool=test create --size=102400 image' 0 +expect 'rbd --pool=test snap create image@snapshot' 0 +expect 'rbd --pool=test snap ls image' 0 +expect 'rbd --pool=test snap rm image@snapshot' 0 + +expect 'ceph osd pool mksnap test snapshot' 22 + +expect 'ceph osd pool delete test test --yes-i-really-really-mean-it' 0 + +echo OK diff --git a/src/Makefile-env.am b/src/Makefile-env.am new file mode 100644 index 00000000000..cc9ffc62f12 --- /dev/null +++ b/src/Makefile-env.am @@ -0,0 +1,172 @@ +AUTOMAKE_OPTIONS = gnu subdir-objects + +SUBDIRS = +DIST_SUBDIRS = +BUILT_SOURCES = +EXTRA_DIST = +CLEANFILES = + +noinst_HEADERS = +bin_PROGRAMS = +bin_SCRIPTS = +sbin_PROGRAMS = +sbin_SCRIPTS = +dist_bin_SCRIPTS = +lib_LTLIBRARIES = +noinst_LTLIBRARIES = +noinst_LIBRARIES = +radoslib_LTLIBRARIES = + +# like bin_PROGRAMS, but these targets are only built for debug builds +bin_DEBUGPROGRAMS = + +# like sbin_SCRIPTS but can be used to install to e.g. /usr/sbin +ceph_sbindir = $(exec_prefix)$(sbindir) + +# C/C++ tests to build will be appended to this +check_PROGRAMS = + +# when doing a debug build, make sure to make the targets +if WITH_DEBUG +bin_PROGRAMS += $(bin_DEBUGPROGRAMS) +endif + + +################################## +## automake environment + +AM_COMMON_FLAGS = \ + -D__CEPH__ \ + -D_FILE_OFFSET_BITS=64 \ + -D_REENTRANT \ + -D_THREAD_SAFE \ + -D__STDC_FORMAT_MACROS \ + -D_GNU_SOURCE \ + -rdynamic \ + -Wall \ + ${WARN_TYPE_LIMITS} \ + ${WARN_IGNORED_QUALIFIERS} \ + -Winit-self \ + -Wpointer-arith \ + -Werror=format-security \ + -fno-strict-aliasing \ + -fsigned-char + +AM_CFLAGS = $(AM_COMMON_FLAGS) +AM_CPPFLAGS = \ + $(AM_COMMON_FLAGS) \ + -DCEPH_LIBDIR=\"${libdir}\" +AM_CXXFLAGS = \ + @AM_CXXFLAGS@ \ + $(AM_COMMON_FLAGS) \ + -DCEPH_LIBDIR=\"${libdir}\" \ + -Wnon-virtual-dtor \ + -Wno-invalid-offsetof \ + -Wstrict-null-sentinel + +# note: this is position dependant, it affects the -l options that +# come after it on the command line. when you use ${AM_LDFLAGS} in +# later rules, take care where you place it. for more information, see +# http://blog.flameeyes.eu/2008/11/19/relationship-between-as-needed-and-no-undefined-part-1-what-do-they-do +# http://blog.flameeyes.eu/2008/11/20/misguided-link-and-as-needed +# http://www.gentoo.org/proj/en/qa/asneeded.xml +# http://gcc.gnu.org/ml/gcc-help/2010-12/msg00338.html +# http://sigquit.wordpress.com/2011/02/16/why-asneeded-doesnt-work-as-expected-for-your-libraries-on-your-autotools-project/ +AM_LDFLAGS = -Wl,--as-needed + +if USE_BOOST_SPIRIT_OLD_HDR +AM_CXXFLAGS += -DUSE_BOOST_SPIRIT_OLD_HDR +endif + +if WITH_LIBATOMIC +AM_LDFLAGS += -latomic_ops +endif + +if ENABLE_COVERAGE +AM_CFLAGS += -fprofile-arcs -ftest-coverage +AM_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0 +endif + +CCAS = ${srcdir}/yasm-wrapper +AM_CCASFLAGS = -f elf64 + + +##################### +## library definitions and dependencies + +EXTRALIBS = -luuid -lm -lkeyutils +if FREEBSD +EXTRALIBS += -lexecinfo +endif # FREEBSD + +if LINUX +EXTRALIBS += -lrt +endif # LINUX + +if WITH_PROFILER +EXTRALIBS += -lprofiler +endif # PROFILER + +LIBGLOBAL = libglobal.la +LIBCOMMON = libcommon.la +LIBARCH = libarch.la +LIBPERFGLUE = libperfglue.la +LIBAUTH = libauth.la +LIBMSG = libmsg.la +LIBCRUSH = libcrush.la +LIBJSON_SPIRIT = libjson_spirit.la +LIBLOG = liblog.la +LIBOS = libos.la +LIBOSD = libosd.la +LIBOSDC = libosdc.la +LIBMON = libmon.la +LIBMDS = libmds.la +LIBCLIENT = libclient.la +LIBCLIENT_FUSE = libclient_fuse.la +LIBRADOS = librados.la +LIBRGW = librgw.la +LIBRBD = librbd.la +LIBCEPHFS = libcephfs.la + +if WITH_LIBAIO +LIBOS += -laio +endif # WITH_LIBAIO + +if WITH_LIBZFS +LIBOS += libos_zfs.a -lzfs +endif # WITH_LIBZFS + +if WITH_TCMALLOC +LIBPERFGLUE += -ltcmalloc +endif # WITH_TCMALLOC + +if ENABLE_COVERAGE +EXTRALIBS += -lgcov +endif # ENABLE_COVERAGE + +# Libosd always needs osdc and os +LIBOSD += $(LIBOSDC) $(LIBOS) + +# These have references to syms like ceph_using_tcmalloc(), glue libperfglue to them +LIBMON += $(LIBPERFGLUE) +LIBOSD += $(LIBPERFGLUE) +LIBMDS += $(LIBPERFGLUE) + +# Always use system leveldb +LIBOS += -lleveldb -lsnappy + +# Use this for binaries requiring libglobal +CEPH_GLOBAL = $(LIBGLOBAL) $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) + +# This is set by [lib]/Makefile.am and used for build tests +LIBCOMMON_DEPS = +LIBRADOS_DEPS = +LIBRGW_DEPS = + +# This is used by the dencoder test +DENCODER_SOURCES = +DENCODER_DEPS = + + +radoslibdir = $(libdir)/rados-classes + diff --git a/src/Makefile.am b/src/Makefile.am index 3bdec278c6f..3520ca8d8f9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,1287 +1,137 @@ -AUTOMAKE_OPTIONS = gnu -SUBDIRS = ocf java -DIST_SUBDIRS = gtest ocf libs3 java - -EXTRA_DIST = \ - libs3/COPYING \ - libs3/ChangeLog \ - libs3/GNUmakefile \ - libs3/GNUmakefile.mingw \ - libs3/GNUmakefile.osx \ - libs3/INSTALL \ - libs3/LICENSE \ - libs3/README \ - libs3/TODO \ - libs3/archlinux \ - libs3/debian \ - libs3/doxyfile \ - libs3/inc \ - libs3/libs3.spec \ - libs3/mswin \ - libs3/src \ - libs3/test \ - unittest_bufferlist.sh \ - yasm-wrapper - -CLEANFILES = -bin_PROGRAMS = -# like bin_PROGRAMS, but these targets are only built for debug builds -bin_DEBUGPROGRAMS = -sbin_PROGRAMS = -# like sbin_SCRIPTS but can be used to install to e.g. /usr/sbin -ceph_sbindir = $(exec_prefix)$(sbindir) -ceph_sbin_SCRIPTS = \ - ceph-disk \ - ceph-disk-prepare \ - ceph-disk-activate \ - ceph-disk-udev \ - ceph-create-keys - -sbin_SCRIPTS = \ - mount.fuse.ceph - -bin_SCRIPTS = ceph ceph-run ceph-rest-api ceph-clsinfo ceph-debugpack ceph-rbdnamer ceph-post-file -dist_bin_SCRIPTS = -# C/C++ tests to build will be appended to this -check_PROGRAMS = -# tests to actually run on "make check"; if you need extra, non-test, -# executables built, you need to replace this with manual assignments -# target by target -TESTS = $(check_PROGRAMS) unittest_bufferlist.sh - -check-local: - $(srcdir)/test/encoding/check-generated.sh - $(srcdir)/test/encoding/readable.sh ../ceph-object-corpus - -EXTRALIBS = -luuid -if FREEBSD -EXTRALIBS += -lexecinfo -endif -if LINUX -EXTRALIBS += -lrt -endif -if WITH_PROFILER -EXTRALIBS += -lprofiler -endif - -LIBGLOBAL_LDA = libglobal.la $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) - -LIBOS_LDA = libos.a - -if WITH_LIBAIO -LIBOS_LDA += -laio -endif - -if WITH_LIBZFS -LIBOS_LDA += libos_zfs.a -lzfs -endif - -# use system leveldb -LIBOS_LDA += -lleveldb -lsnappy - -# monitor -ceph_mon_SOURCES = ceph_mon.cc common/TextTable.cc -ceph_mon_LDFLAGS = $(AM_LDFLAGS) -ceph_mon_LDADD = libmon.a $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_mon_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} +include Makefile-env.am + +SUBDIRS += ocf java +DIST_SUBDIRS += gtest ocf libs3 java + + +# subdirs + +include arch/Makefile.am +include auth/Makefile.am +include crush/Makefile.am +include mon/Makefile.am +include mds/Makefile.am +include os/Makefile.am +include osd/Makefile.am +include osdc/Makefile.am +include client/Makefile.am +include global/Makefile.am +include json_spirit/Makefile.am +include log/Makefile.am +include perfglue/Makefile.am +include common/Makefile.am +include msg/Makefile.am +include messages/Makefile.am +include include/Makefile.am +include librados/Makefile.am +include librbd/Makefile.am +include rgw/Makefile.am +include cls/Makefile.am +include key_value_store/Makefile.am +include test/Makefile.am +include tools/Makefile.am + + +# core daemons + +ceph_mon_SOURCES = ceph_mon.cc +ceph_mon_LDADD = $(LIBMON) $(LIBOS) $(CEPH_GLOBAL) bin_PROGRAMS += ceph-mon -ceph_mon_store_converter_SOURCES = mon_store_converter.cc \ - mon/MonitorStore.cc -ceph_mon_store_converter_LDFLAGS = ${AM_LDFLAGS} -ceph_mon_store_converter_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_mon_store_converter_CXXFLAGS = ${AM_CXXFLAGS} -bin_PROGRAMS += ceph_mon_store_converter - - -# osd ceph_osd_SOURCES = ceph_osd.cc -ceph_osd_LDADD = libosd.a libosdc.la $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_osd_CXXFLAGS = ${AM_CXXFLAGS} -bin_PROGRAMS += ceph-osd - +ceph_osd_LDADD = $(LIBOSD) $(CEPH_GLOBAL) if LINUX ceph_osd_LDADD += -ldl -endif +endif # LINUX +bin_PROGRAMS += ceph-osd -# mds ceph_mds_SOURCES = ceph_mds.cc -ceph_mds_LDADD = libmds.a libosdc.la $(LIBGLOBAL_LDA) +ceph_mds_LDADD = $(LIBMDS) $(LIBOSDC) $(CEPH_GLOBAL) bin_PROGRAMS += ceph-mds -ceph_mds_CXXFLAGS = ${AM_CXXFLAGS} + # admin tools -ceph_conf_SOURCES = ceph_conf.cc -ceph_conf_LDADD = $(LIBGLOBAL_LDA) -ceph_conf_CXXFLAGS = ${AM_CXXFLAGS} -ceph_authtool_SOURCES = ceph_authtool.cc -ceph_authtool_LDADD = $(LIBGLOBAL_LDA) -ceph_filestore_dump_SOURCES = tools/ceph-filestore-dump.cc -ceph_filestore_dump_SOURCES += perfglue/disabled_heap_profiler.cc -ceph_filestore_dump_LDADD = libosd.a libosdc.la $(LIBOS_LDA) $(LIBGLOBAL_LDA) -lboost_program_options -if LINUX -ceph_filestore_dump_LDADD += -ldl -endif -bin_PROGRAMS += ceph-conf ceph-authtool ceph_filestore_dump - -ceph_osdomap_tool_SOURCES = tools/ceph-osdomap-tool.cc \ - os/LevelDBStore.cc -ceph_osdomap_tool_LDFLAGS = ${AM_LDFLAGS} -ceph_osdomap_tool_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -lboost_program_options -ceph_osdomap_tool_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph-osdomap-tool - -ceph_monstore_tool_SOURCES = tools/ceph-monstore-tool.cc \ - os/LevelDBStore.cc -ceph_monstore_tool_LDFLAGS = ${AM_LDFLAGS} -ceph_monstore_tool_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -lboost_program_options -ceph_monstore_tool_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph-monstore-tool - -monmaptool_SOURCES = monmaptool.cc -monmaptool_LDADD = $(LIBGLOBAL_LDA) -crushtool_SOURCES = crushtool.cc -crushtool_LDADD = $(LIBGLOBAL_LDA) -osdmaptool_SOURCES = osdmaptool.cc -osdmaptool_LDADD = $(LIBGLOBAL_LDA) -bin_PROGRAMS += monmaptool crushtool osdmaptool - -rgw_dencoder_src = rgw/rgw_dencoder.cc \ - rgw/rgw_acl.cc \ - rgw/rgw_common.cc \ - rgw/rgw_env.cc \ - rgw/rgw_json_enc.cc - -ceph_dencoder_SOURCES = test/encoding/ceph_dencoder.cc ${rgw_dencoder_src} perfglue/disabled_heap_profiler.cc -ceph_dencoder_CXXFLAGS = ${AM_CXXFLAGS} -ceph_dencoder_LDADD = $(LIBGLOBAL_LDA) libcls_lock_client.a \ - libcls_rgw_client.a \ - libcls_replica_log_client.a \ - libcls_refcount_client.a \ - libosd.a libmds.a libosdc.la $(LIBOS_LDA) libmon.a -bin_PROGRAMS += ceph-dencoder - -mount_ceph_SOURCES = mount/mount.ceph.c common/armor.c common/safe_io.c common/secret.c include/addr_parsing.c -mount_ceph_LDADD = -lkeyutils + +# user tools + +mount_ceph_SOURCES = mount/mount.ceph.c +mount_ceph_LDADD = $(LIBCOMMON) if LINUX sbin_PROGRAMS += mount.ceph -endif +endif # LINUX +sbin_SCRIPTS += mount.fuse.ceph -# user tools cephfs_SOURCES = cephfs.cc -cephfs_LDADD = libcommon.la +cephfs_LDADD = $(LIBCOMMON) bin_PROGRAMS += cephfs librados_config_SOURCES = librados-config.cc -librados_config_LDADD = librados.la $(LIBGLOBAL_LDA) +librados_config_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) bin_PROGRAMS += librados-config -# synthetic client -ceph_syn_SOURCES = ceph_syn.cc client/SyntheticClient.cc -ceph_syn_LDADD = libclient.la $(LIBGLOBAL_LDA) +ceph_syn_SOURCES = ceph_syn.cc +ceph_syn_SOURCES += client/SyntheticClient.cc # uses g_conf.. needs cleanup +ceph_syn_LDADD = $(LIBCLIENT) $(CEPH_GLOBAL) bin_PROGRAMS += ceph-syn -base: ceph-mon ceph-osd ceph-mds \ - cephfs \ - ceph-syn \ - rados radosgw librados-config \ - ceph-conf monmaptool osdmaptool crushtool ceph-authtool \ - init-ceph mkcephfs mon_store_converter ceph-post-file +rbd_SOURCES = rbd.cc +rbd_LDADD = $(LIBRBD) $(LIBRADOS) $(CEPH_GLOBAL) +if LINUX +bin_PROGRAMS += rbd +endif #LINUX + + +# Fuse targets -# fuse targets? if WITH_FUSE -ceph_fuse_SOURCES = ceph_fuse.cc client/fuse_ll.cc -ceph_fuse_LDADD = -lfuse libclient.la $(LIBGLOBAL_LDA) -ceph_fuse_CXXFLAGS = ${AM_CXXFLAGS} +ceph_fuse_SOURCES = ceph_fuse.cc +ceph_fuse_LDADD = $(LIBCLIENT_FUSE) $(CEPH_GLOBAL) bin_PROGRAMS += ceph-fuse rbd_fuse_SOURCES = rbd_fuse/rbd-fuse.c -rbd_fuse_LDADD = -lfuse librados.la librbd.la $(LIBGLOBAL_LDA) -rbd_fuse_CXXFLAGS = ${AM_CXXFLAGS} +rbd_fuse_LDADD = -lfuse $(LIBRBD) $(LIBRADOS) $(CEPH_GLOBAL) bin_PROGRAMS += rbd-fuse +endif # WITH_FUSE -endif -# tcmalloc? -if WITH_TCMALLOC -tcmalloc_safety_flags = -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -ceph_osd_LDADD += -ltcmalloc -ceph_osd_CXXFLAGS += ${tcmalloc_safety_flags} -ceph_osd_SOURCES += perfglue/heap_profiler.cc -ceph_mds_LDADD += -ltcmalloc -ceph_mds_CXXFLAGS += ${tcmalloc_safety_flags} -ceph_mds_SOURCES += perfglue/heap_profiler.cc -ceph_mon_LDADD += -ltcmalloc -ceph_mon_CXXFLAGS += ${tcmalloc_safety_flags} -ceph_mon_SOURCES += perfglue/heap_profiler.cc -if WITH_FUSE -ceph_fuse_LDADD += -ltcmalloc -ceph_fuse_CXXFLAGS += ${tcmalloc_safety_flags} -endif #WITH_FUSE -else -ceph_osd_SOURCES += perfglue/disabled_heap_profiler.cc -ceph_mds_SOURCES += perfglue/disabled_heap_profiler.cc -ceph_mon_SOURCES += perfglue/disabled_heap_profiler.cc -endif # WITH_TCMALLOC - -# debug targets -ceph_psim_SOURCES = psim.cc -ceph_psim_LDADD = $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_psim - -ceph_test_mutate_SOURCES = test/test_mutate.cc -ceph_test_mutate_LDADD = librados.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_mutate - -ceph_test_rewrite_latency_SOURCES = test/test_rewrite_latency.cc -ceph_test_rewrite_latency_LDADD = libcommon.la $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -bin_DEBUGPROGRAMS += ceph_test_rewrite_latency - -ceph_test_msgr_SOURCES = testmsgr.cc -ceph_test_msgr_LDADD = $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_msgr - -ceph_test_ioctls_SOURCES = client/test_ioctls.c -bin_DEBUGPROGRAMS += ceph_test_ioctls - -ceph_dupstore_SOURCES = dupstore.cc -ceph_dupstore_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -ceph_dupstore_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_streamtest_SOURCES = streamtest.cc -ceph_streamtest_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -ceph_streamtest_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_dupstore ceph_streamtest - -ceph_test_trans_SOURCES = test_trans.cc -ceph_test_trans_CXXFLAGS= ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -ceph_test_trans_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_trans - -ceph_test_rados_SOURCES = test/osd/TestRados.cc test/osd/TestOpStat.cc test/osd/Object.cc test/osd/RadosModel.cc -ceph_test_rados_LDADD = librados.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_rados - -ceph_smalliobench_SOURCES = test/bench/small_io_bench.cc test/bench/rados_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc -ceph_smalliobench_LDADD = librados.la -lboost_program_options $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_smalliobench - -ceph_smalliobenchfs_SOURCES = test/bench/small_io_bench_fs.cc test/bench/testfilestore_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc -ceph_smalliobenchfs_LDADD = librados.la -lboost_program_options $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_smalliobenchfs_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_smalliobenchfs - -ceph_smalliobenchdumb_SOURCES = test/bench/small_io_bench_dumb.cc test/bench/dumb_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc -ceph_smalliobenchdumb_LDADD = librados.la -lboost_program_options $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_smalliobenchdumb_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_smalliobenchdumb - -ceph_smalliobenchrbd_SOURCES = test/bench/small_io_bench_rbd.cc test/bench/rbd_backend.cc test/bench/detailed_stat_collector.cc test/bench/bencher.cc -ceph_smalliobenchrbd_LDADD = librados.la librbd.la -lboost_program_options $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_smalliobenchrbd - -ceph_tpbench_SOURCES = test/bench/tp_bench.cc test/bench/detailed_stat_collector.cc -ceph_tpbench_LDADD = librados.la -lboost_program_options $(LIBOS_LDA) $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_tpbench - -ceph_omapbench_SOURCES = test/omap_bench.cc -ceph_omapbench_LDADD = librados.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_omapbench - -ceph_kvstorebench_SOURCES = test/kv_store_bench.cc key_value_store/kv_flat_btree_async.cc -ceph_kvstorebench_LDADD = librados.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_kvstorebench - -ceph_multi_stress_watch_SOURCES = test/multi_stress_watch.cc test/librados/test.cc -ceph_multi_stress_watch_LDADD = librados.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_multi_stress_watch - -if WITH_BUILD_TESTS -ceph_test_libcommon_build_SOURCES = test/test_libcommon_build.cc $(libcommon_files) -ceph_test_libcommon_build_LDADD = $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -bin_DEBUGPROGRAMS += ceph_test_libcommon_build - -ceph_test_librados_build_SOURCES = test/test_libcommon_build.cc $(libcommon_files) $(librados_SOURCES) -ceph_test_librados_build_LDADD = $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -ceph_test_librados_build_CXXFLAGS = $(AM_CXXFLAGS) -bin_DEBUGPROGRAMS += ceph_test_librados_build - -ceph_test_librgw_build_SOURCES = test/test_libcommon_build.cc $(libcommon_files) \ - $(librados_SOURCES) $(librgw_la_SOURCES) -ceph_test_librgw_build_LDADD = -lexpat $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -ceph_test_librgw_build_CXXFLAGS = $(AM_CXXFLAGS) -bin_DEBUGPROGRAMS += ceph_test_librgw_build - -ceph_test_libcephfs_build_SOURCES = test/test_libcommon_build.cc $(libcommon_files) \ - $(libosdc_la_SOURCES) -ceph_test_libcephfs_build_LDADD = libcephfs.la -lexpat $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -ceph_test_libcephfs_build_CXXFLAGS = $(AM_CXXFLAGS) -bin_DEBUGPROGRAMS += ceph_test_libcephfs_build -endif +# libcephfs (this and libhadoopcephfs should go somewhere else in the future) -if WITH_HADOOPCLIENT -ceph_test_libhadoopcephfs_build_SOURCES = test/test_libcommon_build.cc \ - $(libhadoopcephfs_la_SOURCES) \ - $(libosdc_la_SOURCES) $(libcommon_files) -ceph_test_libhadoopcephfs_build_LDADD = libcephfs.la -lexpat $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -ceph_test_libhadoopcephfs_build_CXXFLAGS = $(AM_CXXFLAGS) -bin_DEBUGPROGRAMS += ceph_test_libhadoopcephfs_build -endif - -########## -BUILT_SOURCES = -lib_LTLIBRARIES = -noinst_LTLIBRARIES = -noinst_LIBRARIES = - -# libcephfs -libcephfs_la_SOURCES = \ - libcephfs.cc -libcephfs_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS} -libcephfs_la_CXXFLAGS= ${AM_CXXFLAGS} -libcephfs_la_LIBADD = libclient.la -libcephfs_la_LDFLAGS = $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) \ - ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '^ceph_.*' +libcephfs_la_SOURCES = libcephfs.cc +libcephfs_la_LIBADD = $(LIBCLIENT) $(LIBCOMMON) $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +libcephfs_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '^ceph_.*' lib_LTLIBRARIES += libcephfs.la -ceph_test_timers_SOURCES = test/TestTimers.cc -ceph_test_timers_LDADD = $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_timers - -ceph_test_signal_handlers_SOURCES = test/TestSignalHandlers.cc -ceph_test_signal_handlers_LDADD = $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_signal_handlers - -# librados -librados_SOURCES = \ - librados/librados.cc \ - librados/RadosClient.cc \ - librados/IoCtxImpl.cc \ - osdc/Objecter.cc \ - osdc/Striper.cc \ - cls/lock/cls_lock_client.cc \ - cls/lock/cls_lock_types.cc \ - cls/lock/cls_lock_ops.cc -librados_la_SOURCES = ${librados_SOURCES} -librados_la_CFLAGS = ${CRYPTO_CFLAGS} ${AM_CFLAGS} -librados_la_CXXFLAGS = ${AM_CXXFLAGS} -librados_la_LIBADD = libcommon.la $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) -librados_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0 -export-symbols-regex '^rados_.*' -lib_LTLIBRARIES += librados.la - -if WITH_RADOSGW - -# rgw -librgw_a_SOURCES = \ - rgw/librgw.cc \ - rgw/rgw_acl.cc \ - rgw/rgw_acl_s3.cc \ - rgw/rgw_acl_swift.cc \ - rgw/rgw_client_io.cc \ - rgw/rgw_fcgi.cc \ - rgw/rgw_xml.cc \ - rgw/rgw_usage.cc \ - rgw/rgw_json_enc.cc \ - rgw/rgw_user.cc \ - rgw/rgw_bucket.cc\ - rgw/rgw_tools.cc \ - rgw/rgw_rados.cc \ - rgw/rgw_http_client.cc \ - rgw/rgw_rest_client.cc \ - rgw/rgw_rest_conn.cc \ - rgw/rgw_op.cc \ - rgw/rgw_common.cc \ - rgw/rgw_cache.cc \ - rgw/rgw_formats.cc \ - rgw/rgw_log.cc \ - rgw/rgw_multi.cc \ - rgw/rgw_policy_s3.cc \ - rgw/rgw_gc.cc \ - rgw/rgw_multi_del.cc \ - rgw/rgw_env.cc \ - rgw/rgw_cors.cc \ - rgw/rgw_cors_s3.cc \ - rgw/rgw_auth_s3.cc \ - rgw/rgw_metadata.cc \ - rgw/rgw_replica_log.cc \ - rgw/rgw_keystone.cc -librgw_a_CFLAGS = ${CRYPTO_CFLAGS} ${AM_CFLAGS} -librgw_a_CXXFLAGS = -Woverloaded-virtual ${AM_CXXFLAGS} -noinst_LIBRARIES += librgw.a - -my_radosgw_ldadd = \ - librgw.a librados.la libcls_rgw_client.a libcls_log_client.a \ - libcls_statelog_client.a libcls_replica_log_client.a libcls_lock_client.a \ - libcls_refcount_client.a libcls_version_client.a -lcurl -lexpat \ - $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) $(LIBGLOBAL_LDA) - -radosgw_SOURCES = \ - rgw/rgw_resolve.cc \ - rgw/rgw_rest.cc \ - rgw/rgw_rest_swift.cc \ - rgw/rgw_rest_s3.cc \ - rgw/rgw_rest_usage.cc \ - rgw/rgw_rest_user.cc \ - rgw/rgw_rest_bucket.cc \ - rgw/rgw_rest_metadata.cc \ - rgw/rgw_replica_log.cc \ - rgw/rgw_rest_log.cc \ - rgw/rgw_rest_opstate.cc \ - rgw/rgw_rest_replica_log.cc \ - rgw/rgw_rest_config.cc \ - rgw/rgw_http_client.cc \ - rgw/rgw_swift.cc \ - rgw/rgw_swift_auth.cc \ - rgw/rgw_main.cc -radosgw_LDADD = $(my_radosgw_ldadd) -lfcgi -lresolv -radosgw_CXXFLAGS = ${AM_CXXFLAGS} -bin_PROGRAMS += radosgw - -radosgw_admin_SOURCES = rgw/rgw_admin.cc -radosgw_admin_CXXFLAGS = ${AM_CXXFLAGS} -radosgw_admin_LDADD = $(my_radosgw_ldadd) -bin_PROGRAMS += radosgw-admin - -ceph_rgw_multiparser_SOURCES = rgw/rgw_multiparser.cc -ceph_rgw_multiparser_CXXFLAGS = ${AM_CXXFLAGS} -ceph_rgw_multiparser_LDADD = $(my_radosgw_ldadd) -bin_DEBUGPROGRAMS += ceph_rgw_multiparser - -ceph_rgw_jsonparser_SOURCES = rgw/rgw_jsonparser.cc rgw/rgw_common.cc rgw/rgw_env.cc rgw/rgw_json_enc.cc -ceph_rgw_jsonparser_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -ceph_rgw_jsonparser_LDADD = $(my_radosgw_ldadd) -bin_DEBUGPROGRAMS += ceph_rgw_jsonparser - -endif - -# librbd -librbd_la_SOURCES = \ - librbd/librbd.cc \ - librbd/AioCompletion.cc \ - librbd/AioRequest.cc \ - cls/rbd/cls_rbd_client.cc \ - librbd/ImageCtx.cc \ - librbd/internal.cc \ - librbd/LibrbdWriteback.cc \ - librbd/WatchCtx.cc \ - osdc/ObjectCacher.cc \ - osdc/Striper.cc \ - librados/snap_set_diff.cc \ - cls/lock/cls_lock_client.cc \ - cls/lock/cls_lock_types.cc \ - cls/lock/cls_lock_ops.cc \ - common/util.cc -librbd_la_CFLAGS = ${AM_CFLAGS} ${CRYPTO_CFLAGS} -librbd_la_CXXFLAGS = ${AM_CXXFLAGS} -librbd_la_LIBADD = librados.la -librbd_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 \ - -export-symbols-regex '^rbd_.*' $(PTHREAD_LIBS) $(EXTRALIBS) -lib_LTLIBRARIES += librbd.la - -rados_SOURCES = rados.cc rados_import.cc rados_export.cc rados_sync.cc common/obj_bencher.cc -rados_LDADD = libcls_lock_client.a librados.la $(LIBGLOBAL_LDA) -bin_PROGRAMS += rados - -if WITH_REST_BENCH - -rest_bench_SOURCES = tools/rest_bench.cc common/obj_bencher.cc -rest_bench_LDADD = $(LIBGLOBAL_LDA) -rest_bench_CXXFLAGS = ${AM_CXXFLAGS} -bin_PROGRAMS += rest-bench - -if WITH_SYSTEM_LIBS3 -rest_bench_LDADD += -ls3 -else -rest_bench_LDADD += libs3/build/lib/libs3.a -lcurl -lxml2 -rest_bench_CXXFLAGS += -I$(top_srcdir)/src/libs3/inc -SUBDIRS += libs3 -endif - -endif - -ceph_scratchtool_SOURCES = scratchtool.c -ceph_scratchtool_LDADD = librados.la $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -ceph_scratchtoolpp_SOURCES = scratchtoolpp.cc -ceph_scratchtoolpp_LDADD = librados.la $(PTHREAD_LIBS) -lm -ceph_radosacl_SOURCES = radosacl.cc -ceph_radosacl_LDADD = librados.la $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -bin_DEBUGPROGRAMS += ceph_scratchtool ceph_scratchtoolpp ceph_radosacl - -rbd_SOURCES = rbd.cc common/secret.c common/TextTable.cc common/util.cc -rbd_CXXFLAGS = ${AM_CXXFLAGS} -rbd_LDADD = librbd.la librados.la $(LIBGLOBAL_LDA) -lkeyutils -if LINUX -bin_PROGRAMS += rbd -endif - - -ceph_test_crypto_SOURCES = testcrypto.cc -ceph_test_crypto_LDADD = $(LIBGLOBAL_LDA) -ceph_test_crypto_CXXFLAGS = ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_crypto - -ceph_test_keys_SOURCES = testkeys.cc -ceph_test_keys_LDADD = libmon.a $(LIBGLOBAL_LDA) -ceph_test_keys_CXXFLAGS = ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_keys - -if WITH_TCMALLOC -ceph_test_keys_LDADD += -ltcmalloc -ceph_test_keys_CXXFLAGS += ${tcmalloc_safety_flags} -ceph_test_keys_SOURCES += perfglue/heap_profiler.cc -endif - - -## rados object classes - -radoslibdir = $(libdir)/rados-classes -radoslib_LTLIBRARIES = - -# hello world class -libcls_hello_la_SOURCES = cls/hello/cls_hello.cc -libcls_hello_la_CFLAGS = ${AM_CFLAGS} -libcls_hello_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_hello_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_hello_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_hello.la - -# rbd: rados block device class -libcls_rbd_la_SOURCES = cls/rbd/cls_rbd.cc -libcls_rbd_la_CFLAGS = ${AM_CFLAGS} -libcls_rbd_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_rbd_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_rbd_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_rbd.la - -# lock class -libcls_lock_la_SOURCES = cls/lock/cls_lock.cc -libcls_lock_la_CFLAGS = ${AM_CFLAGS} -libcls_lock_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_lock_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_lock_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' -radoslib_LTLIBRARIES += libcls_lock.la - -# refcount class -libcls_refcount_la_SOURCES = \ - cls/refcount/cls_refcount.cc \ - cls/refcount/cls_refcount_ops.cc \ - common/ceph_json.cc \ - json_spirit/json_spirit_reader.cpp \ - json_spirit/json_spirit_writer.cpp \ - json_spirit/json_spirit_value.cpp -libcls_refcount_la_CFLAGS = ${AM_CFLAGS} -libcls_refcount_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_refcount_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_refcount_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_refcount.la - -# version class -libcls_version_la_SOURCES = cls/version/cls_version.cc -libcls_version_la_CFLAGS = ${AM_CFLAGS} -libcls_version_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_version_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_version_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_version.la - -# log class -libcls_log_la_SOURCES = cls/log/cls_log.cc -libcls_log_la_CFLAGS = ${AM_CFLAGS} -libcls_log_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_log_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_log_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_log.la - -libcls_statelog_la_SOURCES = cls/statelog/cls_statelog.cc -libcls_statelog_la_CFLAGS = ${AM_CFLAGS} -libcls_statelog_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_statelog_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_statelog_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_statelog.la - -# replica log class -libcls_replica_log_la_SOURCES = cls/replica_log/cls_replica_log.cc -libcls_replica_log_la_CFLAGS = ${AM_CFLAGS} -libcls_replica_log_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_replica_log_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_replica_log_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_replica_log.la - -# rgw: rados gateway -libcls_rgw_la_SOURCES = \ - cls/rgw/cls_rgw.cc \ - cls/rgw/cls_rgw_ops.cc \ - cls/rgw/cls_rgw_types.cc \ - common/ceph_json.cc \ - json_spirit/json_spirit_reader.cpp \ - json_spirit/json_spirit_writer.cpp \ - json_spirit/json_spirit_value.cpp -libcls_rgw_la_CFLAGS = ${AM_CFLAGS} -libcls_rgw_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_rgw_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_rgw_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_rgw.la - -libcls_lock_client_a_SOURCES = \ - cls/lock/cls_lock_client.cc \ - cls/lock/cls_lock_types.cc \ - cls/lock/cls_lock_ops.cc -noinst_LIBRARIES += libcls_lock_client.a - -libcls_refcount_client_a_SOURCES = \ - cls/refcount/cls_refcount_client.cc \ - cls/refcount/cls_refcount_ops.cc -noinst_LIBRARIES += libcls_refcount_client.a - -libcls_version_client_a_SOURCES = \ - cls/version/cls_version_client.cc \ - cls/version/cls_version_types.cc -noinst_LIBRARIES += libcls_version_client.a - -libcls_log_client_a_SOURCES = \ - cls/log/cls_log_client.cc -noinst_LIBRARIES += libcls_log_client.a - -libcls_statelog_client_a_SOURCES = \ - cls/statelog/cls_statelog_client.cc -noinst_LIBRARIES += libcls_statelog_client.a - -libcls_replica_log_client_a_SOURCES = \ - cls/replica_log/cls_replica_log_types.cc \ - cls/replica_log/cls_replica_log_ops.cc \ - cls/replica_log/cls_replica_log_client.cc -noinst_LIBRARIES += libcls_replica_log_client.a - -libcls_rgw_client_a_SOURCES = \ - cls/rgw/cls_rgw_client.cc \ - cls/rgw/cls_rgw_types.cc \ - cls/rgw/cls_rgw_ops.cc -noinst_LIBRARIES += libcls_rgw_client.a - -## hadoop client +# order matters! this *must* come after libcephfs, or else you'll encounter something +# like "error: relink libhadoopcephfs.la with the above command before installing it" if WITH_HADOOPCLIENT JAVA_BASE = /usr/lib/jvm/java-6-sun libhadoopcephfs_la_SOURCES = client/hadoop/CephFSInterface.cc -libhadoopcephfs_la_LIBADD = libcephfs.la -libhadoopcephfs_la_CFLAGS = ${AM_CFLAGS} -libhadoopcephfs_la_CXXFLAGS = ${AM_CXXFLAGS} +libhadoopcephfs_la_LIBADD = $(LIBCEPHFS) libhadoopcephfs_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex 'hadoopcephfs_.*' lib_LTLIBRARIES += libhadoopcephfs.la +noinst_HEADERS += client/hadoop/CephFSInterface.h +endif # WITH_HADOOPCLIENT -endif -## CephFS Java Wrappers -## - The JNI library is here -## - The Java source Makefile.am is in src/java +# jni library (java source is in src/java) + if ENABLE_CEPHFS_JAVA libcephfs_jni_la_SOURCES = \ java/native/libcephfs_jni.cc \ java/native/ScopedLocalRef.h \ java/native/JniConstants.cpp \ java/native/JniConstants.h -libcephfs_jni_la_LIBADD = libcephfs.la $(EXTRALIBS) +libcephfs_jni_la_LIBADD = $(LIBCEPHFS) $(EXTRALIBS) libcephfs_jni_la_CPPFLAGS = $(JDK_CPPFLAGS) -libcephfs_jni_la_CXXFLAGS = ${AM_CXXFLAGS} libcephfs_jni_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 lib_LTLIBRARIES += libcephfs_jni.la endif -## key_value_store classes - -# key_value_store: key value store class -libcls_kvs_la_SOURCES = key_value_store/cls_kvs.cc -libcls_kvs_la_CFLAGS = ${AM_CFLAGS} -libcls_kvs_la_CXXFLAGS= ${AM_CXXFLAGS} -libcls_kvs_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) -libcls_kvs_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' - -radoslib_LTLIBRARIES += libcls_kvs.la - -## System tests -libsystest_la_SOURCES = \ - test/system/cross_process_sem.cc \ - test/system/systest_runnable.cc \ - test/system/systest_settings.cc -libsystest_la_LIBADD = $(LIBGLOBAL_LDA) -noinst_LTLIBRARIES += libsystest.la - -ceph_test_rados_list_parallel_SOURCES = \ - test/system/rados_list_parallel.cc \ - test/system/st_rados_create_pool.cc \ - test/system/st_rados_list_objects.cc -ceph_test_rados_list_parallel_LDADD = libsystest.la librados.la $(PTHREAD_LIBS) -bin_DEBUGPROGRAMS += ceph_test_rados_list_parallel - -ceph_test_rados_open_pools_parallel_SOURCES = \ - test/system/rados_open_pools_parallel.cc \ - test/system/st_rados_create_pool.cc -ceph_test_rados_open_pools_parallel_LDADD = libsystest.la librados.la $(PTHREAD_LIBS) -bin_DEBUGPROGRAMS += ceph_test_rados_open_pools_parallel - -ceph_test_rados_delete_pools_parallel_SOURCES = \ - test/system/rados_delete_pools_parallel.cc \ - test/system/st_rados_create_pool.cc \ - test/system/st_rados_delete_pool.cc \ - test/system/st_rados_list_objects.cc -ceph_test_rados_delete_pools_parallel_LDADD = libsystest.la librados.la $(PTHREAD_LIBS) -bin_DEBUGPROGRAMS += ceph_test_rados_delete_pools_parallel - -ceph_test_rados_watch_notify_SOURCES = \ - test/system/rados_watch_notify.cc \ - test/system/st_rados_create_pool.cc \ - test/system/st_rados_delete_pool.cc \ - test/system/st_rados_delete_objs.cc \ - test/system/st_rados_watch.cc \ - test/system/st_rados_notify.cc -ceph_test_rados_watch_notify_LDADD = libsystest.la librados.la $(PTHREAD_LIBS) -bin_DEBUGPROGRAMS += ceph_test_rados_watch_notify - -ceph_bench_log_SOURCES = \ - test/bench_log.cc -ceph_bench_log_LDADD = libcommon.la $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_bench_log - -## unit tests - -# target to build but not run the unit tests -unittests:: $(check_PROGRAMS) - -UNITTEST_CXXFLAGS = \ - -I$(top_srcdir)/src/gtest/include \ - -I$(top_builddir)/src/gtest/include -UNITTEST_STATIC_LDADD = \ - $(top_builddir)/src/gtest/lib/libgtest.a \ - $(top_builddir)/src/gtest/lib/libgtest_main.a \ - $(PTHREAD_LIBS) -UNITTEST_LDADD = ${UNITTEST_STATIC_LDADD} - -unittest_encoding_SOURCES = test/encoding.cc -unittest_encoding_LDADD = libcephfs.la librados.la $(PTHREAD_LIBS) -lm \ - ${UNITTEST_LDADD} -unittest_encoding_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} \ - -fno-strict-aliasing -check_PROGRAMS += unittest_encoding - -unittest_addrs_SOURCES = test/test_addrs.cc -unittest_addrs_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_addrs_LDADD = $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -check_PROGRAMS += unittest_addrs - -unittest_sharedptr_registry_SOURCES = test/common/test_sharedptr_registry.cc -unittest_sharedptr_registry_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_sharedptr_registry_LDADD = libcommon.la ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -check_PROGRAMS += unittest_sharedptr_registry - -unittest_util_SOURCES = test/common/test_util.cc common/util.cc -unittest_util_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_util_LDADD = libcommon.la $(PTHREAD_LIBS) -lm ${UNITTEST_LDADD} $(CRYPTO_LIBS) $(EXTRALIBS) -check_PROGRAMS += unittest_util - -unittest_workqueue_SOURCES = test/test_workqueue.cc -unittest_workqueue_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_workqueue_LDADD = $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -check_PROGRAMS += unittest_workqueue - -unittest_striper_SOURCES = test/test_striper.cc -unittest_striper_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_striper_LDADD = libosdc.la $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -check_PROGRAMS += unittest_striper - -unittest_prebufferedstreambuf_SOURCES = test/test_prebufferedstreambuf.cc common/PrebufferedStreambuf.cc -unittest_prebufferedstreambuf_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_prebufferedstreambuf_LDADD = ${UNITTEST_LDADD} $(EXTRALIBS) -check_PROGRAMS += unittest_prebufferedstreambuf - -unittest_str_list_SOURCES = test/test_str_list.cc -unittest_str_list_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_str_list_LDADD = $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -check_PROGRAMS += unittest_str_list - -unittest_log_SOURCES = log/test.cc common/PrebufferedStreambuf.cc -unittest_log_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_log_LDADD = libcommon.la ${UNITTEST_LDADD} -unittest_log_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -O2 -check_PROGRAMS += unittest_log - -unittest_throttle_SOURCES = test/common/Throttle.cc -unittest_throttle_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_throttle_LDADD = libcommon.la ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -unittest_throttle_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -O2 -check_PROGRAMS += unittest_throttle - -unittest_base64_SOURCES = test/base64.cc -unittest_base64_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_base64_LDADD = libcephfs.la -lm ${UNITTEST_LDADD} -unittest_base64_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_base64 - -unittest_ceph_argparse_SOURCES = test/ceph_argparse.cc -unittest_ceph_argparse_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_ceph_argparse_LDADD = $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -unittest_ceph_argparse_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_ceph_argparse - -unittest_osd_types_SOURCES = test/test_osd_types.cc -unittest_osd_types_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_osd_types_LDADD = $(LIBGLOBAL_LDA) libcommon.la ${UNITTEST_LDADD} -check_PROGRAMS += unittest_osd_types - -unittest_pglog_SOURCES = test/osd/TestPGLog.cc perfglue/disabled_heap_profiler.cc -unittest_pglog_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -unittest_pglog_LDADD = libosd.a libosdc.la $(LIBOS_LDA) $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} -check_PROGRAMS += unittest_pglog - -if LINUX -unittest_pglog_LDADD += -ldl -endif - -unittest_gather_SOURCES = test/gather.cc -unittest_gather_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -unittest_gather_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_gather - -unittest_run_cmd_SOURCES = test/run_cmd.cc -unittest_run_cmd_LDADD = libcephfs.la ${UNITTEST_LDADD} -unittest_run_cmd_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_run_cmd - -unittest_signals_SOURCES = test/signals.cc -unittest_signals_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -unittest_signals_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_signals - -unittest_simple_spin_SOURCES = test/simple_spin.cc -unittest_simple_spin_LDADD = libcephfs.la ${UNITTEST_LDADD} -unittest_simple_spin_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_simple_spin - -unittest_librados_SOURCES = test/librados/librados.cc -unittest_librados_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_librados_LDADD = librados.la ${UNITTEST_LDADD} -unittest_librados_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_librados - -unittest_bufferlist_SOURCES = test/bufferlist.cc -unittest_bufferlist_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_bufferlist_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_bufferlist - -unittest_crypto_SOURCES = test/crypto.cc -unittest_crypto_LDFLAGS = ${CRYPTO_LDFLAGS} ${AM_LDFLAGS} -unittest_crypto_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -unittest_crypto_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_crypto - -unittest_perf_counters_SOURCES = test/perf_counters.cc -unittest_perf_counters_LDFLAGS = ${AM_LDFLAGS} -unittest_perf_counters_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} -unittest_perf_counters_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_perf_counters - -unittest_admin_socket_SOURCES = test/admin_socket.cc -unittest_admin_socket_LDFLAGS = ${AM_LDFLAGS} -unittest_admin_socket_LDADD = ${LIBGLOBAL_LDA} ${UNITTEST_LDADD} libcommon.la -unittest_admin_socket_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_admin_socket - -unittest_ceph_crypto_SOURCES = test/ceph_crypto.cc -unittest_ceph_crypto_LDFLAGS = ${CRYPTO_LDFLAGS} ${AM_LDFLAGS} -unittest_ceph_crypto_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_ceph_crypto_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_ceph_crypto - -unittest_utf8_SOURCES = test/utf8.cc -unittest_utf8_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_utf8_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_utf8_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_utf8 - -unittest_mime_SOURCES = test/mime.cc -unittest_mime_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_mime_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_mime_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_mime - -unittest_escape_SOURCES = test/escape.cc -unittest_escape_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_escape_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_escape_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_escape - -unittest_chain_xattr_SOURCES = test/filestore/chain_xattr.cc -unittest_chain_xattr_LDFLAGS = ${AM_LDFLAGS} -unittest_chain_xattr_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -unittest_chain_xattr_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -check_PROGRAMS += unittest_chain_xattr - -unittest_flatindex_SOURCES = test/os/TestFlatIndex.cc -unittest_flatindex_LDFLAGS = ${AM_LDFLAGS} -unittest_flatindex_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -unittest_flatindex_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -check_PROGRAMS += unittest_flatindex - -unittest_strtol_SOURCES = test/strtol.cc -unittest_strtol_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_strtol_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_strtol_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_strtol - -unittest_confutils_SOURCES = test/confutils.cc -unittest_confutils_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_confutils_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_confutils_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_confutils - -unittest_heartbeatmap_SOURCES = test/heartbeat_map.cc common/HeartbeatMap.cc -unittest_heartbeatmap_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_heartbeatmap_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_heartbeatmap_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_heartbeatmap - -unittest_formatter_SOURCES = test/formatter.cc rgw/rgw_formats.cc -unittest_formatter_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_formatter_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_formatter_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_formatter - -unittest_libcephfs_config_SOURCES = test/libcephfs_config.cc -unittest_libcephfs_config_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_libcephfs_config_LDADD = libcephfs.la ${UNITTEST_LDADD} -unittest_libcephfs_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_libcephfs_config - -unittest_lfnindex_SOURCES = test/os/TestLFNIndex.cc -unittest_lfnindex_LDFLAGS = ${AM_LDFLAGS} -unittest_lfnindex_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -unittest_lfnindex_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -check_PROGRAMS += unittest_lfnindex - -unittest_librados_config_SOURCES = test/librados/librados_config.cc -unittest_librados_config_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_librados_config_LDADD = librados.la ${UNITTEST_LDADD} -unittest_librados_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_librados_config - -#unittest_librgw_link_SOURCES = test/librgw_link.cc -#unittest_librgw_link_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -#unittest_librgw_link_LDADD = librgw.la ${UNITTEST_LDADD} -#unittest_librgw_link_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -#check_PROGRAMS += unittest_librgw_link - -unittest_daemon_config_SOURCES = test/daemon_config.cc -unittest_daemon_config_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_daemon_config_LDADD = ${UNITTEST_LDADD} ${LIBGLOBAL_LDA} -unittest_daemon_config_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_daemon_config - -unittest_osd_osdcap_SOURCES = test/osd/osdcap.cc osd/OSDCap.cc -unittest_osd_osdcap_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_osd_osdcap_LDADD = ${UNITTEST_LDADD} ${LIBGLOBAL_LDA} -unittest_osd_osdcap_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_osd_osdcap - -unittest_mon_moncap_SOURCES = test/mon/moncap.cc mon/MonCap.cc -unittest_mon_moncap_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_mon_moncap_LDADD = ${UNITTEST_LDADD} ${LIBGLOBAL_LDA} -unittest_mon_moncap_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_mon_moncap - -#if WITH_RADOSGW -#unittest_librgw_SOURCES = test/librgw.cc -#unittest_librgw_LDFLAGS = -lrt $(PTHREAD_CFLAGS) -lcurl ${AM_LDFLAGS} -#unittest_librgw_LDADD = librgw.la librados.la ${UNITTEST_LDADD} -lexpat $(LIBGLOBAL_LDA) -#unittest_librgw_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -#check_PROGRAMS += unittest_librgw -#endif - -unittest_ipaddr_SOURCES = test/test_ipaddr.cc -unittest_ipaddr_LDADD = ${UNITTEST_LDADD} $(LIBGLOBAL_LDA) -unittest_ipaddr_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_ipaddr - -unittest_texttable_SOURCES = test/test_texttable.cc common/TextTable.cc -unittest_texttable_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -unittest_texttable_LDADD = librados.la ${UNITTEST_LDADD} -unittest_texttable_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -check_PROGRAMS += unittest_texttable - -if WITH_RADOSGW -ceph_test_cors_SOURCES = test/test_cors.cc -ceph_test_cors_LDADD = librados.la librgw.a $(LIBGLOBAL_LDA) ${UNITTEST_LDADD} ${UNITTEST_STATIC_LDADD} -lcurl -luuid -lexpat -ceph_test_cors_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cors - -ceph_test_cls_rgw_meta_SOURCES = test/test_rgw_admin_meta.cc -ceph_test_cls_rgw_meta_LDADD = librgw.a ${UNITTEST_LDADD} ${UNITTEST_STATIC_LDADD} $(LIBGLOBAL_LDA) $(CRYPTO_LIBS) -lcurl -luuid -lexpat librados.la libcls_version_client.a \ - libcls_log_client.a libcls_statelog_client.a libcls_refcount_client.a libcls_rgw_client.a libcls_lock_client.a -ceph_test_cls_rgw_meta_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_rgw_meta - -ceph_test_cls_rgw_log_SOURCES = test/test_rgw_admin_log.cc -ceph_test_cls_rgw_log_LDADD = librgw.a ${UNITTEST_LDADD} ${UNITTEST_STATIC_LDADD} ${LIBGLOBAL_LDA} $(CRYPTO_LIBS) -lcurl -luuid -lexpat librados.la libcls_version_client.a \ - libcls_log_client.a libcls_statelog_client.a libcls_refcount_client.a libcls_rgw_client.a libcls_lock_client.a -ceph_test_cls_rgw_log_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_rgw_log - -ceph_test_cls_rgw_opstate_SOURCES = test/test_rgw_admin_opstate.cc -ceph_test_cls_rgw_opstate_LDADD = librgw.a ${UNITTEST_LDADD} ${UNITTEST_STATIC_LDADD} ${LIBGLOBAL_LDA} $(CRYPTO_LIBS) -lcurl -luuid -lexpat librados.la libcls_version_client.a \ - libcls_log_client.a libcls_statelog_client.a libcls_refcount_client.a libcls_rgw_client.a libcls_lock_client.a -ceph_test_cls_rgw_opstate_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_rgw_opstate -endif - -ceph_test_librbd_SOURCES = test/librbd/test_librbd.cc test/librados/test.cc -ceph_test_librbd_LDADD = librbd.la librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_librbd_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_librbd - -ceph_test_librbd_fsx_SOURCES = test/librbd/fsx.c -ceph_test_librbd_fsx_LDADD = librbd.la librados.la -lm -ceph_test_librbd_fsx_CFLAGS = ${AM_CFLAGS} -Wno-format -bin_DEBUGPROGRAMS += ceph_test_librbd_fsx - -ceph_test_cls_rbd_SOURCES = test/cls_rbd/test_cls_rbd.cc \ - test/librados/test.cc \ - cls/rbd/cls_rbd_client.cc \ - cls/lock/cls_lock_client.cc \ - cls/lock/cls_lock_types.cc \ - cls/lock/cls_lock_ops.cc -ceph_test_cls_rbd_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_cls_rbd_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_rbd - -ceph_test_cls_refcount_SOURCES = test/cls_refcount/test_cls_refcount.cc \ - test/librados/test.cc -ceph_test_cls_refcount_LDADD = librados.la libcls_refcount_client.a ${UNITTEST_STATIC_LDADD} -ceph_test_cls_refcount_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_refcount - -ceph_test_cls_version_SOURCES = test/cls_version/test_cls_version.cc \ - test/librados/test.cc -ceph_test_cls_version_LDADD = librados.la libcls_version_client.a ${UNITTEST_STATIC_LDADD} -ceph_test_cls_version_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_version - -ceph_test_cls_log_SOURCES = test/cls_log/test_cls_log.cc \ - test/librados/test.cc -ceph_test_cls_log_LDADD = librados.la libcls_log_client.a ${UNITTEST_STATIC_LDADD} ${LIBGLOBAL_LDA} -ceph_test_cls_log_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_log - -ceph_test_cls_statelog_SOURCES = test/cls_statelog/test_cls_statelog.cc \ - test/librados/test.cc -ceph_test_cls_statelog_LDADD = librados.la libcls_statelog_client.a ${UNITTEST_STATIC_LDADD} ${LIBGLOBAL_LDA} -ceph_test_cls_statelog_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_statelog -ceph_test_cls_replica_log_SOURCES = \ - test/cls_replica_log/test_cls_replica_log.cc \ - test/librados/test.cc -ceph_test_cls_replica_log_LDADD = librados.la \ - libcls_replica_log_client.a ${UNITTEST_STATIC_LDADD} ${LIBGLOBAL_LDA} -ceph_test_cls_replica_log_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_replica_log - -ceph_test_cls_lock_SOURCES = test/cls_lock/test_cls_lock.cc test/librados/test.cc -ceph_test_cls_lock_LDFLAGS = ${AM_LDFLAGS} -ceph_test_cls_lock_LDADD = libcls_lock_client.a librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_cls_lock_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_lock - -ceph_test_cls_hello_SOURCES = test/cls_hello/test_cls_hello.cc test/librados/test.cc -ceph_test_cls_hello_LDADD = ${UNITTEST_LDADD} ${UNITTEST_STATIC_LDADD} $(LIBGLOBAL_LDA) $(CRYPTO_LIBS) librados.la -ceph_test_cls_hello_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_hello - -if WITH_RADOSGW - -ceph_test_cls_rgw_SOURCES = test/cls_rgw/test_cls_rgw.cc \ - test/librados/test.cc -ceph_test_cls_rgw_LDADD = librados.la libcls_rgw_client.a ${UNITTEST_STATIC_LDADD} -ceph_test_cls_rgw_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cls_rgw - -endif - -ceph_test_mon_workloadgen_SOURCES = \ - test/mon/test_mon_workloadgen.cc \ - osdc/Objecter.cc \ - osdc/Striper.cc -ceph_test_mon_workloadgen_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_mon_workloadgen_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_mon_workloadgen - -ceph_test_rados_api_cmd_SOURCES = test/librados/cmd.cc test/librados/test.cc -ceph_test_rados_api_cmd_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_cmd_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_cmd_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_cmd - -ceph_test_rados_api_io_SOURCES = test/librados/io.cc test/librados/test.cc -ceph_test_rados_api_io_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_io_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_io_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_io - -ceph_test_rados_api_aio_SOURCES = test/librados/aio.cc test/librados/test.cc -ceph_test_rados_api_aio_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_aio_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_aio_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_aio - -ceph_test_rados_api_list_SOURCES = test/librados/list.cc test/librados/test.cc -ceph_test_rados_api_list_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_list_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_list_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_list - -ceph_test_rados_api_pool_SOURCES = test/librados/pool.cc test/librados/test.cc -ceph_test_rados_api_pool_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_pool_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_pool_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_pool - -ceph_test_rados_api_stat_SOURCES = test/librados/stat.cc test/librados/test.cc -ceph_test_rados_api_stat_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_stat_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_stat_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_stat - -ceph_test_rados_api_watch_notify_SOURCES = test/librados/watch_notify.cc test/librados/test.cc -ceph_test_rados_api_watch_notify_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_watch_notify_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_watch_notify_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_watch_notify - -ceph_test_rados_api_snapshots_SOURCES = test/librados/snapshots.cc test/librados/test.cc -ceph_test_rados_api_snapshots_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_snapshots_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_snapshots_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_snapshots - -ceph_test_rados_api_cls_SOURCES = test/librados/cls.cc test/librados/test.cc -ceph_test_rados_api_cls_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_cls_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_cls_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_cls - -ceph_test_rados_api_misc_SOURCES = test/librados/misc.cc test/librados/test.cc -ceph_test_rados_api_misc_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_misc_LDADD = librados.la $(LIBGLOBAL_LDA) ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_misc_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_misc - -ceph_test_rados_api_lock_SOURCES = test/librados/lock.cc test/librados/test.cc -ceph_test_rados_api_lock_LDFLAGS = ${AM_LDFLAGS} -ceph_test_rados_api_lock_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_rados_api_lock_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_rados_api_lock - -ceph_test_libcephfs_SOURCES = test/libcephfs/test.cc test/libcephfs/readdir_r_cb.cc test/libcephfs/caps.cc test/libcephfs/multiclient.cc -ceph_test_libcephfs_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} -ceph_test_libcephfs_LDADD = ${UNITTEST_STATIC_LDADD} libcephfs.la -ceph_test_libcephfs_CXXFLAGS = $(AM_CXXFLAGS) ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_libcephfs - -ceph_test_filestore_SOURCES = test/filestore/store_test.cc -ceph_test_filestore_LDFLAGS = ${AM_LDFLAGS} -ceph_test_filestore_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_filestore_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_filestore - -ceph_test_filestore_workloadgen_SOURCES = \ - test/filestore/workload_generator.cc \ - test/filestore/TestFileStoreState.cc -ceph_test_filestore_workloadgen_LDFLAGS = ${AM_LDFLAGS} -ceph_test_filestore_workloadgen_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_filestore_workloadgen_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_filestore_workloadgen - -ceph_test_filestore_idempotent_SOURCES = test/filestore/test_idempotent.cc test/filestore/FileStoreTracker.cc test/common/ObjectContents.cc -ceph_test_filestore_idempotent_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_filestore_idempotent_CXXFLAGS = $(AM_CXXFLAGS) -bin_DEBUGPROGRAMS += ceph_test_filestore_idempotent - -ceph_test_filestore_idempotent_sequence_SOURCES = \ - test/filestore/test_idempotent_sequence.cc \ - test/filestore/DeterministicOpSequence.cc \ - test/filestore/TestFileStoreState.cc \ - test/filestore/FileStoreDiff.cc -ceph_test_filestore_idempotent_sequence_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} -ceph_test_filestore_idempotent_sequence_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -bin_DEBUGPROGRAMS += ceph_test_filestore_idempotent_sequence - -ceph_xattr_bench_SOURCES = test/xattr_bench.cc -ceph_xattr_bench_LDFLAGS = ${AM_LDFLAGS} -ceph_xattr_bench_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_xattr_bench_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_xattr_bench - -ceph_test_filejournal_SOURCES = test/test_filejournal.cc -ceph_test_filejournal_LDFLAGS = ${AM_LDFLAGS} -ceph_test_filejournal_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_filejournal_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_filejournal - -ceph_test_stress_watch_SOURCES = test/test_stress_watch.cc test/librados/test.cc -ceph_test_stress_watch_LDFLAGS = ${AM_LDFLAGS} -ceph_test_stress_watch_LDADD = librados.la ${UNITTEST_STATIC_LDADD} -ceph_test_stress_watch_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_stress_watch - -ceph_test_objectcacher_stress_SOURCES = test/osdc/object_cacher_stress.cc test/osdc/FakeWriteback.cc osdc/ObjectCacher.cc -ceph_test_objectcacher_stress_LDFLAGS = ${AM_LDFLAGS} -ceph_test_objectcacher_stress_LDADD = $(LIBGLOBAL_LDA) -ceph_test_objectcacher_stress_CXXFLAGS = ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_objectcacher_stress - -ceph_test_snap_mapper_SOURCES = test/test_snap_mapper.cc osd/SnapMapper.cc -ceph_test_snap_mapper_LDFLAGS = ${AM_LDFLAGS} -ceph_test_snap_mapper_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_snap_mapper_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} $(LEVELDB_INCLUDE) ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_snap_mapper - -ceph_test_object_map_SOURCES = test/ObjectMap/test_object_map.cc test/ObjectMap/KeyValueDBMemory.cc os/DBObjectMap.cc os/LevelDBStore.cc -ceph_test_object_map_LDFLAGS = ${AM_LDFLAGS} -ceph_test_object_map_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_object_map_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_object_map - -ceph_test_keyvaluedb_atomicity_SOURCES = test/ObjectMap/test_keyvaluedb_atomicity.cc os/LevelDBStore.cc -ceph_test_keyvaluedb_atomicity_LDFLAGS = ${AM_LDFLAGS} -ceph_test_keyvaluedb_atomicity_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_keyvaluedb_atomicity_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_keyvaluedb_atomicity - -ceph_test_keyvaluedb_iterators_SOURCES = test/ObjectMap/test_keyvaluedb_iterators.cc \ - test/ObjectMap/KeyValueDBMemory.cc \ - os/LevelDBStore.cc -ceph_test_keyvaluedb_iterators_LDFLAGS = ${AM_LDFLAGS} -ceph_test_keyvaluedb_iterators_LDADD = ${UNITTEST_STATIC_LDADD} $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_keyvaluedb_iterators_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} ${CRYPTO_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_keyvaluedb_iterators - -ceph_test_store_tool_SOURCES = test/ObjectMap/test_store_tool/test_store_tool.cc \ - os/LevelDBStore.cc -ceph_test_store_tool_LDFLAGS = ${AM_LDFLAGS} -ceph_test_store_tool_LDADD = $(LIBOS_LDA) $(LIBGLOBAL_LDA) -ceph_test_store_tool_CXXFLAGS = ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_store_tool - -ceph_test_cfuse_cache_invalidate_SOURCES = test/test_cfuse_cache_invalidate.cc -ceph_test_cfuse_cache_invalidate_LDFLAGS = ${AM_LDFLAGS} -ceph_test_cfuse_cache_invalidate_LDADD = -ceph_test_cfuse_cache_invalidate_CXXFLAGS = ${AM_CXXFLAGS} -bin_DEBUGPROGRAMS += ceph_test_cfuse_cache_invalidate # shell scripts + editpaths = sed \ -e 's|@bindir[@]|$(bindir)|g' \ -e 's|@sbindir[@]|$(sbindir)|g' \ @@ -1290,11 +140,8 @@ editpaths = sed \ -e 's|@datadir[@]|$(pkgdatadir)|g' \ -e 's|@prefix[@]|$(prefix)|g' \ -e 's|@@GCOV_PREFIX_STRIP[@][@]|$(GCOV_PREFIX_STRIP)|g' - -shell_scripts = init-ceph mkcephfs ceph-debugpack ceph-coverage ceph-post-file - +shell_scripts = ceph-debugpack ceph-post-file $(shell_scripts): Makefile - $(shell_scripts): %: %.in rm -f $@ $@.tmp $(editpaths) '$(srcdir)/$@.in' >$@.tmp @@ -1302,82 +149,26 @@ $(shell_scripts): %: %.in chmod a-w $@.tmp mv $@.tmp $@ -BUILT_SOURCES += init-ceph -sbin_SCRIPTS += mkcephfs - -bin_SCRIPTS += ceph-coverage - +EXTRA_DIST += $(srcdir)/$(shell_scripts:%=%.in) CLEANFILES += $(shell_scripts) -CLEANFILES += ceph_ver.h sample.fetch_config - -## - -AM_COMMON_FLAGS = \ - -D__CEPH__ \ - -D_FILE_OFFSET_BITS=64 \ - -D_REENTRANT \ - -D_THREAD_SAFE \ - -D__STDC_FORMAT_MACROS \ - -D_GNU_SOURCE \ - -Wall \ - ${WARN_TYPE_LIMITS} \ - ${WARN_IGNORED_QUALIFIERS} \ - -Winit-self \ - -Wpointer-arith \ - -Werror=format-security \ - -fno-strict-aliasing \ - -fsigned-char -if !CLANG - AM_COMMON_FLAGS += -rdynamic -endif - -AM_CFLAGS = $(AM_COMMON_FLAGS) -AM_CXXFLAGS = \ - @AM_CXXFLAGS@ \ - $(AM_COMMON_FLAGS) \ - -DCEPH_LIBDIR=\"${libdir}\" \ - -Wnon-virtual-dtor \ - -Wno-invalid-offsetof - -if !CLANG - AM_CXXFLAGS += -Wstrict-null-sentinel -endif -# note: this is position dependant, it affects the -l options that -# come after it on the command line. when you use ${AM_LDFLAGS} in -# later rules, take care where you place it. for more information, see -# http://blog.flameeyes.eu/2008/11/19/relationship-between-as-needed-and-no-undefined-part-1-what-do-they-do -# http://blog.flameeyes.eu/2008/11/20/misguided-link-and-as-needed -# http://www.gentoo.org/proj/en/qa/asneeded.xml -# http://gcc.gnu.org/ml/gcc-help/2010-12/msg00338.html -# http://sigquit.wordpress.com/2011/02/16/why-asneeded-doesnt-work-as-expected-for-your-libraries-on-your-autotools-project/ -AM_LDFLAGS = -Wl,--as-needed - -if USE_BOOST_SPIRIT_OLD_HDR -AM_CXXFLAGS += -DUSE_BOOST_SPIRIT_OLD_HDR -endif - -if WITH_LIBATOMIC -AM_LDFLAGS += -latomic_ops -endif - -if ENABLE_COVERAGE -AM_CFLAGS += -fprofile-arcs -ftest-coverage -AM_CXXFLAGS += -fprofile-arcs -ftest-coverage -O0 -EXTRALIBS += -lgcov -endif # extra bits + EXTRA_DIST += \ - $(srcdir)/verify-mds-journal.sh $(srcdir)/vstart.sh $(srcdir)/stop.sh \ - ceph-run $(srcdir)/ceph_common.sh \ + $(srcdir)/verify-mds-journal.sh \ + $(srcdir)/vstart.sh \ + $(srcdir)/stop.sh \ + ceph-run \ + $(srcdir)/ceph_common.sh \ $(srcdir)/init-radosgw \ $(srcdir)/init-radosgw.sysv \ $(srcdir)/init-rbdmap \ - $(srcdir)/ceph-clsinfo $(srcdir)/make_version $(srcdir)/check_version \ + $(srcdir)/ceph-clsinfo \ + $(srcdir)/make_version \ + $(srcdir)/check_version \ $(srcdir)/.git_version \ $(srcdir)/ceph-rbdnamer \ - $(ceph_tool_gui_DATA) \ $(srcdir)/test/encoding/readable.sh \ $(srcdir)/test/encoding/check-generated.sh \ $(srcdir)/upstart/ceph-all.conf \ @@ -1400,21 +191,39 @@ EXTRA_DIST += \ ceph-disk-activate \ ceph-disk-udev \ ceph-create-keys \ - mount.fuse.ceph \ ceph-rest-api \ mount.fuse.ceph \ - rbdmap + rbdmap \ + unittest_bufferlist.sh \ + yasm-wrapper -EXTRA_DIST += $(srcdir)/$(shell_scripts:%=%.in) +EXTRA_DIST += \ + libs3/COPYING \ + libs3/ChangeLog \ + libs3/GNUmakefile \ + libs3/GNUmakefile.mingw \ + libs3/GNUmakefile.osx \ + libs3/INSTALL \ + libs3/LICENSE \ + libs3/README \ + libs3/TODO \ + libs3/archlinux \ + libs3/debian \ + libs3/doxyfile \ + libs3/inc \ + libs3/libs3.spec \ + libs3/mswin \ + libs3/src \ + libs3/test \ + unittest_bufferlist.sh # work around old versions of automake that don't define $docdir # NOTE: this won't work on suse, where docdir is /usr/share/doc/packages/$package. docdir ?= ${datadir}/doc/ceph - doc_DATA = $(srcdir)/sample.ceph.conf sample.fetch_config -sample.fetch_config: fetch_config - cp -f $(srcdir)/fetch_config ./sample.fetch_config + +# various scripts shell_commondir = $(libdir)/ceph shell_common_SCRIPTS = ceph_common.sh @@ -1425,31 +234,53 @@ bash_completion_DATA = $(srcdir)/bash_completion/ceph \ $(srcdir)/bash_completion/rbd \ $(srcdir)/bash_completion/radosgw-admin -libcephfs_includedir = $(includedir)/cephfs -libcephfs_include_DATA = $(srcdir)/include/cephfs/libcephfs.h - -librbd_includedir = $(includedir)/rbd -librbd_include_DATA = \ - $(srcdir)/include/rbd/features.h \ - $(srcdir)/include/rbd/librbd.h \ - $(srcdir)/include/rbd/librbd.hpp - -rados_includedir = $(includedir)/rados -rados_include_DATA = \ - $(srcdir)/include/rados/librados.h \ - $(srcdir)/include/rados/rados_types.h \ - $(srcdir)/include/rados/rados_types.hpp \ - $(srcdir)/include/rados/librados.hpp \ - $(srcdir)/include/buffer.h \ - $(srcdir)/include/page.h \ - $(srcdir)/include/crc32c.h - -#crush_includedir = $(includedir)/crush -#crush_include_DATA = \ -# $(srcdir)/crush/hash.h \ -# $(srcdir)/crush/crush.h \ -# $(srcdir)/crush/mapper.h \ -# $(srcdir)/crush/types.h +ceph_sbin_SCRIPTS = \ + ceph-disk \ + ceph-disk-prepare \ + ceph-disk-activate \ + ceph-disk-udev \ + ceph-create-keys + +bin_SCRIPTS += \ + ceph \ + ceph-run \ + ceph-rest-api \ + ceph-clsinfo \ + ceph-debugpack \ + ceph-rbdnamer \ + ceph-post-file + +BUILT_SOURCES += init-ceph +sbin_SCRIPTS += mkcephfs + +shell_scripts += init-ceph mkcephfs + + + + + +# tests to actually run on "make check"; if you need extra, non-test, +# executables built, you need to replace this with manual assignments +# target by target + +TESTS = $(check_PROGRAMS) unittest_bufferlist.sh + +check-local: + $(srcdir)/test/encoding/check-generated.sh + $(srcdir)/test/encoding/readable.sh ../ceph-object-corpus + + +# base targets + +core-daemons: ceph-mon ceph-osd ceph-mds radosgw +admin-tools: monmaptool osdmaptool crushtool ceph-authtool +base: core-daemons admin-tools \ + cephfs ceph-syn ceph-conf \ + rados librados-config \ + init-ceph mkcephfs ceph_mon_store_converter ceph-post-file + + +# version stuff FORCE: .git_version: FORCE @@ -1461,6 +292,15 @@ ceph_ver.c: ./ceph_ver.h common/version.cc: ./ceph_ver.h test/encoding/ceph_dencoder.cc: ./ceph_ver.h +sample.fetch_config: fetch_config + cp -f $(srcdir)/fetch_config ./sample.fetch_config + +dist-hook: + $(srcdir)/check_version $(srcdir)/.git_version + +CLEANFILES += ceph_ver.h sample.fetch_config + + # assemble Python script with global version variables # NB: depends on format of ceph_ver.h @@ -1477,288 +317,12 @@ ceph: ceph.in ./ceph_ver.h Makefile mv $@.tmp $@ # cleaning + clean-local: -rm *.so *.gcno *.gcda -# libs - -CCAS = ${srcdir}/yasm-wrapper -AM_CCASFLAGS = -f elf64 - -# crc -libcrc_la_SOURCES = \ - common/sctp_crc32.c \ - common/crc32c.cc \ - common/crc32c_intel_baseline.c \ - common/crc32c_intel_fast.c - -if WITH_GOOD_YASM_ELF64 -libcrc_la_SOURCES += common/crc32c_intel_fast_asm.S -libcrc_la_LIBTOOLFLAGS = --tag=CC -endif - -noinst_LTLIBRARIES += libcrc.la - -# common -libcommon_la_SOURCES = $(libcommon_files) -libcommon_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS} -libcommon_la_CXXFLAGS= ${AM_CXXFLAGS} -libcommon_la_LDFLAGS = -lrt -libcommon_la_LIBADD = libcrc.la -noinst_LTLIBRARIES += libcommon.la - -crush_files = \ - crush/builder.c \ - crush/mapper.c \ - crush/crush.c \ - crush/hash.c \ - crush/CrushWrapper.cc \ - crush/CrushCompiler.cc \ - crush/CrushTester.cc - -# this list ommits the ceph_ver.c file -libcommon_files = \ - ./ceph_ver.c \ - arch/probe.cc \ - arch/intel.c \ - auth/AuthAuthorizeHandler.cc \ - auth/AuthClientHandler.cc \ - auth/AuthSessionHandler.cc \ - auth/AuthMethodList.cc \ - auth/cephx/CephxAuthorizeHandler.cc \ - auth/cephx/CephxClientHandler.cc \ - auth/cephx/CephxProtocol.cc \ - auth/cephx/CephxSessionHandler.cc \ - auth/none/AuthNoneAuthorizeHandler.cc \ - auth/unknown/AuthUnknownAuthorizeHandler.cc \ - auth/Crypto.cc \ - auth/KeyRing.cc \ - auth/RotatingKeyRing.cc \ - common/DecayCounter.cc \ - common/LogClient.cc \ - common/LogEntry.cc \ - common/PrebufferedStreambuf.cc \ - common/BackTrace.cc \ - common/perf_counters.cc \ - common/Mutex.cc \ - common/OutputDataSocket.cc \ - common/admin_socket.cc \ - common/admin_socket_client.cc \ - common/cmdparse.cc \ - common/escape.c \ - common/Clock.cc \ - common/Throttle.cc \ - common/Timer.cc \ - common/Finisher.cc \ - common/environment.cc\ - common/assert.cc \ - common/run_cmd.cc \ - common/WorkQueue.cc \ - common/ConfUtils.cc \ - common/MemoryModel.cc \ - common/armor.c \ - common/fd.cc \ - common/xattr.c \ - common/safe_io.c \ - common/snap_types.cc \ - common/str_list.cc \ - common/errno.cc \ - json_spirit/json_spirit_reader.cpp \ - json_spirit/json_spirit_writer.cpp \ - json_spirit/json_spirit_value.cpp \ - log/Log.cc \ - log/SubsystemMap.cc \ - mon/MonCap.cc \ - mon/MonClient.cc \ - mon/MonMap.cc \ - msg/Accepter.cc \ - msg/DispatchQueue.cc \ - msg/Message.cc \ - common/RefCountedObj.cc \ - msg/Messenger.cc \ - msg/Pipe.cc \ - msg/SimpleMessenger.cc \ - msg/msg_types.cc \ - os/hobject.cc \ - osd/OSDMap.cc \ - osd/osd_types.cc \ - mds/MDSMap.cc \ - mds/inode_backtrace.cc \ - mds/mdstypes.cc \ - common/blkdev.cc \ - common/common_init.cc \ - common/pipe.c \ - common/ceph_argparse.cc \ - common/ceph_context.cc \ - common/buffer.cc \ - common/code_environment.cc \ - common/dout.cc \ - common/signal.cc \ - common/simple_spin.cc \ - common/Thread.cc \ - common/Formatter.cc \ - common/HeartbeatMap.cc \ - include/ceph_fs.cc \ - include/ceph_hash.cc \ - include/ceph_strings.cc \ - include/ceph_frag.cc \ - common/config.cc \ - common/utf8.c \ - common/mime.c \ - common/strtol.cc \ - common/page.cc \ - common/lockdep.cc \ - common/version.cc \ - common/hex.cc \ - common/entity_name.cc \ - common/ceph_crypto.cc \ - common/ceph_crypto_cms.cc \ - common/ceph_json.cc \ - common/ipaddr.cc \ - common/pick_address.cc \ - include/addr_parsing.c \ - $(crush_files) - -if WITH_PROFILER -libcommon_files += perfglue/cpu_profiler.cc -else -libcommon_files += perfglue/disabled_stubs.cc -endif - -# global -libglobal_la_SOURCES = \ - global/global_context.cc \ - global/global_init.cc \ - global/pidfile.cc \ - global/signal_handler.cc -libglobal_la_CFLAGS= ${CRYPTO_CFLAGS} ${AM_CFLAGS} -libglobal_la_CXXFLAGS= ${AM_CXXFLAGS} -libglobal_la_LIBADD= libcommon.la -noinst_LTLIBRARIES += libglobal.la - - -libmon_a_SOURCES = \ - auth/cephx/CephxKeyServer.cc \ - auth/cephx/CephxServiceHandler.cc \ - auth/cephx/CephxSessionHandler.cc \ - auth/AuthServiceHandler.cc \ - auth/AuthSessionHandler.cc \ - mon/Monitor.cc \ - mon/Paxos.cc \ - mon/PaxosService.cc \ - mon/OSDMonitor.cc \ - mon/MDSMonitor.cc \ - mon/MonmapMonitor.cc \ - mon/PGMonitor.cc \ - mon/PGMap.cc \ - mon/LogMonitor.cc \ - mon/AuthMonitor.cc \ - mon/Elector.cc \ - mon/MonitorStore.cc \ - os/LevelDBStore.cc \ - mon/HealthMonitor.cc \ - mon/DataHealthService.cc \ - mon/ConfigKeyService.cc \ - common/util.cc \ - common/TextTable.cc -libmon_a_CXXFLAGS= ${AM_CXXFLAGS} -noinst_LIBRARIES += libmon.a - -libmds_a_SOURCES = \ - mds/Anchor.cc \ - mds/Capability.cc \ - mds/Dumper.cc \ - mds/Resetter.cc \ - mds/MDS.cc \ - mds/flock.cc \ - mds/locks.c \ - mds/journal.cc \ - mds/Server.cc \ - mds/Mutation.cc \ - mds/MDCache.cc \ - mds/Locker.cc \ - mds/Migrator.cc \ - mds/MDBalancer.cc \ - mds/CDentry.cc \ - mds/CDir.cc \ - mds/CInode.cc \ - mds/LogEvent.cc \ - mds/MDSTable.cc \ - mds/InoTable.cc \ - mds/MDSTableClient.cc \ - mds/MDSTableServer.cc \ - mds/AnchorServer.cc \ - mds/AnchorClient.cc \ - mds/SnapRealm.cc \ - mds/SnapServer.cc \ - mds/snap.cc \ - mds/SessionMap.cc \ - mds/MDLog.cc \ - osdc/Journaler.cc -noinst_LIBRARIES += libmds.a - -libos_a_SOURCES = \ - os/FileJournal.cc \ - os/FileStore.cc \ - os/chain_xattr.cc \ - os/ObjectStore.cc \ - os/JournalingObjectStore.cc \ - os/LFNIndex.cc \ - os/HashIndex.cc \ - os/IndexManager.cc \ - os/FlatIndex.cc \ - os/DBObjectMap.cc \ - os/LevelDBStore.cc \ - os/WBThrottle.cc \ - os/BtrfsFileStoreBackend.cc \ - os/GenericFileStoreBackend.cc \ - os/ZFSFileStoreBackend.cc -libos_a_CXXFLAGS= ${AM_CXXFLAGS} -noinst_LIBRARIES += libos.a - -if WITH_LIBZFS -libos_zfs_a_SOURCES = os/ZFS.cc -libos_zfs_a_CXXFLAGS= ${AM_CXXFLAGS} ${LIBZFS_CFLAGS} -noinst_LIBRARIES += libos_zfs.a -endif - -libosd_a_SOURCES = \ - osd/PG.cc \ - osd/PGLog.cc \ - osd/ReplicatedPG.cc \ - osd/Ager.cc \ - osd/OSD.cc \ - osd/OSDCap.cc \ - osd/Watch.cc \ - osd/ClassHandler.cc \ - osd/OpRequest.cc \ - osd/SnapMapper.cc \ - objclass/class_api.cc -libosd_a_CXXFLAGS = ${AM_CXXFLAGS} -noinst_LIBRARIES += libosd.a - -libosdc_la_SOURCES = \ - osdc/Objecter.cc \ - osdc/ObjectCacher.cc \ - osdc/Filer.cc \ - osdc/Striper.cc -libosdc_la_CXXFLAGS= ${AM_CXXFLAGS} -libosdc_la_LIBADD = libcommon.la -noinst_LTLIBRARIES += libosdc.la - -libclient_la_SOURCES = \ - client/Client.cc \ - client/Inode.cc \ - client/Dentry.cc \ - client/MetaRequest.cc \ - client/ClientSnapRealm.cc \ - client/MetaSession.cc \ - client/Trace.cc -libclient_la_LIBADD = libosdc.la $(LIBEDIT_LIBS) -noinst_LTLIBRARIES += libclient.la -dist-hook: - $(srcdir)/check_version $(srcdir)/.git_version +# pybind python_PYTHON = pybind/rados.py \ pybind/rbd.py \ @@ -1766,597 +330,29 @@ python_PYTHON = pybind/rados.py \ pybind/ceph_argparse.py \ pybind/ceph_rest_api.py -# headers... and everything else we want to include in a 'make dist' -# that autotools doesn't magically identify. -noinst_HEADERS = \ - rados_sync.h \ - arch/probe.h \ - arch/intel.h \ - auth/cephx/CephxAuthorizeHandler.h\ - auth/cephx/CephxKeyServer.h\ - auth/cephx/CephxProtocol.h\ - auth/cephx/CephxClientHandler.h\ - auth/cephx/CephxServiceHandler.h\ - auth/cephx/CephxSessionHandler.h\ - auth/none/AuthNoneAuthorizeHandler.h\ - auth/none/AuthNoneClientHandler.h\ - auth/none/AuthNoneServiceHandler.h\ - auth/none/AuthNoneSessionHandler.h\ - auth/none/AuthNoneProtocol.h\ - auth/unknown/AuthUnknownAuthorizeHandler.h\ - auth/unknown/AuthUnknownClientHandler.h\ - auth/unknown/AuthUnknownServiceHandler.h\ - auth/unknown/AuthUnknownSessionHandler.h\ - auth/unknown/AuthUnknownProtocol.h\ - auth/Auth.h\ - auth/AuthMethodList.h\ - auth/AuthClientHandler.h\ - auth/AuthServiceHandler.h\ - auth/AuthSessionHandler.h\ - auth/AuthAuthorizeHandler.h\ - auth/KeyRing.h\ - auth/RotatingKeyRing.h\ - auth/Crypto.h\ - bash_completion/ceph\ - bash_completion/rados\ - bash_completion/rbd\ - bash_completion/radosgw-admin\ - client/Client.h\ - client/Dentry.h\ - client/Dir.h\ - client/Fh.h\ - client/Inode.h\ - client/MetaRequest.h\ - client/MetaSession.h\ - client/ClientSnapRealm.h\ - client/SyntheticClient.h\ - client/Trace.h\ - client/fuse_ll.h\ - client/ioctl.h\ - client/hadoop/CephFSInterface.h\ - client/ObjecterWriteback.h\ + +# everything else we want to include in a 'make dist' + +noinst_HEADERS += \ cls_acl.cc\ cls_crypto.cc\ - cls/lock/cls_lock_types.h\ - cls/lock/cls_lock_ops.h\ - cls/lock/cls_lock_client.h\ - cls/rbd/cls_rbd.h\ - cls/rbd/cls_rbd_client.h\ - cls/refcount/cls_refcount_ops.h\ - cls/refcount/cls_refcount_client.h\ - cls/version/cls_version_types.h\ - cls/version/cls_version_ops.h\ - cls/version/cls_version_client.h\ - cls/log/cls_log_types.h\ - cls/log/cls_log_ops.h\ - cls/log/cls_log_client.h\ - cls/statelog/cls_statelog_types.h\ - cls/statelog/cls_statelog_ops.h\ - cls/statelog/cls_statelog_client.h\ - cls/replica_log/cls_replica_log_types.h\ - cls/replica_log/cls_replica_log_ops.h\ - cls/replica_log/cls_replica_log_client.h\ - cls/rgw/cls_rgw_client.h\ - cls/rgw/cls_rgw_ops.h\ - cls/rgw/cls_rgw_types.h\ - common/BackTrace.h\ - common/RefCountedObj.h\ - common/HeartbeatMap.h\ - common/LogClient.h\ - common/LogEntry.h\ - common/Preforker.h\ - common/WorkQueue.h\ - common/PrioritizedQueue.h\ - common/ceph_argparse.h\ - common/ceph_context.h\ - common/xattr.h\ - common/blkdev.h\ - common/compiler_extensions.h\ - common/debug.h\ - common/dout.h\ - common/escape.h\ - common/fd.h\ - common/version.h\ - common/hex.h\ - common/entity_name.h\ - common/errno.h\ - common/environment.h\ - common/likely.h\ - common/lockdep.h\ - common/obj_bencher.h\ - common/snap_types.h\ - common/Clock.h\ - common/Cond.h\ - common/ConfUtils.h\ - common/DecayCounter.h\ - common/Finisher.h\ - common/Formatter.h\ - common/perf_counters.h\ - common/OutputDataSocket.h \ - common/admin_socket.h \ - common/admin_socket_client.h \ - common/shared_cache.hpp \ - common/tracked_int_ptr.hpp \ - common/simple_cache.hpp \ - common/sharedptr_registry.hpp \ - common/map_cacher.hpp \ - common/MemoryModel.h\ - common/Mutex.h\ - common/PrebufferedStreambuf.h\ - common/RWLock.h\ - common/Semaphore.h\ - common/SimpleRNG.h\ - common/TextTable.h\ - common/Thread.h\ - common/Throttle.h\ - common/Timer.h\ - common/TrackedOp.h\ - common/arch.h\ - common/armor.h\ - global/global_init.h \ - global/global_context.h \ - common/common_init.h\ - common/pipe.h\ - common/code_environment.h \ - common/signal.h\ - global/signal_handler.h\ - common/simple_spin.h\ - common/run_cmd.h\ - common/safe_io.h\ - common/config.h\ - common/config_obs.h\ - common/config_opts.h\ - common/ceph_crypto.h\ - common/ceph_crypto_cms.h\ - common/ceph_json.h\ - common/crc32c_intel_baseline.h\ - common/crc32c_intel_fast.h\ - common/lru_map.h\ - common/utf8.h\ - common/mime.h\ - common/pick_address.h\ - common/sctp_crc32.h\ - common/secret.h\ - common/strtol.h\ - common/static_assert.h\ - common/AsyncReserver.h\ - crush/CrushCompiler.h\ - crush/CrushTester.h\ - crush/CrushWrapper.h\ - crush/CrushWrapper.i\ - crush/builder.h\ - crush/crush.h\ - crush/grammar.h\ - crush/hash.h\ - crush/mapper.h\ - crush/sample.txt\ - crush/types.h\ fetch_config\ - include/bloom_filter.hpp\ - include/Context.h\ - include/CompatSet.h\ - include/Distribution.h\ - include/addr_parsing.h\ - include/assert.h\ - include/atomic.h\ - include/bitmapper.h\ - include/blobhash.h\ - include/buffer.h\ - include/byteorder.h\ - include/cephfs/libcephfs.h\ - include/ceph_features.h\ - include/ceph_frag.h\ - include/ceph_fs.h\ - include/ceph_hash.h\ - include/cmp.h\ - include/color.h\ - include/compat.h\ - include/crc32c.h\ - include/encoding.h\ - include/err.h\ - include/error.h\ - include/filepath.h\ - include/frag.h\ - include/hash.h\ - include/intarith.h\ - include/interval_set.h\ - include/inttypes.h\ - include/ipaddr.h\ - include/linux_fiemap.h\ - include/lru.h\ - include/msgr.h\ - include/object.h\ - include/page.h\ - include/rangeset.h\ - include/rados.h\ - include/rbd_types.h\ - include/statlite.h\ - include/str_list.h\ - include/stringify.h\ - include/triple.h\ - include/types.h\ - include/utime.h\ - include/dlist.h\ - include/elist.h\ - include/uuid.h\ - include/xlist.h\ - include/rados/librados.h\ - include/rados/rados_types.h\ - include/rados/rados_types.hpp\ - include/rados/librados.hpp\ - include/rados/librgw.h\ - include/rados/page.h\ - include/rados/crc32c.h\ - include/rados/buffer.h\ - include/rbd/features.h\ - include/rbd/librbd.h\ - include/rbd/librbd.hpp\ - include/util.h\ - librados/snap_set_diff.h\ - librados/AioCompletionImpl.h\ - librados/IoCtxImpl.h\ - librados/PoolAsyncCompletionImpl.h\ - librados/RadosClient.h\ - librbd/AioCompletion.h\ - librbd/AioRequest.h\ - librbd/ImageCtx.h\ - librbd/internal.h\ - librbd/LibrbdWriteback.h\ - librbd/parent_types.h\ - librbd/SnapInfo.h\ - librbd/WatchCtx.h\ logrotate.conf\ - json_spirit/json_spirit.h\ - json_spirit/json_spirit_error_position.h\ - json_spirit/json_spirit_reader.h\ - json_spirit/json_spirit_reader_template.h\ - json_spirit/json_spirit_stream_reader.h\ - json_spirit/json_spirit_utils.h\ - json_spirit/json_spirit_value.h\ - json_spirit/json_spirit_writer.h\ - json_spirit/json_spirit_writer_options.h\ - json_spirit/json_spirit_writer_template.h\ - key_value_store/key_value_structure.h\ - key_value_store/kv_flat_btree_async.h\ - key_value_store/kvs_arg_types.h\ - log/Entry.h\ - log/EntryQueue.h\ - log/Log.h\ - log/SubsystemMap.h\ - mds/inode_backtrace.h\ - mds/flock.h\ - mds/locks.c\ - mds/locks.h\ - mds/Anchor.h\ - mds/AnchorClient.h\ - mds/AnchorServer.h\ - mds/CDentry.h\ - mds/CDir.h\ - mds/CInode.h\ - mds/Capability.h\ - mds/Dumper.h\ - mds/InoTable.h\ - mds/LocalLock.h\ - mds/Locker.h\ - mds/LogEvent.h\ - mds/LogSegment.h\ - mds/MDBalancer.h\ - mds/MDCache.h\ - mds/MDLog.h\ - mds/MDS.h\ - mds/MDSMap.h\ - mds/MDSTable.h\ - mds/MDSTableServer.h\ - mds/MDSTableClient.h\ - mds/Mutation.h\ - mds/Migrator.h\ - mds/Resetter.h\ - mds/ScatterLock.h\ - mds/Server.h\ - mds/SessionMap.h\ - mds/SimpleLock.h\ - mds/SnapClient.h\ - mds/SnapRealm.h\ - mds/SnapServer.h\ - mds/events/ECommitted.h\ - mds/events/EExport.h\ - mds/events/EFragment.h\ - mds/events/EImportFinish.h\ - mds/events/EImportStart.h\ - mds/events/EMetaBlob.h\ - mds/events/EOpen.h\ - mds/events/EResetJournal.h\ - mds/events/ESession.h\ - mds/events/ESessions.h\ - mds/events/ESlaveUpdate.h\ - mds/events/ESubtreeMap.h\ - mds/events/ETableClient.h\ - mds/events/ETableServer.h\ - mds/events/EUpdate.h\ - mds/mds_table_types.h\ - mds/mdstypes.h\ - mds/snap.h\ - messages/MAuth.h\ - messages/MAuthReply.h\ - messages/MCacheExpire.h\ - messages/MClientCaps.h\ - messages/MClientCapRelease.h\ - messages/MClientLease.h\ - messages/MClientReconnect.h\ - messages/MClientReply.h\ - messages/MClientRequest.h\ - messages/MClientRequestForward.h\ - messages/MClientSession.h\ - messages/MClientSnap.h\ - messages/MCommand.h\ - messages/MCommandReply.h\ - messages/MDentryLink.h\ - messages/MDentryUnlink.h\ - messages/MDirUpdate.h\ - messages/MDiscover.h\ - messages/MDiscoverReply.h\ - messages/MExportCaps.h\ - messages/MExportCapsAck.h\ - messages/MExportDir.h\ - messages/MExportDirAck.h\ - messages/MExportDirCancel.h\ - messages/MExportDirDiscover.h\ - messages/MExportDirDiscoverAck.h\ - messages/MExportDirFinish.h\ - messages/MExportDirNotify.h\ - messages/MExportDirNotifyAck.h\ - messages/MExportDirPrep.h\ - messages/MExportDirPrepAck.h\ - messages/MGenericMessage.h\ - messages/MGetPoolStats.h\ - messages/MGetPoolStatsReply.h\ - messages/MHeartbeat.h\ - messages/MInodeFileCaps.h\ - messages/MLock.h\ - messages/MLog.h\ - messages/MLogAck.h\ - messages/MMDSBeacon.h\ - messages/MMDSCacheRejoin.h\ - messages/MMDSLoadTargets.h\ - messages/MMDSFindIno.h\ - messages/MMDSFindInoReply.h\ - messages/MMDSFragmentNotify.h\ - messages/MMDSMap.h\ - messages/MMDSOpenIno.h \ - messages/MMDSOpenInoReply.h \ - messages/MMDSResolve.h\ - messages/MMDSResolveAck.h\ - messages/MMDSSlaveRequest.h\ - messages/MMDSTableRequest.h\ - messages/MMonCommand.h\ - messages/MMonCommandAck.h\ - messages/MMonElection.h\ - messages/MMonGetMap.h\ - messages/MMonGetVersion.h\ - messages/MMonGetVersionReply.h\ - messages/MMonGlobalID.h\ - messages/MMonHealth.h\ - messages/MMonJoin.h\ - messages/MMonMap.h\ - messages/MMonPaxos.h\ - messages/MMonProbe.h\ - messages/MMonScrub.h \ - messages/MMonSubscribe.h\ - messages/MMonSubscribeAck.h\ - messages/MMonSync.h \ - messages/MOSDAlive.h\ - messages/MOSDBoot.h\ - messages/MOSDFailure.h\ - messages/MOSDMarkMeDown.h\ - messages/MOSDMap.h\ - messages/MOSDOp.h\ - messages/MOSDOpReply.h\ - messages/MOSDPGBackfill.h\ - messages/MOSDPGCreate.h\ - messages/MOSDPGPush.h\ - messages/MOSDPGPull.h\ - messages/MOSDPGPushReply.h\ - messages/MOSDPGInfo.h\ - messages/MOSDPGLog.h\ - messages/MOSDPGMissing.h\ - messages/MOSDPGNotify.h\ - messages/MOSDPGQuery.h\ - messages/MOSDPGRemove.h\ - messages/MOSDPGScan.h\ - messages/MBackfillReserve.h\ - messages/MRecoveryReserve.h\ - messages/MMonQuorumService.h\ - messages/MOSDPGTemp.h\ - messages/MOSDPGTrim.h\ - messages/MOSDPing.h\ - messages/MOSDRepScrub.h\ - messages/MOSDScrub.h\ - messages/MOSDSubOp.h\ - messages/MOSDSubOpReply.h\ - messages/MPGStats.h\ - messages/MPGStatsAck.h\ - messages/MPing.h\ - messages/MPoolOp.h\ - messages/MPoolOpReply.h\ - messages/MRemoveSnaps.h\ - messages/MRoute.h\ - messages/MForward.h\ - messages/MStatfs.h\ - messages/MStatfsReply.h\ - messages/MTimeCheck.h\ - messages/MWatchNotify.h\ - messages/PaxosServiceMessage.h\ - mon/AuthMonitor.h\ - mon/DataHealthService.h\ - mon/Elector.h\ - mon/LogMonitor.h\ - mon/ConfigKeyService.h\ - mon/HealthMonitor.h\ - mon/HealthService.h\ - mon/MDSMonitor.h\ - mon/MonmapMonitor.h\ - mon/MonCap.h\ - mon/MonClient.h\ - mon/MonCommands.h\ - mon/MonMap.h\ - mon/Monitor.h\ - mon/MonitorStore.h\ - mon/MonitorDBStore.h\ - mon/OSDMonitor.h\ - mon/PGMap.h\ - mon/PGMonitor.h\ - mon/Paxos.h\ - mon/PaxosService.h\ - mon/QuorumService.h\ - mon/Session.h\ - mon/mon_types.h\ - mount/canonicalize.c\ - mount/mtab.c\ - msg/Accepter.h\ - msg/DispatchQueue.h\ - msg/Dispatcher.h\ - msg/Message.h\ - msg/Messenger.h\ - msg/Pipe.h\ - msg/SimpleMessenger.h\ - msg/msg_types.h\ - objclass/objclass.h\ - os/btrfs_ioctl.h\ - os/ZFS.h\ - os/chain_xattr.h\ - os/hobject.h \ - os/CollectionIndex.h\ - os/FileJournal.h\ - os/FileStore.h\ - os/BtrfsFileStoreBackend.h\ - os/GenericFileStoreBackend.h\ - os/ZFSFileStoreBackend.h\ - os/FlatIndex.h\ - os/HashIndex.h\ - os/FDCache.h\ - os/WBThrottle.h\ - os/IndexManager.h\ - os/Journal.h\ - os/JournalingObjectStore.h\ - os/LFNIndex.h\ - os/ObjectStore.h\ - os/SequencerPosition.h\ - osd/Ager.h\ - osd/ClassHandler.h\ - osd/OSD.h\ - osd/OSDCap.h\ - osd/OSDMap.h\ - osd/ObjectVersioner.h\ - osd/OpRequest.h\ - osd/SnapMapper.h\ - osd/PG.h\ - osd/PGLog.h\ - osd/ReplicatedPG.h\ - osd/Watch.h\ - osd/osd_types.h\ - osdc/Blinker.h\ - osdc/Filer.h\ - osdc/Journaler.h\ - osdc/ObjectCacher.h\ - osdc/Objecter.h\ - osdc/Striper.h\ - osdc/WritebackHandler.h\ - perfglue/cpu_profiler.h\ - perfglue/heap_profiler.h\ - rgw/logrotate.conf\ - rgw/rgw_acl.h\ - rgw/rgw_acl_s3.h\ - rgw/rgw_acl_swift.h\ - rgw/rgw_client_io.h\ - rgw/rgw_fcgi.h\ - rgw/rgw_xml.h\ - rgw/rgw_cache.h\ - rgw/rgw_common.h\ - rgw/rgw_cors.h\ - rgw/rgw_cors_s3.h\ - rgw/rgw_cors_swift.h\ - rgw/rgw_string.h\ - rgw/rgw_formats.h\ - rgw/rgw_http_errors.h\ - rgw/rgw_log.h\ - rgw/rgw_multi.h\ - rgw/rgw_policy_s3.h\ - rgw/rgw_gc.h\ - rgw/rgw_metadata.h\ - rgw/rgw_multi_del.h\ - rgw/rgw_op.h\ - rgw/rgw_http_client.h\ - rgw/rgw_swift.h\ - rgw/rgw_swift_auth.h\ - rgw/rgw_rados.h\ - rgw/rgw_replica_log.h \ - rgw/rgw_resolve.h\ - rgw/rgw_rest.h\ - rgw/rgw_rest_swift.h\ - rgw/rgw_rest_s3.h\ - rgw/rgw_auth_s3.h\ - rgw/rgw_rest_admin.h\ - rgw/rgw_rest_usage.h\ - rgw/rgw_rest_user.h\ - rgw/rgw_rest_bucket.h\ - rgw/rgw_rest_client.h\ - rgw/rgw_rest_conn.h\ - rgw/rgw_tools.h\ - rgw/rgw_rest_metadata.h\ - rgw/rgw_rest_log.h\ - rgw/rgw_rest_opstate.h\ - rgw/rgw_rest_replica_log.h\ - rgw/rgw_rest_config.h\ - rgw/rgw_usage.h\ - rgw/rgw_user.h\ - rgw/rgw_bucket.h\ - rgw/rgw_keystone.h\ - sample.ceph.conf\ - tools/common.h\ - test/osd/RadosModel.h\ - test/osd/Object.h\ - test/osd/TestOpStat.h\ - global/pidfile.h\ - common/sync_filesystem.h \ - test/bench/distribution.h \ - test/bench/rados_backend.h \ - test/bench/rbd_backend.h \ - test/bench/bencher.h \ - test/bench/backend.h \ - test/bench/dumb_backend.h \ - test/bench/stat_collector.h \ - test/bench/detailed_stat_collector.h \ - test/bench/testfilestore_backend.h \ - test/common/ObjectContents.h \ - test/encoding/types.h \ - test/filestore/DeterministicOpSequence.h \ - test/filestore/FileStoreTracker.h \ - test/filestore/FileStoreDiff.h \ - test/filestore/TestFileStoreState.h \ - test/filestore/workload_generator.h \ - test/kv_store_bench.h \ - test/librados/test.h \ - test/ObjectMap/KeyValueDBMemory.h \ - test/omap_bench.h \ - test/osd/Object.h \ - test/osd/RadosModel.h \ - test/osd/TestOpStat.h \ - test/osdc/FakeWriteback.h \ - test/system/cross_process_sem.h \ - test/system/st_rados_create_pool.h \ - test/system/st_rados_list_objects.h \ - test/system/st_rados_delete_objs.h \ - test/system/st_rados_delete_pool.h \ - test/system/st_rados_notify.h \ - test/system/st_rados_watch.h \ - test/system/systest_runnable.h \ - test/system/systest_settings.h \ - test/unit.h \ - os/ObjectMap.h \ - os/DBObjectMap.h \ - os/KeyValueDB.h \ - os/LevelDBStore.h \ - common/cmdparse.h + sample.ceph.conf\ + bash_completion/ceph \ + bash_completion/rados \ + bash_completion/rbd \ + bash_completion/radosgw-admin \ + mount/canonicalize.c \ + mount/mtab.c \ + objclass/objclass.h + + +# coverage + +shell_scripts += ceph-coverage +bin_SCRIPTS += ceph-coverage + if ENABLE_COVERAGE COV_DIR = $(DESTDIR)$(libdir)/ceph/coverage @@ -2394,13 +390,6 @@ uninstall-local: uninstall-coverage -rmdir -p $(DESTDIR)$(localstatedir)/log/ceph -rmdir -p $(DESTDIR)$(localstatedir)/lib/ceph/tmp -# if we are doing a debug build, tell make to actually build the debug -# targets -if WITH_DEBUG -bin_PROGRAMS += $(bin_DEBUGPROGRAMS) -endif - - # # coverity rules expect: # - cov-build to be in the path diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am new file mode 100644 index 00000000000..27342078150 --- /dev/null +++ b/src/arch/Makefile.am @@ -0,0 +1,11 @@ +libarch_la_SOURCES = \ + arch/intel.c \ + arch/neon.c \ + arch/probe.cc + +noinst_LTLIBRARIES += libarch.la + +noinst_HEADERS += \ + arch/intel.h \ + arch/neon.h \ + arch/probe.h diff --git a/src/arch/neon.c b/src/arch/neon.c new file mode 100644 index 00000000000..32c1f621ef7 --- /dev/null +++ b/src/arch/neon.c @@ -0,0 +1,51 @@ +#include "arch/probe.h" + +/* flags we export */ +int ceph_arch_neon = 0; + +#include <stdio.h> + +#if __linux__ + +#include <elf.h> +#include <link.h> // ElfW macro + +#if __arm__ +#include <asm/hwcap.h> +#endif // __arm__ + +static unsigned long get_auxval(unsigned long type) +{ + unsigned long result = 0; + FILE *f = fopen("/proc/self/auxv", "r"); + if (f) { + ElfW(auxv_t) entry; + while (fread(&entry, sizeof(entry), 1, f)) { + if (entry.a_type == type) { + result = entry.a_un.a_val; + break; + } + } + fclose(f); + } + return result; +} + +static unsigned long get_hwcap(void) +{ + return get_auxval(AT_HWCAP); +} + +#endif // __linux__ + +int ceph_arch_neon_probe(void) +{ +#if __arm__ && __linux__ + ceph_arch_neon = (get_hwcap() & HWCAP_NEON) == HWCAP_NEON; +#else + if (0) + get_hwcap(); // make compiler shut up +#endif + return 0; +} + diff --git a/src/arch/neon.h b/src/arch/neon.h new file mode 100644 index 00000000000..0c8aacf5e87 --- /dev/null +++ b/src/arch/neon.h @@ -0,0 +1,16 @@ +#ifndef CEPH_ARCH_NEON_H +#define CEPH_ARCH_NEON_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern int ceph_arch_neon; /* true if we have ARM NEON abilities */ + +extern int ceph_arch_neon_probe(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/arch/probe.cc b/src/arch/probe.cc index 9f8bc9d2d0f..8648e54d945 100644 --- a/src/arch/probe.cc +++ b/src/arch/probe.cc @@ -4,6 +4,7 @@ #include "arch/probe.h" #include "arch/intel.h" +#include "arch/neon.h" int ceph_arch_probe(void) { @@ -11,6 +12,7 @@ int ceph_arch_probe(void) return 1; ceph_arch_intel_probe(); + ceph_arch_neon_probe(); ceph_arch_probed = 1; return 1; diff --git a/src/auth/AuthMethodList.h b/src/auth/AuthMethodList.h index 7b21b325aeb..b5aae0bba49 100644 --- a/src/auth/AuthMethodList.h +++ b/src/auth/AuthMethodList.h @@ -15,7 +15,8 @@ #ifndef CEPH_AUTHMETHODLIST_H #define CEPH_AUTHMETHODLIST_H -#include "include/inttypes.h" +#include "include/int_types.h" + #include <list> #include <set> #include <string> diff --git a/src/auth/Makefile.am b/src/auth/Makefile.am new file mode 100644 index 00000000000..f7f3b386df5 --- /dev/null +++ b/src/auth/Makefile.am @@ -0,0 +1,46 @@ +libauth_la_SOURCES = \ + auth/AuthAuthorizeHandler.cc \ + auth/AuthClientHandler.cc \ + auth/AuthSessionHandler.cc \ + auth/AuthServiceHandler.cc \ + auth/AuthMethodList.cc \ + auth/cephx/CephxAuthorizeHandler.cc \ + auth/cephx/CephxClientHandler.cc \ + auth/cephx/CephxProtocol.cc \ + auth/cephx/CephxServiceHandler.cc \ + auth/cephx/CephxSessionHandler.cc \ + auth/cephx/CephxKeyServer.cc \ + auth/none/AuthNoneAuthorizeHandler.cc \ + auth/unknown/AuthUnknownAuthorizeHandler.cc \ + auth/Crypto.cc \ + auth/KeyRing.cc \ + auth/RotatingKeyRing.cc +noinst_LTLIBRARIES += libauth.la + +noinst_HEADERS += \ + auth/cephx/CephxAuthorizeHandler.h \ + auth/cephx/CephxKeyServer.h \ + auth/cephx/CephxProtocol.h \ + auth/cephx/CephxClientHandler.h \ + auth/cephx/CephxServiceHandler.h \ + auth/cephx/CephxSessionHandler.h \ + auth/none/AuthNoneAuthorizeHandler.h \ + auth/none/AuthNoneClientHandler.h \ + auth/none/AuthNoneServiceHandler.h \ + auth/none/AuthNoneSessionHandler.h \ + auth/none/AuthNoneProtocol.h \ + auth/unknown/AuthUnknownAuthorizeHandler.h \ + auth/unknown/AuthUnknownClientHandler.h \ + auth/unknown/AuthUnknownServiceHandler.h \ + auth/unknown/AuthUnknownSessionHandler.h \ + auth/unknown/AuthUnknownProtocol.h \ + auth/Auth.h \ + auth/AuthMethodList.h \ + auth/AuthClientHandler.h \ + auth/AuthServiceHandler.h \ + auth/AuthSessionHandler.h \ + auth/AuthAuthorizeHandler.h \ + auth/KeyRing.h \ + auth/RotatingKeyRing.h \ + auth/Crypto.h + diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index 120f4f28f6e..f267d9c7450 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -170,7 +170,7 @@ int main(int argc, const char **argv) if (mc.get_monmap_privately() < 0) return -1; - int err = OSD::mkfs(g_conf->osd_data, g_conf->osd_journal, mc.monmap.fsid, whoami); + int err = OSD::mkfs(g_ceph_context, g_conf->osd_data, g_conf->osd_journal, mc.monmap.fsid, whoami); if (err < 0) { derr << TEXT_RED << " ** ERROR: error creating empty object store in " << g_conf->osd_data << ": " << cpp_strerror(-err) << TEXT_NORMAL << dendl; @@ -213,7 +213,7 @@ int main(int argc, const char **argv) exit(0); if (mkjournal) { common_init_finish(g_ceph_context); - int err = OSD::mkjournal(g_conf->osd_data, g_conf->osd_journal); + int err = OSD::mkjournal(g_ceph_context, g_conf->osd_data, g_conf->osd_journal); if (err < 0) { derr << TEXT_RED << " ** ERROR: error creating fresh journal " << g_conf->osd_journal << " for object store " << g_conf->osd_data @@ -226,7 +226,7 @@ int main(int argc, const char **argv) } if (flushjournal) { common_init_finish(g_ceph_context); - int err = OSD::flushjournal(g_conf->osd_data, g_conf->osd_journal); + int err = OSD::flushjournal(g_ceph_context, g_conf->osd_data, g_conf->osd_journal); if (err < 0) { derr << TEXT_RED << " ** ERROR: error flushing journal " << g_conf->osd_journal << " for object store " << g_conf->osd_data @@ -240,7 +240,7 @@ int main(int argc, const char **argv) } if (dump_journal) { common_init_finish(g_ceph_context); - int err = OSD::dump_journal(g_conf->osd_data, g_conf->osd_journal, cout); + int err = OSD::dump_journal(g_ceph_context, g_conf->osd_data, g_conf->osd_journal, cout); if (err < 0) { derr << TEXT_RED << " ** ERROR: error dumping journal " << g_conf->osd_journal << " for object store " << g_conf->osd_data @@ -435,7 +435,7 @@ int main(int argc, const char **argv) return -1; global_init_chdir(g_ceph_context); - osd = new OSD(whoami, + osd = new OSD(g_ceph_context, whoami, ms_cluster, ms_public, ms_hbclient, diff --git a/src/client/Makefile.am b/src/client/Makefile.am new file mode 100644 index 00000000000..53107eba517 --- /dev/null +++ b/src/client/Makefile.am @@ -0,0 +1,35 @@ +libclient_la_SOURCES = \ + client/Client.cc \ + client/Inode.cc \ + client/Dentry.cc \ + client/MetaRequest.cc \ + client/ClientSnapRealm.cc \ + client/MetaSession.cc \ + client/Trace.cc +libclient_la_LIBADD = $(LIBOSDC) $(LIBEDIT_LIBS) +noinst_LTLIBRARIES += libclient.la + +noinst_HEADERS += \ + client/Client.h \ + client/Dentry.h \ + client/Dir.h \ + client/Fh.h \ + client/Inode.h \ + client/MetaRequest.h \ + client/MetaSession.h \ + client/ClientSnapRealm.h \ + client/SyntheticClient.h \ + client/Trace.h \ + client/ioctl.h \ + client/ObjecterWriteback.h + +if WITH_FUSE +libclient_fuse_la_SOURCES = client/fuse_ll.cc +libclient_fuse_la_LIBADD = libclient.la -lfuse +noinst_LTLIBRARIES += libclient_fuse.la +noinst_HEADERS += client/fuse_ll.h +endif + +ceph_test_ioctls_SOURCES = client/test_ioctls.c +bin_DEBUGPROGRAMS += ceph_test_ioctls + diff --git a/src/client/SyntheticClient.cc b/src/client/SyntheticClient.cc index cb211f5461b..6b2c7b10565 100644 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@ -267,7 +267,7 @@ void parse_syn_options(vector<const char*>& args) } -SyntheticClient::SyntheticClient(Client *client, int w) +SyntheticClient::SyntheticClient(Client *client, int w) { this->client = client; whoami = w; @@ -282,7 +282,7 @@ SyntheticClient::SyntheticClient(Client *client, int w) this->iargs = syn_iargs; this->sargs = syn_sargs; - run_start = ceph_clock_now(g_ceph_context); + run_start = ceph_clock_now(client->cct); } @@ -332,7 +332,7 @@ int SyntheticClient::run() return -1; } - //run_start = ceph_clock_now(g_ceph_context); + //run_start = ceph_clock_now(client->cct); run_until = utime_t(0,0); dout(5) << "run" << dendl; @@ -442,7 +442,7 @@ int SyntheticClient::run() iargs.pop_front(); if (iarg1 && run_me()) { dout(2) << "sleepuntil " << iarg1 << dendl; - utime_t at = ceph_clock_now(g_ceph_context) - run_start; + utime_t at = ceph_clock_now(client->cct) - run_start; if (at.sec() < iarg1) sleep(iarg1 - at.sec()); } @@ -797,14 +797,14 @@ int SyntheticClient::run() if (iarg1 == 0) iarg1 = 1; // play trace at least once! for (int i=0; i<iarg1; i++) { - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(client->cct); if (time_to_stop()) break; play_trace(t, prefix, !playdata); if (time_to_stop()) break; if (iarg1 > 1) clean_dir(prefix); // clean only if repeat - utime_t lat = ceph_clock_now(g_ceph_context); + utime_t lat = ceph_clock_now(client->cct); lat -= start; dout(0) << " trace " << tfile << " loop " << (i+1) << "/" << iarg1 << " done in " << (double)lat << " seconds" << dendl; @@ -1012,7 +1012,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) char buf[1024]; char buf2[1024]; - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(client->cct); hash_map<int64_t, int64_t> open_files; hash_map<int64_t, dir_result_t*> open_dirs; @@ -1046,7 +1046,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) Cond cond; bool ack; bool safe; - C_GatherBuilder safeg(g_ceph_context, new C_SafeCond(&lock, &cond, &safe)); + C_GatherBuilder safeg(client->cct, new C_SafeCond(&lock, &cond, &safe)); Context *safegref = safeg.new_sub(); // take a ref while (!t.end()) { @@ -1436,7 +1436,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) bufferlist bl; bl.push_back(bp); SnapContext snapc; - client->objecter->write(oid, oloc, off, len, snapc, bl, ceph_clock_now(g_ceph_context), 0, + client->objecter->write(oid, oloc, off, len, snapc, bl, ceph_clock_now(client->cct), 0, new C_SafeCond(&lock, &cond, &ack), safeg.new_sub()); safeg.activate(); @@ -1452,7 +1452,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only) object_locator_t oloc(CEPH_DATA_RULE); lock.Lock(); SnapContext snapc; - client->objecter->zero(oid, oloc, off, len, snapc, ceph_clock_now(g_ceph_context), 0, + client->objecter->zero(oid, oloc, off, len, snapc, ceph_clock_now(client->cct), 0, new C_SafeCond(&lock, &cond, &ack), safeg.new_sub()); safeg.activate(); @@ -1762,9 +1762,9 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep dout(3) << "read_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl; list<string> contents; - utime_t s = ceph_clock_now(g_ceph_context); + utime_t s = ceph_clock_now(client->cct); int r = client->getdir(basedir, contents); - utime_t e = ceph_clock_now(g_ceph_context); + utime_t e = ceph_clock_now(client->cct); e -= s; if (r < 0) { dout(0) << "read_dirs couldn't readdir " << basedir << ", stopping" << dendl; @@ -1773,12 +1773,12 @@ int SyntheticClient::read_dirs(const char *basedir, int dirs, int files, int dep for (int i=0; i<files; i++) { snprintf(d, sizeof(d), "%s/file.%d", basedir, i); - utime_t s = ceph_clock_now(g_ceph_context); + utime_t s = ceph_clock_now(client->cct); if (client->lstat(d, &st) < 0) { dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl; return -1; } - utime_t e = ceph_clock_now(g_ceph_context); + utime_t e = ceph_clock_now(client->cct); e -= s; } @@ -1816,7 +1816,7 @@ int SyntheticClient::make_files(int num, int count, int priv, bool more) // files struct stat st; - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(client->cct); for (int c=0; c<count; c++) { for (int n=0; n<num; n++) { snprintf(d, sizeof(d), "dir.%d.run%d/file.client%d.%d", priv ? whoami:0, c, whoami, n); @@ -1833,7 +1833,7 @@ int SyntheticClient::make_files(int num, int count, int priv, bool more) if (time_to_stop()) return 0; } } - utime_t end = ceph_clock_now(g_ceph_context); + utime_t end = ceph_clock_now(client->cct); end -= start; dout(0) << "makefiles time is " << end << " or " << ((double)end / (double)num) <<" per file" << dendl; @@ -1851,24 +1851,24 @@ int SyntheticClient::link_test() client->mkdir("orig", 0755); client->mkdir("copy", 0755); - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(client->cct); for (int i=0; i<num; i++) { snprintf(d, sizeof(d), "orig/file.%d", i); client->mknod(d, 0755); } - utime_t end = ceph_clock_now(g_ceph_context); + utime_t end = ceph_clock_now(client->cct); end -= start; dout(0) << "orig " << end << dendl; // link - start = ceph_clock_now(g_ceph_context); + start = ceph_clock_now(client->cct); for (int i=0; i<num; i++) { snprintf(d, sizeof(d), "orig/file.%d", i); snprintf(e, sizeof(e), "copy/file.%d", i); client->link(d, e); } - end = ceph_clock_now(g_ceph_context); + end = ceph_clock_now(client->cct); end -= start; dout(0) << "copy " << end << dendl; @@ -1982,7 +1982,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize) // size i return fd; } - utime_t from = ceph_clock_now(g_ceph_context); + utime_t from = ceph_clock_now(client->cct); utime_t start = from; uint64_t bytes = 0, total = 0; @@ -2010,7 +2010,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize) // size i bytes += wrsize; total += wrsize; - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(client->cct); if (now - from >= 1.0) { double el = now - from; dout(0) << "write " << (bytes / el / 1048576.0) << " MB/sec" << dendl; @@ -2021,7 +2021,7 @@ int SyntheticClient::write_file(string& fn, int size, loff_t wrsize) // size i client->fsync(fd, true); - utime_t stop = ceph_clock_now(g_ceph_context); + utime_t stop = ceph_clock_now(client->cct); double el = stop - start; dout(0) << "write total " << (total / el / 1048576.0) << " MB/sec (" << total << " bytes in " << el << " seconds)" << dendl; @@ -2098,7 +2098,7 @@ int SyntheticClient::read_file(const std::string& fn, int size, return fd; } - utime_t from = ceph_clock_now(g_ceph_context); + utime_t from = ceph_clock_now(client->cct); utime_t start = from; uint64_t bytes = 0, total = 0; @@ -2114,7 +2114,7 @@ int SyntheticClient::read_file(const std::string& fn, int size, bytes += rdsize; total += rdsize; - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(client->cct); if (now - from >= 1.0) { double el = now - from; dout(0) << "read " << (bytes / el / 1048576.0) << " MB/sec" << dendl; @@ -2146,7 +2146,7 @@ int SyntheticClient::read_file(const std::string& fn, int size, dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl; } - utime_t stop = ceph_clock_now(g_ceph_context); + utime_t stop = ceph_clock_now(client->cct); double el = stop - start; dout(0) << "read total " << (total / el / 1048576.0) << " MB/sec (" << total << " bytes in " << el << " seconds)" << dendl; @@ -2181,7 +2181,7 @@ public: int SyntheticClient::create_objects(int nobj, int osize, int inflight) { // divy up - int numc = g_conf->num_client ? g_conf->num_client : 1; + int numc = client->cct->_conf->num_client ? client->cct->_conf->num_client : 1; int start, inc, end; @@ -2226,9 +2226,9 @@ int SyntheticClient::create_objects(int nobj, int osize, int inflight) } dout(10) << "writing " << oid << dendl; - starts.push_back(ceph_clock_now(g_ceph_context)); + starts.push_back(ceph_clock_now(client->cct)); client->client_lock.Lock(); - client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(g_ceph_context), 0, + client->objecter->write(oid, oloc, 0, osize, snapc, bl, ceph_clock_now(client->cct), 0, new C_Ref(lock, cond, &unack), new C_Ref(lock, cond, &unsafe)); client->client_lock.Unlock(); @@ -2240,7 +2240,7 @@ int SyntheticClient::create_objects(int nobj, int osize, int inflight) } lock.Unlock(); - utime_t lat = ceph_clock_now(g_ceph_context); + utime_t lat = ceph_clock_now(client->cct); lat -= starts.front(); starts.pop_front(); } @@ -2323,7 +2323,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc, SnapContext snapc; client->client_lock.Lock(); - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(client->cct); if (write) { dout(10) << "write to " << oid << dendl; @@ -2339,7 +2339,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc, op.op.op = CEPH_OSD_OP_STARTSYNC; m.ops.push_back(op); } - client->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(g_ceph_context), 0, + client->objecter->mutate(oid, oloc, m, snapc, ceph_clock_now(client->cct), 0, NULL, new C_Ref(lock, cond, &unack)); /*client->objecter->write(oid, layout, 0, osize, snapc, bl, 0, new C_Ref(lock, cond, &unack), @@ -2359,7 +2359,7 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc, } lock.Unlock(); - utime_t lat = ceph_clock_now(g_ceph_context); + utime_t lat = ceph_clock_now(client->cct); lat -= start; if (client->logger) { if (write) @@ -3292,7 +3292,7 @@ void SyntheticClient::import_find(const char *base, const char *find, bool data) if (sp < 0) dirnum++; //dout(0) << "leading dir " << filename << " " << dirnum << dendl; - if (dirnum % g_conf->num_client != client->get_nodeid()) { + if (dirnum % client->cct->_conf->num_client != client->get_nodeid()) { dout(20) << "skipping leading dir " << dirnum << " " << filename << dendl; continue; } diff --git a/src/client/SyntheticClient.h b/src/client/SyntheticClient.h index 3bbcb73cb1a..f9f4e3de0fb 100644 --- a/src/client/SyntheticClient.h +++ b/src/client/SyntheticClient.h @@ -205,7 +205,7 @@ class SyntheticClient { } bool time_to_stop() { - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(client->cct); if (0) cout << "time_to_stop .. now " << now << " until " << run_until << " start " << run_start @@ -271,6 +271,7 @@ class SyntheticClient { void mksnap(const char *base, const char *name); void rmsnap(const char *base, const char *name); void mksnapfile(const char *dir); + }; #endif diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 0c78557f041..6bf5ea3d34f 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -330,7 +330,7 @@ static void fuse_ll_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info * if (r == 0) { fi->fh = (long)fh; #if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8) - if (g_conf->fuse_use_invalidate_cb) + if (cfuse->client->cct->_conf->fuse_use_invalidate_cb) fi->keep_cache = 1; #endif fuse_reply_open(req, fi); @@ -673,24 +673,24 @@ int CephFuse::Handle::init(int argc, const char *argv[]) newargv[newargc++] = argv[0]; newargv[newargc++] = "-f"; // stay in foreground - if (g_conf->fuse_allow_other) { + if (client->cct->_conf->fuse_allow_other) { newargv[newargc++] = "-o"; newargv[newargc++] = "allow_other"; } - if (g_conf->fuse_default_permissions) { + if (client->cct->_conf->fuse_default_permissions) { newargv[newargc++] = "-o"; newargv[newargc++] = "default_permissions"; } - if (g_conf->fuse_big_writes) { + if (client->cct->_conf->fuse_big_writes) { newargv[newargc++] = "-o"; newargv[newargc++] = "big_writes"; } - if (g_conf->fuse_atomic_o_trunc) { + if (client->cct->_conf->fuse_atomic_o_trunc) { newargv[newargc++] = "-o"; newargv[newargc++] = "atomic_o_trunc"; } - if (g_conf->fuse_debug) + if (client->cct->_conf->fuse_debug) newargv[newargc++] = "-d"; for (int argctr = 1; argctr < argc; argctr++) @@ -744,7 +744,7 @@ int CephFuse::Handle::init(int argc, const char *argv[]) */ - if (g_conf->fuse_use_invalidate_cb) + if (client->cct->_conf->fuse_use_invalidate_cb) client->ll_register_ino_invalidate_cb(invalidate_cb, this); done: diff --git a/src/client/ioctl.h b/src/client/ioctl.h index c15d3340a76..35b4ce4ac0f 100644 --- a/src/client/ioctl.h +++ b/src/client/ioctl.h @@ -1,13 +1,14 @@ #ifndef FS_CEPH_IOCTL_H #define FS_CEPH_IOCTL_H +#include "include/int_types.h" + #if defined(__linux__) #include <linux/ioctl.h> #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/ioctl.h> #include <sys/types.h> -#include "include/inttypes.h" #endif #define CEPH_IOCTL_MAGIC 0x97 diff --git a/src/cls/Makefile.am b/src/cls/Makefile.am new file mode 100644 index 00000000000..0c04c64faa7 --- /dev/null +++ b/src/cls/Makefile.am @@ -0,0 +1,118 @@ +## Rados object classes + +libcls_hello_la_SOURCES = cls/hello/cls_hello.cc +libcls_hello_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_hello_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_hello.la + +libcls_rbd_la_SOURCES = cls/rbd/cls_rbd.cc +libcls_rbd_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_rbd_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_rbd.la + +libcls_lock_la_SOURCES = cls/lock/cls_lock.cc +libcls_lock_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_lock_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_lock.la + +libcls_refcount_la_SOURCES = \ + cls/refcount/cls_refcount.cc \ + cls/refcount/cls_refcount_ops.cc \ + common/ceph_json.cc +libcls_refcount_la_LIBADD = libjson_spirit.la $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_refcount_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_refcount.la + +libcls_version_la_SOURCES = cls/version/cls_version.cc +libcls_version_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_version_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_version.la + +libcls_log_la_SOURCES = cls/log/cls_log.cc +libcls_log_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_log_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_log.la + +libcls_statelog_la_SOURCES = cls/statelog/cls_statelog.cc +libcls_statelog_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_statelog_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_statelog.la + +libcls_replica_log_la_SOURCES = cls/replica_log/cls_replica_log.cc +libcls_replica_log_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_replica_log_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_replica_log.la + +libcls_rgw_la_SOURCES = \ + cls/rgw/cls_rgw.cc \ + cls/rgw/cls_rgw_ops.cc \ + cls/rgw/cls_rgw_types.cc \ + common/ceph_json.cc +libcls_rgw_la_LIBADD = libjson_spirit.la $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_rgw_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_rgw.la + +## Rados object client classes + +libcls_lock_client_la_SOURCES = \ + cls/lock/cls_lock_client.cc \ + cls/lock/cls_lock_types.cc \ + cls/lock/cls_lock_ops.cc +noinst_LTLIBRARIES += libcls_lock_client.la + +libcls_refcount_client_la_SOURCES = \ + cls/refcount/cls_refcount_client.cc \ + cls/refcount/cls_refcount_ops.cc +noinst_LTLIBRARIES += libcls_refcount_client.la + +libcls_version_client_a_SOURCES = \ + cls/version/cls_version_client.cc \ + cls/version/cls_version_types.cc +noinst_LIBRARIES += libcls_version_client.a + +libcls_log_client_a_SOURCES = cls/log/cls_log_client.cc +noinst_LIBRARIES += libcls_log_client.a + +libcls_statelog_client_a_SOURCES = cls/statelog/cls_statelog_client.cc +noinst_LIBRARIES += libcls_statelog_client.a + +libcls_replica_log_client_a_SOURCES = \ + cls/replica_log/cls_replica_log_types.cc \ + cls/replica_log/cls_replica_log_ops.cc \ + cls/replica_log/cls_replica_log_client.cc +noinst_LIBRARIES += libcls_replica_log_client.a + +libcls_rgw_client_la_SOURCES = \ + cls/rgw/cls_rgw_client.cc \ + cls/rgw/cls_rgw_types.cc \ + cls/rgw/cls_rgw_ops.cc +noinst_LTLIBRARIES += libcls_rgw_client.la + +libcls_rbd_client_la_SOURCES = cls/rbd/cls_rbd_client.cc +noinst_LTLIBRARIES += libcls_rbd_client.la + + +noinst_HEADERS += \ + cls/lock/cls_lock_types.h \ + cls/lock/cls_lock_ops.h \ + cls/lock/cls_lock_client.h \ + cls/rbd/cls_rbd.h \ + cls/rbd/cls_rbd_client.h \ + cls/refcount/cls_refcount_ops.h \ + cls/refcount/cls_refcount_client.h \ + cls/version/cls_version_types.h \ + cls/version/cls_version_ops.h \ + cls/version/cls_version_client.h \ + cls/log/cls_log_types.h \ + cls/log/cls_log_ops.h \ + cls/log/cls_log_client.h \ + cls/statelog/cls_statelog_types.h \ + cls/statelog/cls_statelog_ops.h \ + cls/statelog/cls_statelog_client.h \ + cls/replica_log/cls_replica_log_types.h \ + cls/replica_log/cls_replica_log_ops.h \ + cls/replica_log/cls_replica_log_client.h \ + cls/rgw/cls_rgw_client.h \ + cls/rgw/cls_rgw_ops.h \ + cls/rgw/cls_rgw_types.h + diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index 420de514ee6..12947a08540 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -25,6 +25,8 @@ * parameters as the client sees them - it would be silly to mention * in each one that they take an input and an output bufferlist. */ +#include "include/int_types.h" +#include "include/types.h" #include <algorithm> #include <cstring> @@ -35,10 +37,8 @@ #include <sstream> #include <vector> -#include "include/types.h" #include "objclass/objclass.h" #include "include/rbd_types.h" -#include <inttypes.h> #include "cls/rbd/cls_rbd.h" diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 6cda4cba5c3..2f5711ecb32 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -1,14 +1,14 @@ // -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include <iostream> +#include "include/int_types.h" +#include "include/types.h" +#include <iostream> #include <string.h> #include <stdlib.h> #include <errno.h> -#include <inttypes.h> -#include "include/types.h" #include "include/utime.h" #include "objclass/objclass.h" #include "cls/rgw/cls_rgw_ops.h" diff --git a/src/common/Formatter.cc b/src/common/Formatter.cc index c08ea5b9a20..4ef833a45f8 100644 --- a/src/common/Formatter.cc +++ b/src/common/Formatter.cc @@ -14,11 +14,12 @@ #define LARGE_SIZE 1024 +#include "include/int_types.h" + #include "assert.h" #include "Formatter.h" #include "common/escape.h" -#include <inttypes.h> #include <iostream> #include <sstream> #include <stdarg.h> diff --git a/src/common/Formatter.h b/src/common/Formatter.h index da730103f41..27089ce04f2 100644 --- a/src/common/Formatter.h +++ b/src/common/Formatter.h @@ -1,8 +1,9 @@ #ifndef CEPH_FORMATTER_H #define CEPH_FORMATTER_H +#include "include/int_types.h" + #include <deque> -#include <inttypes.h> #include <iostream> #include <list> #include <ostream> diff --git a/src/common/Makefile.am b/src/common/Makefile.am new file mode 100644 index 00000000000..4c027909b4d --- /dev/null +++ b/src/common/Makefile.am @@ -0,0 +1,195 @@ +libcommon_la_SOURCES = \ + ceph_ver.c \ + common/DecayCounter.cc \ + common/LogClient.cc \ + common/LogEntry.cc \ + common/PrebufferedStreambuf.cc \ + common/BackTrace.cc \ + common/perf_counters.cc \ + common/Mutex.cc \ + common/OutputDataSocket.cc \ + common/admin_socket.cc \ + common/admin_socket_client.cc \ + common/cmdparse.cc \ + common/escape.c \ + common/Clock.cc \ + common/Throttle.cc \ + common/Timer.cc \ + common/Finisher.cc \ + common/environment.cc\ + common/assert.cc \ + common/run_cmd.cc \ + common/WorkQueue.cc \ + common/ConfUtils.cc \ + common/MemoryModel.cc \ + common/armor.c \ + common/fd.cc \ + common/xattr.c \ + common/safe_io.c \ + common/snap_types.cc \ + common/str_list.cc \ + common/errno.cc \ + common/RefCountedObj.cc \ + common/blkdev.cc \ + common/common_init.cc \ + common/pipe.c \ + common/ceph_argparse.cc \ + common/ceph_context.cc \ + common/buffer.cc \ + common/code_environment.cc \ + common/dout.cc \ + common/signal.cc \ + common/simple_spin.cc \ + common/Thread.cc \ + common/Formatter.cc \ + common/HeartbeatMap.cc \ + common/config.cc \ + common/utf8.c \ + common/mime.c \ + common/strtol.cc \ + common/page.cc \ + common/lockdep.cc \ + common/version.cc \ + common/hex.cc \ + common/entity_name.cc \ + common/ceph_crypto.cc \ + common/ceph_crypto_cms.cc \ + common/ceph_json.cc \ + common/ipaddr.cc \ + common/pick_address.cc \ + common/util.cc \ + common/TextTable.cc \ + common/secret.c \ + common/ceph_fs.cc \ + common/ceph_hash.cc \ + common/ceph_strings.cc \ + common/ceph_frag.cc \ + common/addr_parsing.c \ + common/hobject.cc + +# these should go out of libcommon +libcommon_la_SOURCES += \ + mon/MonCap.cc \ + mon/MonClient.cc \ + mon/MonMap.cc \ + osd/OSDMap.cc \ + osd/osd_types.cc \ + mds/MDSMap.cc \ + mds/inode_backtrace.cc \ + mds/mdstypes.cc + +# inject crc in common +libcommon_crc_la_SOURCES = \ + common/sctp_crc32.c \ + common/crc32c.cc \ + common/crc32c_intel_baseline.c \ + common/crc32c_intel_fast.c + +if WITH_GOOD_YASM_ELF64 +libcommon_crc_la_SOURCES += common/crc32c_intel_fast_asm.S +libcommon_crc_la_LIBTOOLFLAGS = --tag=CC +endif +LIBCOMMON_DEPS += libcommon_crc.la +noinst_LTLIBRARIES += libcommon_crc.la + +noinst_HEADERS += \ + common/sctp_crc32.h \ + common/crc32c_intel_baseline.h \ + common/crc32c_intel_fast.h + + +# important; libmsg before libauth! +LIBCOMMON_DEPS += \ + $(LIBMSG) $(LIBAUTH) \ + $(LIBCRUSH) $(LIBJSON_SPIRIT) $(LIBLOG) $(LIBARCH) \ + -lkeyutils + +if LINUX +LIBCOMMON_DEPS += -lrt +endif # LINUX + +libcommon_la_LIBADD = $(LIBCOMMON_DEPS) + +noinst_HEADERS += \ + common/BackTrace.h \ + common/RefCountedObj.h \ + common/HeartbeatMap.h \ + common/LogClient.h \ + common/LogEntry.h \ + common/Preforker.h \ + common/WorkQueue.h \ + common/PrioritizedQueue.h \ + common/ceph_argparse.h \ + common/ceph_context.h \ + common/xattr.h \ + common/blkdev.h \ + common/compiler_extensions.h \ + common/debug.h \ + common/dout.h \ + common/escape.h \ + common/fd.h \ + common/version.h \ + common/hex.h \ + common/entity_name.h \ + common/errno.h \ + common/environment.h \ + common/likely.h \ + common/lockdep.h \ + common/obj_bencher.h \ + common/snap_types.h \ + common/Clock.h \ + common/Cond.h \ + common/ConfUtils.h \ + common/DecayCounter.h \ + common/Finisher.h \ + common/Formatter.h \ + common/perf_counters.h \ + common/OutputDataSocket.h \ + common/admin_socket.h \ + common/admin_socket_client.h \ + common/shared_cache.hpp \ + common/tracked_int_ptr.hpp \ + common/simple_cache.hpp \ + common/sharedptr_registry.hpp \ + common/map_cacher.hpp \ + common/MemoryModel.h \ + common/Mutex.h \ + common/PrebufferedStreambuf.h \ + common/RWLock.h \ + common/Semaphore.h \ + common/SimpleRNG.h \ + common/TextTable.h \ + common/Thread.h \ + common/Throttle.h \ + common/Timer.h \ + common/TrackedOp.h \ + common/arch.h \ + common/armor.h \ + common/common_init.h \ + common/pipe.h \ + common/code_environment.h \ + common/signal.h \ + common/simple_spin.h \ + common/run_cmd.h \ + common/safe_io.h \ + common/config.h \ + common/config_obs.h \ + common/config_opts.h \ + common/ceph_crypto.h \ + common/ceph_crypto_cms.h \ + common/ceph_json.h \ + common/lru_map.h \ + common/utf8.h \ + common/mime.h \ + common/pick_address.h \ + common/secret.h \ + common/strtol.h \ + common/static_assert.h \ + common/AsyncReserver.h \ + common/sync_filesystem.h \ + common/cmdparse.h \ + common/hobject.h + +noinst_LTLIBRARIES += libcommon.la + + diff --git a/src/common/OutputDataSocket.cc b/src/common/OutputDataSocket.cc index e4d21fe13ee..3051ca02dbe 100644 --- a/src/common/OutputDataSocket.cc +++ b/src/common/OutputDataSocket.cc @@ -12,6 +12,8 @@ * */ +#include "include/int_types.h" + #include "common/Thread.h" #include "common/OutputDataSocket.h" #include "common/config.h" @@ -25,7 +27,6 @@ #include <errno.h> #include <fcntl.h> -#include <inttypes.h> #include <map> #include <poll.h> #include <set> diff --git a/src/include/addr_parsing.c b/src/common/addr_parsing.c index c01f817772c..c01f817772c 100644 --- a/src/include/addr_parsing.c +++ b/src/common/addr_parsing.c diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 1a507e606bf..12e5868b409 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -12,6 +12,8 @@ * */ +#include "include/int_types.h" + #include "common/Thread.h" #include "common/admin_socket.h" #include "common/config.h" @@ -26,7 +28,6 @@ #include <errno.h> #include <fcntl.h> -#include <inttypes.h> #include <map> #include <poll.h> #include <set> diff --git a/src/common/admin_socket_client.cc b/src/common/admin_socket_client.cc index 782e808ad86..335695f9b4b 100644 --- a/src/common/admin_socket_client.cc +++ b/src/common/admin_socket_client.cc @@ -12,6 +12,8 @@ * */ +#include "include/int_types.h" + #include "common/admin_socket.h" #include "common/ceph_context.h" #include "common/errno.h" @@ -21,7 +23,6 @@ #include <arpa/inet.h> #include <errno.h> #include <fcntl.h> -#include <inttypes.h> #include <map> #include <poll.h> #include <sstream> diff --git a/src/common/blkdev.cc b/src/common/blkdev.cc index 22b0aa67b3e..b0dc0a54e9e 100644 --- a/src/common/blkdev.cc +++ b/src/common/blkdev.cc @@ -1,8 +1,8 @@ -#include <inttypes.h> +#include "include/int_types.h" + #include <fcntl.h> #include <sys/ioctl.h> #include <errno.h> - #include <sys/types.h> #include <sys/stat.h> #include <sys/mount.h> diff --git a/src/include/ceph_frag.cc b/src/common/ceph_frag.cc index ab6cf35c409..444b910c24e 100644 --- a/src/include/ceph_frag.cc +++ b/src/common/ceph_frag.cc @@ -1,7 +1,7 @@ /* * Ceph 'frag' type */ -#include "types.h" +#include "include/types.h" int ceph_frag_compare(__u32 a, __u32 b) { diff --git a/src/include/ceph_fs.cc b/src/common/ceph_fs.cc index 6e3c143361e..3172c577162 100644 --- a/src/include/ceph_fs.cc +++ b/src/common/ceph_fs.cc @@ -9,7 +9,7 @@ /* * Some non-inline ceph helpers */ -#include "types.h" +#include "include/types.h" /* * return true if @layout appears to be valid diff --git a/src/include/ceph_hash.cc b/src/common/ceph_hash.cc index d6081dfa97d..c581806d83d 100644 --- a/src/include/ceph_hash.cc +++ b/src/common/ceph_hash.cc @@ -1,5 +1,5 @@ -#include "types.h" +#include "include/types.h" /* * Robert Jenkin's hash function. diff --git a/src/include/ceph_strings.cc b/src/common/ceph_strings.cc index e86aae4fd50..cd08083967a 100644 --- a/src/include/ceph_strings.cc +++ b/src/common/ceph_strings.cc @@ -1,7 +1,7 @@ /* * Ceph string constants */ -#include "types.h" +#include "include/types.h" const char *ceph_entity_type_name(int type) { diff --git a/src/common/crc32c_intel_baseline.c b/src/common/crc32c_intel_baseline.c index cfcfec624ae..3a92c77b63c 100644 --- a/src/common/crc32c_intel_baseline.c +++ b/src/common/crc32c_intel_baseline.c @@ -34,7 +34,8 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <inttypes.h> +#include "include/int_types.h" + #include <stdlib.h> #define MAX_ITER 8 diff --git a/src/common/crc32c_intel_baseline.h b/src/common/crc32c_intel_baseline.h index 5b14ddfc07e..e463575e28c 100644 --- a/src/common/crc32c_intel_baseline.h +++ b/src/common/crc32c_intel_baseline.h @@ -1,6 +1,8 @@ #ifndef CEPH_COMMON_CRC32C_INTEL_BASELINE_H #define CEPH_COMMON_CRC32C_INTEL_BASELINE_H +#include "include/int_types.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/src/common/crc32c_intel_fast.c b/src/common/crc32c_intel_fast.c index 10b3c1c5c27..0532dd261cf 100644 --- a/src/common/crc32c_intel_fast.c +++ b/src/common/crc32c_intel_fast.c @@ -1,13 +1,30 @@ -#include <inttypes.h> #include "acconfig.h" +#include "include/int_types.h" + +#include "common/crc32c_intel_baseline.h" extern unsigned int crc32_iscsi_00(unsigned char const *buffer, int len, unsigned int crc); -#ifdef WITH_GOOD_YASM_ELF64 +#ifdef HAVE_GOOD_YASM_ELF64 uint32_t ceph_crc32c_intel_fast(uint32_t crc, unsigned char const *buffer, unsigned len) { - return crc32_iscsi_00(buffer, len, crc); + uint32_t v; + unsigned left; + + /* + * the crc32_iscsi_00 method reads past buffer+len (because it + * reads full words) which makes valgrind unhappy. don't do + * that. + */ + if (len < 16) + return ceph_crc32c_intel_baseline(crc, buffer, len); + left = ((unsigned long)buffer + len) & 7; + len -= left; + v = crc32_iscsi_00(buffer, len, crc); + if (left) + v = ceph_crc32c_intel_baseline(v, buffer + len, left); + return v; } int ceph_crc32c_intel_fast_exists(void) diff --git a/src/os/hobject.cc b/src/common/hobject.cc index d6273693c62..d6273693c62 100644 --- a/src/os/hobject.cc +++ b/src/common/hobject.cc diff --git a/src/os/hobject.h b/src/common/hobject.h index 633e471dffc..633e471dffc 100644 --- a/src/os/hobject.h +++ b/src/common/hobject.h diff --git a/src/common/obj_bencher.cc b/src/common/obj_bencher.cc index 6490b4f5932..599cbbc62fb 100644 --- a/src/common/obj_bencher.cc +++ b/src/common/obj_bencher.cc @@ -79,7 +79,7 @@ ostream& ObjBencher::out(ostream& os, utime_t& t) ostream& ObjBencher::out(ostream& os) { - utime_t cur_time = ceph_clock_now(g_ceph_context); + utime_t cur_time = ceph_clock_now(cct); return out(os, cur_time); } @@ -95,7 +95,7 @@ void *ObjBencher::status_printer(void *_bencher) { ONE_SECOND.set_from_double(1.0); bencher->lock.Lock(); while(!data.done) { - utime_t cur_time = ceph_clock_now(g_ceph_context); + utime_t cur_time = ceph_clock_now(bencher->cct); if (i % 20 == 0) { if (i > 0) @@ -158,7 +158,7 @@ void *ObjBencher::status_printer(void *_bencher) { } ++i; ++cycleSinceChange; - cond.WaitInterval(g_ceph_context, bencher->lock, ONE_SECOND); + cond.WaitInterval(bencher->cct, bencher->lock, ONE_SECOND); } bencher->lock.Unlock(); return NULL; @@ -339,10 +339,10 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, pthread_create(&print_thread, NULL, ObjBencher::status_printer, (void *)this); lock.Lock(); - data.start_time = ceph_clock_now(g_ceph_context); + data.start_time = ceph_clock_now(cct); lock.Unlock(); for (int i = 0; i<concurrentios; ++i) { - start_times[i] = ceph_clock_now(g_ceph_context); + start_times[i] = ceph_clock_now(cct); r = create_completion(i, _aio_cb, (void *)&lc); if (r < 0) goto ERR; @@ -365,7 +365,7 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, stopTime = data.start_time + runtime; slot = 0; lock.Lock(); - while( ceph_clock_now(g_ceph_context) < stopTime && + while( ceph_clock_now(cct) < stopTime && (!maxObjectsToCreate || data.started < maxObjectsToCreate)) { bool found = false; while (1) { @@ -397,7 +397,7 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, lock.Unlock(); goto ERR; } - data.cur_latency = ceph_clock_now(g_ceph_context) - start_times[slot]; + data.cur_latency = ceph_clock_now(cct) - start_times[slot]; data.history.latency.push_back(data.cur_latency); total_latency += data.cur_latency; if( data.cur_latency > data.max_latency) data.max_latency = data.cur_latency; @@ -407,11 +407,11 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, --data.in_flight; lock.Unlock(); release_completion(slot); - timePassed = ceph_clock_now(g_ceph_context) - data.start_time; + timePassed = ceph_clock_now(cct) - data.start_time; //write new stuff to backend, then delete old stuff //and save locations of new stuff for later deletion - start_times[slot] = ceph_clock_now(g_ceph_context); + start_times[slot] = ceph_clock_now(cct); r = create_completion(slot, _aio_cb, &lc); if (r < 0) goto ERR; @@ -438,7 +438,7 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, lock.Unlock(); goto ERR; } - data.cur_latency = ceph_clock_now(g_ceph_context) - start_times[slot]; + data.cur_latency = ceph_clock_now(cct) - start_times[slot]; data.history.latency.push_back(data.cur_latency); total_latency += data.cur_latency; if (data.cur_latency > data.max_latency) data.max_latency = data.cur_latency; @@ -451,7 +451,7 @@ int ObjBencher::write_bench(int secondsToRun, int maxObjectsToCreate, delete contents[slot]; } - timePassed = ceph_clock_now(g_ceph_context) - data.start_time; + timePassed = ceph_clock_now(cct) - data.start_time; lock.Lock(); data.done = true; lock.Unlock(); @@ -529,7 +529,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre lock.Lock(); data.finished = 0; - data.start_time = ceph_clock_now(g_ceph_context); + data.start_time = ceph_clock_now(cct); lock.Unlock(); pthread_t print_thread; @@ -539,7 +539,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre //start initial reads for (int i = 0; i < concurrentios; ++i) { index[i] = i; - start_times[i] = ceph_clock_now(g_ceph_context); + start_times[i] = ceph_clock_now(cct); create_completion(i, _aio_cb, (void *)&lc); r = aio_read(name[i], i, contents[i], data.object_size); if (r < 0) { //naughty, doesn't clean up heap -- oh, or handle the print thread! @@ -557,7 +557,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre bufferlist *cur_contents; slot = 0; - while (seconds_to_run && (ceph_clock_now(g_ceph_context) < finish_time) && + while (seconds_to_run && (ceph_clock_now(cct) < finish_time) && num_objects > data.started) { lock.Lock(); int old_slot = slot; @@ -590,7 +590,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre lock.Unlock(); goto ERR; } - data.cur_latency = ceph_clock_now(g_ceph_context) - start_times[slot]; + data.cur_latency = ceph_clock_now(cct) - start_times[slot]; total_latency += data.cur_latency; if( data.cur_latency > data.max_latency) data.max_latency = data.cur_latency; if (data.cur_latency < data.min_latency) data.min_latency = data.cur_latency; @@ -602,7 +602,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre cur_contents = contents[slot]; //start new read and check data if requested - start_times[slot] = ceph_clock_now(g_ceph_context); + start_times[slot] = ceph_clock_now(cct); contents[slot] = new bufferlist(); create_completion(slot, _aio_cb, (void *)&lc); r = aio_read(newName, slot, contents[slot], data.object_size); @@ -633,7 +633,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre lock.Unlock(); goto ERR; } - data.cur_latency = ceph_clock_now(g_ceph_context) - start_times[slot]; + data.cur_latency = ceph_clock_now(cct) - start_times[slot]; total_latency += data.cur_latency; if (data.cur_latency > data.max_latency) data.max_latency = data.cur_latency; if (data.cur_latency < data.min_latency) data.min_latency = data.cur_latency; @@ -650,7 +650,7 @@ int ObjBencher::seq_read_bench(int seconds_to_run, int num_objects, int concurre delete contents[slot]; } - runtime = ceph_clock_now(g_ceph_context) - data.start_time; + runtime = ceph_clock_now(cct) - data.start_time; lock.Lock(); data.done = true; lock.Unlock(); diff --git a/src/common/obj_bencher.h b/src/common/obj_bencher.h index d626eda376d..c8f671f8c90 100644 --- a/src/common/obj_bencher.h +++ b/src/common/obj_bencher.h @@ -16,6 +16,7 @@ #include "common/config.h" #include "common/Cond.h" +#include "common/ceph_context.h" struct bench_interval_data { double min_bandwidth; @@ -51,6 +52,8 @@ const int OP_RAND_READ = 3; class ObjBencher { bool show_time; +public: + CephContext *cct; protected: Mutex lock; @@ -89,7 +92,7 @@ protected: ostream& out(ostream& os); ostream& out(ostream& os, utime_t& t); public: - ObjBencher() : show_time(false), lock("ObjBencher::lock") {} + ObjBencher(CephContext *cct_) : show_time(false), cct(cct_), lock("ObjBencher::lock") {} virtual ~ObjBencher() {} int aio_bench( int operation, int secondsToRun, int maxObjectsToCreate, diff --git a/src/common/perf_counters.cc b/src/common/perf_counters.cc index 339ff6a372b..4fe1354fa63 100644 --- a/src/common/perf_counters.cc +++ b/src/common/perf_counters.cc @@ -12,13 +12,14 @@ * */ +#include "include/int_types.h" + #include "common/perf_counters.h" #include "common/dout.h" #include "common/errno.h" #include "common/Formatter.h" #include <errno.h> -#include <inttypes.h> #include <map> #include <sstream> #include <stdint.h> diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index aee621d8e32..5f92bf7e4ec 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -527,9 +527,17 @@ int CrushCompiler::parse_bucket(iter_t const& i) item_id[name] = id; item_weight[id] = bucketweight; - crush.add_bucket(id, alg, hash, type, size, &items[0], &weights[0]); - crush.set_item_name(id, name.c_str()); - return 0; + assert(id != 0); + int r = crush.add_bucket(id, alg, hash, type, size, &items[0], &weights[0], NULL); + if (r < 0) { + if (r == -EEXIST) + err << "Duplicate bucket id " << id << std::endl; + else + err << "add_bucket failed " << strerror(-r) << std::endl; + return r; + } + r = crush.set_item_name(id, name.c_str()); + return r; } int CrushCompiler::parse_rule(iter_t const& i) diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index e96e6123aab..bab9f9a817e 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -363,9 +363,15 @@ int CrushWrapper::insert_item(CephContext *cct, int item, float weight, string n if (!name_exists(q->second)) { ldout(cct, 5) << "insert_item creating bucket " << q->second << dendl; - int empty = 0; - cur = add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, p->first, 1, &cur, &empty); - set_item_name(cur, q->second); + int empty = 0, newid; + int r = add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, p->first, 1, &cur, &empty, &newid); + if (r < 0) { + char buf[128]; + ldout(cct, 1) << "add_bucket failure error: " << strerror_r(-r, buf, sizeof(buf)) << dendl; + return r; + } + set_item_name(newid, q->second); + cur = newid; continue; } diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 3d07a281956..80906e4fe18 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -720,10 +720,10 @@ public: /* modifiers */ int add_bucket(int bucketno, int alg, int hash, int type, int size, - int *items, int *weights) { + int *items, int *weights, int *idout) { crush_bucket *b = crush_make_bucket(alg, hash, type, size, items, weights); assert(b); - return crush_add_bucket(crush, bucketno, b); + return crush_add_bucket(crush, bucketno, b, idout); } void finalize() { diff --git a/src/crush/Makefile.am b/src/crush/Makefile.am new file mode 100644 index 00000000000..3d2f45b80e6 --- /dev/null +++ b/src/crush/Makefile.am @@ -0,0 +1,30 @@ +libcrush_la_SOURCES = \ + crush/builder.c \ + crush/mapper.c \ + crush/crush.c \ + crush/hash.c \ + crush/CrushWrapper.cc \ + crush/CrushCompiler.cc \ + crush/CrushTester.cc +noinst_LTLIBRARIES += libcrush.la + +noinst_HEADERS += \ + crush/CrushCompiler.h \ + crush/CrushTester.h \ + crush/CrushWrapper.h \ + crush/CrushWrapper.i \ + crush/builder.h \ + crush/crush.h \ + crush/grammar.h \ + crush/hash.h \ + crush/mapper.h \ + crush/sample.txt \ + crush/types.h + +#crush_includedir = $(includedir)/crush +#crush_include_DATA = \ +# $(srcdir)/crush/hash.h \ +# $(srcdir)/crush/crush.h \ +# $(srcdir)/crush/mapper.h \ +# $(srcdir)/crush/types.h + diff --git a/src/crush/builder.c b/src/crush/builder.c index 2eb6ff5fc1e..9bfde0bd8e2 100644 --- a/src/crush/builder.c +++ b/src/crush/builder.c @@ -123,7 +123,8 @@ int crush_get_next_bucket_id(struct crush_map *map) int crush_add_bucket(struct crush_map *map, int id, - struct crush_bucket *bucket) + struct crush_bucket *bucket, + int *idout) { int pos; @@ -148,13 +149,16 @@ int crush_add_bucket(struct crush_map *map, memset(map->buckets + oldsize, 0, (map->max_buckets-oldsize) * sizeof(map->buckets[0])); } - assert(map->buckets[pos] == 0); + if (map->buckets[pos] != 0) { + return -EEXIST; + } /* add it */ bucket->id = id; map->buckets[pos] = bucket; - return id; + if (idout) *idout = id; + return 0; } int crush_remove_bucket(struct crush_map *map, struct crush_bucket *bucket) diff --git a/src/crush/builder.h b/src/crush/builder.h index 7d30c882343..1003c353e60 100644 --- a/src/crush/builder.h +++ b/src/crush/builder.h @@ -15,7 +15,7 @@ extern int crush_add_rule(struct crush_map *map, struct crush_rule *rule, int ru extern int crush_get_next_bucket_id(struct crush_map *map); extern int crush_add_bucket(struct crush_map *map, int bucketno, - struct crush_bucket *bucket); + struct crush_bucket *bucket, int *idout); struct crush_bucket *crush_make_bucket(int alg, int hash, int type, int size, int *items, int *weights); extern int crush_bucket_add_item(struct crush_bucket *bucket, int item, int weight); extern int crush_bucket_adjust_item_weight(struct crush_bucket *bucket, int item, int weight); diff --git a/src/crush/crush.h b/src/crush/crush.h index 82d032879d9..4adabcbf331 100644 --- a/src/crush/crush.h +++ b/src/crush/crush.h @@ -1,11 +1,12 @@ #ifndef CEPH_CRUSH_CRUSH_H #define CEPH_CRUSH_CRUSH_H +#include "include/int_types.h" + #if defined(__linux__) #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/types.h> -#include "include/inttypes.h" #endif /* diff --git a/src/crush/hash.c b/src/crush/hash.c index 9f7f3257ebd..9b15321d783 100644 --- a/src/crush/hash.c +++ b/src/crush/hash.c @@ -1,10 +1,11 @@ +#include "include/int_types.h" #if defined(__linux__) #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/types.h> -#include "include/inttypes.h" #endif + #include "hash.h" /* diff --git a/src/global/Makefile.am b/src/global/Makefile.am new file mode 100644 index 00000000000..79a7ffff689 --- /dev/null +++ b/src/global/Makefile.am @@ -0,0 +1,14 @@ +libglobal_la_SOURCES = \ + global/global_context.cc \ + global/global_init.cc \ + global/pidfile.cc \ + global/signal_handler.cc +libglobal_la_LIBADD = $(LIBCOMMON) +noinst_LTLIBRARIES += libglobal.la + +noinst_HEADERS += \ + global/pidfile.h \ + global/global_init.h \ + global/global_context.h \ + global/signal_handler.h + diff --git a/src/include/Makefile.am b/src/include/Makefile.am new file mode 100644 index 00000000000..d702ebd2795 --- /dev/null +++ b/src/include/Makefile.am @@ -0,0 +1,80 @@ +libcephfs_includedir = $(includedir)/cephfs +libcephfs_include_DATA = $(srcdir)/include/cephfs/libcephfs.h + +librbd_includedir = $(includedir)/rbd +librbd_include_DATA = \ + $(srcdir)/include/rbd/features.h \ + $(srcdir)/include/rbd/librbd.h \ + $(srcdir)/include/rbd/librbd.hpp + +rados_includedir = $(includedir)/rados +rados_include_DATA = \ + $(srcdir)/include/rados/librados.h \ + $(srcdir)/include/rados/rados_types.h \ + $(srcdir)/include/rados/rados_types.hpp \ + $(srcdir)/include/rados/librados.hpp \ + $(srcdir)/include/buffer.h \ + $(srcdir)/include/page.h \ + $(srcdir)/include/crc32c.h + +noinst_HEADERS += \ + include/bloom_filter.hpp \ + include/Context.h \ + include/CompatSet.h \ + include/Distribution.h \ + include/addr_parsing.h \ + include/assert.h \ + include/atomic.h \ + include/bitmapper.h \ + include/blobhash.h \ + include/buffer.h \ + include/byteorder.h \ + include/cephfs/libcephfs.h \ + include/ceph_features.h \ + include/ceph_frag.h \ + include/ceph_fs.h \ + include/ceph_hash.h \ + include/cmp.h \ + include/color.h \ + include/compat.h \ + include/crc32c.h \ + include/encoding.h \ + include/err.h \ + include/error.h \ + include/filepath.h \ + include/frag.h \ + include/hash.h \ + include/intarith.h \ + include/interval_set.h \ + include/int_types.h \ + include/ipaddr.h \ + include/linux_fiemap.h \ + include/lru.h \ + include/msgr.h \ + include/object.h \ + include/page.h \ + include/rangeset.h \ + include/rados.h \ + include/rbd_types.h \ + include/statlite.h \ + include/str_list.h \ + include/stringify.h \ + include/triple.h \ + include/types.h \ + include/utime.h \ + include/dlist.h \ + include/elist.h \ + include/uuid.h \ + include/xlist.h \ + include/rados/librados.h \ + include/rados/rados_types.h \ + include/rados/rados_types.hpp \ + include/rados/librados.hpp \ + include/rados/librgw.h \ + include/rados/page.h \ + include/rados/crc32c.h \ + include/rados/buffer.h \ + include/rbd/features.h \ + include/rbd/librbd.h \ + include/rbd/librbd.hpp\ + include/util.h diff --git a/src/include/buffer.h b/src/include/buffer.h index 8e637d658c5..077cf0d9b0b 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -11,16 +11,16 @@ * Foundation. See file COPYING. * */ - #ifndef CEPH_BUFFER_H #define CEPH_BUFFER_H +#include "include/int_types.h" + #if defined(__linux__) #include <stdlib.h> #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/types.h> -#include "include/inttypes.h" #include <stdlib.h> #endif diff --git a/src/include/crc32c.h b/src/include/crc32c.h index d5f7388be56..8e22c624636 100644 --- a/src/include/crc32c.h +++ b/src/include/crc32c.h @@ -1,7 +1,8 @@ #ifndef CEPH_CRC32C_H #define CEPH_CRC32C_H -#include "include/inttypes.h" +#include "include/int_types.h" + #include <string.h> typedef uint32_t (*ceph_crc32c_func_t)(uint32_t crc, unsigned char const *data, unsigned length); diff --git a/src/include/encoding.h b/src/include/encoding.h index a091f7f69e9..fedc8b31299 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -11,13 +11,13 @@ * Foundation. See file COPYING. * */ - #ifndef CEPH_ENCODING_H #define CEPH_ENCODING_H +#include "include/int_types.h" + #include <tr1/memory> -#include "inttypes.h" #include "byteorder.h" #include "buffer.h" #include "assert.h" diff --git a/src/include/int_types.h b/src/include/int_types.h new file mode 100644 index 00000000000..f290f9d8d23 --- /dev/null +++ b/src/include/int_types.h @@ -0,0 +1,75 @@ +#ifndef CEPH_INTTYPES_H +#define CEPH_INTTYPES_H + +#include "acconfig.h" + +#if defined(__linux__) +#include <linux/types.h> +#endif + +/* + * Get 64b integers either from inttypes.h or glib.h + */ +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +//#else +//# ifdef HAVE_GLIB +//# include <glib.h> +//# endif +#endif + +/* + * C99 says inttypes.h includes stdint.h, but that's not true on all + * systems. If it's there, include it always - just in case. + */ +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif + +/* + * Emergency replacements for PRI*64 modifiers. Some systems have + * an inttypes.h that doesn't define all the PRI[doxu]64 macros. + */ +#if !defined(PRIu64) +# if defined(HAVE_INTTYPES_H) || defined(HAVE_GLIB) +/* If we have inttypes or glib, assume we have 64-bit long long int */ +# define PRIu64 "llu" +# define PRIi64 "lli" +# define PRIx64 "llx" +# define PRIX64 "llX" +# define PRIo64 "llo" +# define PRId64 "lld" +# else +/* Assume that we don't have long long, so use long int modifiers */ +# define PRIu64 "lu" +# define PRIi64 "li" +# define PRIx64 "lx" +# define PRIX64 "lX" +# define PRIo64 "lo" +# define PRId64 "ld" +# endif +#endif + +#if defined(__FreeBSD__) +#include <sys/types.h> + +typedef int8_t __s8; +typedef uint8_t __u8; +typedef int16_t __s16; +typedef uint16_t __u16; +typedef int32_t __s32; +typedef uint32_t __u32; +typedef int64_t __s64; +typedef uint64_t __u64; + +#define __bitwise__ + +typedef __u16 __bitwise__ __le16; +typedef __u16 __bitwise__ __be16; +typedef __u32 __bitwise__ __le32; +typedef __u32 __bitwise__ __be32; +typedef __u64 __bitwise__ __le64; +typedef __u64 __bitwise__ __be64; + +#endif +#endif diff --git a/src/include/inttypes.h b/src/include/inttypes.h deleted file mode 100644 index 656e2bb0a0f..00000000000 --- a/src/include/inttypes.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CEPH_INTTYPES_H -#define CEPH_INTTYPES_H - -#include <stdint.h> -#if defined(__linux__) -#include <linux/types.h> -#elif defined(__FreeBSD__) -#include <sys/types.h> -typedef int8_t __s8; -typedef uint8_t __u8; -typedef int16_t __s16; -typedef uint16_t __u16; -typedef int32_t __s32; -typedef uint32_t __u32; -typedef int64_t __s64; -typedef uint64_t __u64; - -#define __bitwise__ - -typedef __u16 __bitwise__ __le16; -typedef __u16 __bitwise__ __be16; -typedef __u32 __bitwise__ __le32; -typedef __u32 __bitwise__ __be32; -typedef __u64 __bitwise__ __le64; -typedef __u64 __bitwise__ __be64; - -#endif -#endif diff --git a/src/include/linux_fiemap.h b/src/include/linux_fiemap.h index ba5cb6657fa..352208b2207 100644 --- a/src/include/linux_fiemap.h +++ b/src/include/linux_fiemap.h @@ -7,15 +7,15 @@ * Kalpak Shah <kalpak.shah@sun.com> * Andreas Dilger <adilger@sun.com> */ - #ifndef _LINUX_FIEMAP_H #define _LINUX_FIEMAP_H +#include "include/int_types.h" + #if defined(__linux__) #include <linux/types.h> #elif defined(__FreeBSD_) #include <sys/types.h> -#include "include/inttypes.h" #endif struct fiemap_extent { diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index 6f5e454c8e8..a85ef3057bc 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -1,6 +1,8 @@ #ifndef CEPH_LIBRADOS_H #define CEPH_LIBRADOS_H +#include "include/int_types.h" + #ifdef __cplusplus extern "C" { #endif @@ -10,7 +12,6 @@ extern "C" { #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/types.h> -#include "include/inttypes.h" #endif #include <string.h> #include "rados_types.h" diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 5a750cbc0d1..94d3d23a824 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -439,8 +439,23 @@ namespace librados int create(const std::string& oid, bool exclusive); int create(const std::string& oid, bool exclusive, const std::string& category); + /** + * write bytes to an object at a specified offset + * + * NOTE: this call steals the contents of @param bl. + */ int write(const std::string& oid, bufferlist& bl, size_t len, uint64_t off); + /** + * append bytes to an object + * + * NOTE: this call steals the contents of @param bl. + */ int append(const std::string& oid, bufferlist& bl, size_t len); + /** + * replace object contents with provided data + * + * NOTE: this call steals the contents of @param bl. + */ int write_full(const std::string& oid, bufferlist& bl); int clone_range(const std::string& dst_oid, uint64_t dst_off, const std::string& src_oid, uint64_t src_off, @@ -457,7 +472,17 @@ namespace librados int stat(const std::string& oid, uint64_t *psize, time_t *pmtime); int exec(const std::string& oid, const char *cls, const char *method, bufferlist& inbl, bufferlist& outbl); + /** + * modify object tmap based on encoded update sequence + * + * NOTE: this call steals the contents of @param bl + */ int tmap_update(const std::string& oid, bufferlist& cmdbl); + /** + * replace object contents with provided encoded tmap data + * + * NOTE: this call steals the contents of @param bl + */ int tmap_put(const std::string& oid, bufferlist& bl); int tmap_get(const std::string& oid, bufferlist& bl); diff --git a/src/include/types.h b/src/include/types.h index 7e6ddb7117e..1f9756b22c7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -11,12 +11,11 @@ * Foundation. See file COPYING. * */ - #ifndef CEPH_TYPES_H #define CEPH_TYPES_H // this is needed for ceph_fs to compile in userland -#include "inttypes.h" +#include "int_types.h" #include "byteorder.h" #include "uuid.h" diff --git a/src/init-radosgw b/src/init-radosgw index a526441c3a0..de1e01e0018 100644 --- a/src/init-radosgw +++ b/src/init-radosgw @@ -83,7 +83,7 @@ case "$1" in echo "$RADOSGW is running." else echo "$RADOSGW is not running." - RETVAL=1 + exit 1 fi ;; *) diff --git a/src/init-radosgw.sysv b/src/init-radosgw.sysv index e08e1bd1b1b..017e3f9bc07 100644 --- a/src/init-radosgw.sysv +++ b/src/init-radosgw.sysv @@ -90,7 +90,7 @@ case "$1" in echo "$RADOSGW is running." else echo "$RADOSGW is not running." - RETVAL=1 + exit 1 fi ;; *) diff --git a/src/json_spirit/Makefile.am b/src/json_spirit/Makefile.am new file mode 100644 index 00000000000..43025be0e71 --- /dev/null +++ b/src/json_spirit/Makefile.am @@ -0,0 +1,18 @@ +libjson_spirit_la_SOURCES = \ + json_spirit/json_spirit_reader.cpp \ + json_spirit/json_spirit_writer.cpp \ + json_spirit/json_spirit_value.cpp +noinst_LTLIBRARIES += libjson_spirit.la + +noinst_HEADERS += \ + json_spirit/json_spirit.h \ + json_spirit/json_spirit_error_position.h \ + json_spirit/json_spirit_reader.h \ + json_spirit/json_spirit_reader_template.h \ + json_spirit/json_spirit_stream_reader.h \ + json_spirit/json_spirit_utils.h \ + json_spirit/json_spirit_value.h \ + json_spirit/json_spirit_writer.h \ + json_spirit/json_spirit_writer_options.h \ + json_spirit/json_spirit_writer_template.h + diff --git a/src/key_value_store/Makefile.am b/src/key_value_store/Makefile.am new file mode 100644 index 00000000000..e5bae00155f --- /dev/null +++ b/src/key_value_store/Makefile.am @@ -0,0 +1,10 @@ +libcls_kvs_la_SOURCES = key_value_store/cls_kvs.cc +libcls_kvs_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libcls_kvs_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '.*__cls_.*' +radoslib_LTLIBRARIES += libcls_kvs.la + +noinst_HEADERS += \ + key_value_store/key_value_structure.h \ + key_value_store/kv_flat_btree_async.h \ + key_value_store/kvs_arg_types.h + diff --git a/src/librados/Makefile.am b/src/librados/Makefile.am new file mode 100644 index 00000000000..570aa91af93 --- /dev/null +++ b/src/librados/Makefile.am @@ -0,0 +1,20 @@ +librados_la_SOURCES = \ + librados/librados.cc \ + librados/RadosClient.cc \ + librados/IoCtxImpl.cc \ + librados/snap_set_diff.cc + +# We need this to avoid basename conflicts with the librados build tests in test/Makefile.am +librados_la_CFLAGS = ${AM_CFLAGS} + +LIBRADOS_DEPS += libcls_lock_client.la $(LIBOSDC) $(LIBCOMMON) +librados_la_LIBADD = $(LIBRADOS_DEPS) $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +librados_la_LDFLAGS = ${AM_LDFLAGS} -version-info 2:0:0 -export-symbols-regex '^rados_.*' +lib_LTLIBRARIES += librados.la + +noinst_HEADERS += \ + librados/snap_set_diff.h \ + librados/AioCompletionImpl.h \ + librados/IoCtxImpl.h \ + librados/PoolAsyncCompletionImpl.h \ + librados/RadosClient.h diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h index 7625bdd7ff3..cf50ee2c049 100644 --- a/src/librbd/AioRequest.h +++ b/src/librbd/AioRequest.h @@ -3,9 +3,9 @@ #ifndef CEPH_LIBRBD_AIOREQUEST_H #define CEPH_LIBRBD_AIOREQUEST_H -#include <map> +#include "include/int_types.h" -#include "inttypes.h" +#include <map> #include "common/snap_types.h" #include "include/buffer.h" diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 29ca2f197ea..c9e74393e13 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -3,7 +3,7 @@ #ifndef CEPH_LIBRBD_IMAGECTX_H #define CEPH_LIBRBD_IMAGECTX_H -#include <inttypes.h> +#include "include/int_types.h" #include <map> #include <set> diff --git a/src/librbd/Makefile.am b/src/librbd/Makefile.am new file mode 100644 index 00000000000..d4e2455c8c1 --- /dev/null +++ b/src/librbd/Makefile.am @@ -0,0 +1,24 @@ +librbd_la_SOURCES = \ + librbd/librbd.cc \ + librbd/AioCompletion.cc \ + librbd/AioRequest.cc \ + librbd/ImageCtx.cc \ + librbd/internal.cc \ + librbd/LibrbdWriteback.cc \ + librbd/WatchCtx.cc +librbd_la_LIBADD = \ + $(LIBRADOS) $(LIBOSDC) \ + libcls_rbd_client.la libcls_lock_client.la \ + $(PTHREAD_LIBS) $(EXTRALIBS) +librbd_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0 -export-symbols-regex '^rbd_.*' +lib_LTLIBRARIES += librbd.la + +noinst_HEADERS += \ + librbd/AioCompletion.h \ + librbd/AioRequest.h \ + librbd/ImageCtx.h \ + librbd/internal.h \ + librbd/LibrbdWriteback.h \ + librbd/parent_types.h \ + librbd/SnapInfo.h \ + librbd/WatchCtx.h diff --git a/src/librbd/SnapInfo.h b/src/librbd/SnapInfo.h index 5a7852c3c66..44dd4cf208e 100644 --- a/src/librbd/SnapInfo.h +++ b/src/librbd/SnapInfo.h @@ -3,7 +3,7 @@ #ifndef CEPH_LIBRBD_SNAPINFO_H #define CEPH_LIBRBD_SNAPINFO_H -#include <inttypes.h> +#include "include/int_types.h" #include "include/rados/librados.hpp" diff --git a/src/librbd/WatchCtx.h b/src/librbd/WatchCtx.h index 0c0802a4035..9872c84307b 100644 --- a/src/librbd/WatchCtx.h +++ b/src/librbd/WatchCtx.h @@ -3,7 +3,7 @@ #ifndef CEPH_LIBRBD_WATCHCTX_H #define CEPH_LIBRBD_WATCHCTX_H -#include <inttypes.h> +#include "include/int_types.h" #include "common/Mutex.h" #include "include/buffer.h" diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index abc6ff92a28..b8a757ab333 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -1,5 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#include "include/int_types.h" + #include <errno.h> #include <limits.h> @@ -8,7 +10,6 @@ #include "common/errno.h" #include "common/Throttle.h" #include "cls/lock/cls_lock_client.h" -#include "include/inttypes.h" #include "include/stringify.h" #include "cls/rbd/cls_rbd.h" diff --git a/src/librbd/internal.h b/src/librbd/internal.h index 33f5191706d..43458886b43 100644 --- a/src/librbd/internal.h +++ b/src/librbd/internal.h @@ -3,7 +3,7 @@ #ifndef CEPH_LIBRBD_INTERNAL_H #define CEPH_LIBRBD_INTERNAL_H -#include <inttypes.h> +#include "include/int_types.h" #include <map> #include <set> diff --git a/src/librbd/librbd.cc b/src/librbd/librbd.cc index af413dda04f..cad0c5eb172 100644 --- a/src/librbd/librbd.cc +++ b/src/librbd/librbd.cc @@ -11,9 +11,9 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" #include <errno.h> -#include <inttypes.h> #include "common/Cond.h" #include "common/dout.h" diff --git a/src/log/Makefile.am b/src/log/Makefile.am new file mode 100644 index 00000000000..b66e6cf84ce --- /dev/null +++ b/src/log/Makefile.am @@ -0,0 +1,11 @@ +liblog_la_SOURCES = \ + log/Log.cc \ + log/SubsystemMap.cc +noinst_LTLIBRARIES += liblog.la + +noinst_HEADERS += \ + log/Entry.h \ + log/EntryQueue.h \ + log/Log.h \ + log/SubsystemMap.h + diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index dd483263b6d..46f8d33cfd8 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -12,7 +12,8 @@ * */ -#include <inttypes.h> +#include "include/int_types.h" + #include <string> #include <stdio.h> diff --git a/src/mds/Makefile.am b/src/mds/Makefile.am new file mode 100644 index 00000000000..05d0e1a2429 --- /dev/null +++ b/src/mds/Makefile.am @@ -0,0 +1,92 @@ +libmds_la_SOURCES = \ + mds/Anchor.cc \ + mds/Capability.cc \ + mds/Dumper.cc \ + mds/Resetter.cc \ + mds/MDS.cc \ + mds/flock.cc \ + mds/locks.c \ + mds/journal.cc \ + mds/Server.cc \ + mds/Mutation.cc \ + mds/MDCache.cc \ + mds/Locker.cc \ + mds/Migrator.cc \ + mds/MDBalancer.cc \ + mds/CDentry.cc \ + mds/CDir.cc \ + mds/CInode.cc \ + mds/LogEvent.cc \ + mds/MDSTable.cc \ + mds/InoTable.cc \ + mds/MDSTableClient.cc \ + mds/MDSTableServer.cc \ + mds/AnchorServer.cc \ + mds/AnchorClient.cc \ + mds/SnapRealm.cc \ + mds/SnapServer.cc \ + mds/snap.cc \ + mds/SessionMap.cc \ + mds/MDLog.cc +libmds_la_LIBADD = $(LIBOSDC) +noinst_LTLIBRARIES += libmds.la + +noinst_HEADERS += \ + mds/inode_backtrace.h \ + mds/flock.h \ + mds/locks.c \ + mds/locks.h \ + mds/Anchor.h \ + mds/AnchorClient.h \ + mds/AnchorServer.h \ + mds/CDentry.h \ + mds/CDir.h \ + mds/CInode.h \ + mds/Capability.h \ + mds/Dumper.h \ + mds/InoTable.h \ + mds/LocalLock.h \ + mds/Locker.h \ + mds/LogEvent.h \ + mds/LogSegment.h \ + mds/MDBalancer.h \ + mds/MDCache.h \ + mds/MDLog.h \ + mds/MDS.h \ + mds/MDSMap.h \ + mds/MDSTable.h \ + mds/MDSTableServer.h \ + mds/MDSTableClient.h \ + mds/Mutation.h \ + mds/Migrator.h \ + mds/Resetter.h \ + mds/ScatterLock.h \ + mds/Server.h \ + mds/SessionMap.h \ + mds/SimpleLock.h \ + mds/SnapClient.h \ + mds/SnapRealm.h \ + mds/SnapServer.h \ + mds/inode_backtrace.h \ + mds/mds_table_types.h \ + mds/mdstypes.h \ + mds/snap.h + +noinst_HEADERS += \ + mds/events/ECommitted.h \ + mds/events/EExport.h \ + mds/events/EFragment.h \ + mds/events/EImportFinish.h \ + mds/events/EImportStart.h \ + mds/events/EMetaBlob.h \ + mds/events/EOpen.h \ + mds/events/EResetJournal.h \ + mds/events/ESession.h \ + mds/events/ESessions.h \ + mds/events/ESlaveUpdate.h \ + mds/events/ESubtreeMap.h \ + mds/events/ETableClient.h \ + mds/events/ETableServer.h \ + mds/events/EUpdate.h + + diff --git a/src/mds/locks.c b/src/mds/locks.c index 37e3f5ea764..f367eda29d2 100644 --- a/src/mds/locks.c +++ b/src/mds/locks.c @@ -1,15 +1,15 @@ - // there must be a better way? typedef char bool; #define false 0 #define true 1 +#include "include/int_types.h" + #include <netinet/in.h> #if defined(__linux__) #include <linux/types.h> #elif defined(__FreeBSD__) #include <sys/types.h> -#include "include/inttypes.h" #endif #include <string.h> #include <fcntl.h> diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 4fcf584fb8c..902e3104aa8 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -3,7 +3,8 @@ #ifndef CEPH_MDSTYPES_H #define CEPH_MDSTYPES_H -#include <inttypes.h> +#include "include/int_types.h" + #include <math.h> #include <ostream> #include <set> diff --git a/src/messages/Makefile.am b/src/messages/Makefile.am new file mode 100644 index 00000000000..c503d3fca9b --- /dev/null +++ b/src/messages/Makefile.am @@ -0,0 +1,113 @@ + +noinst_HEADERS += \ + messages/MAuth.h \ + messages/MAuthReply.h \ + messages/MCacheExpire.h \ + messages/MClientCaps.h \ + messages/MClientCapRelease.h \ + messages/MClientLease.h \ + messages/MClientReconnect.h \ + messages/MClientReply.h \ + messages/MClientRequest.h \ + messages/MClientRequestForward.h \ + messages/MClientSession.h \ + messages/MClientSnap.h \ + messages/MCommand.h \ + messages/MCommandReply.h \ + messages/MDentryLink.h \ + messages/MDentryUnlink.h \ + messages/MDirUpdate.h \ + messages/MDiscover.h \ + messages/MDiscoverReply.h \ + messages/MExportCaps.h \ + messages/MExportCapsAck.h \ + messages/MExportDir.h \ + messages/MExportDirAck.h \ + messages/MExportDirCancel.h \ + messages/MExportDirDiscover.h \ + messages/MExportDirDiscoverAck.h \ + messages/MExportDirFinish.h \ + messages/MExportDirNotify.h \ + messages/MExportDirNotifyAck.h \ + messages/MExportDirPrep.h \ + messages/MExportDirPrepAck.h \ + messages/MGenericMessage.h \ + messages/MGetPoolStats.h \ + messages/MGetPoolStatsReply.h \ + messages/MHeartbeat.h \ + messages/MInodeFileCaps.h \ + messages/MLock.h \ + messages/MLog.h \ + messages/MLogAck.h \ + messages/MMDSBeacon.h \ + messages/MMDSCacheRejoin.h \ + messages/MMDSLoadTargets.h \ + messages/MMDSFindIno.h \ + messages/MMDSFindInoReply.h \ + messages/MMDSFragmentNotify.h \ + messages/MMDSMap.h \ + messages/MMDSOpenIno.h \ + messages/MMDSOpenInoReply.h \ + messages/MMDSResolve.h \ + messages/MMDSResolveAck.h \ + messages/MMDSSlaveRequest.h \ + messages/MMDSTableRequest.h \ + messages/MMonCommand.h \ + messages/MMonCommandAck.h \ + messages/MMonElection.h \ + messages/MMonGetMap.h \ + messages/MMonGetVersion.h \ + messages/MMonGetVersionReply.h \ + messages/MMonGlobalID.h \ + messages/MMonHealth.h \ + messages/MMonJoin.h \ + messages/MMonMap.h \ + messages/MMonPaxos.h \ + messages/MMonProbe.h \ + messages/MMonScrub.h \ + messages/MMonSubscribe.h \ + messages/MMonSubscribeAck.h \ + messages/MMonSync.h \ + messages/MOSDAlive.h \ + messages/MOSDBoot.h \ + messages/MOSDFailure.h \ + messages/MOSDMarkMeDown.h \ + messages/MOSDMap.h \ + messages/MOSDOp.h \ + messages/MOSDOpReply.h \ + messages/MOSDPGBackfill.h \ + messages/MOSDPGCreate.h \ + messages/MOSDPGPush.h \ + messages/MOSDPGPull.h \ + messages/MOSDPGPushReply.h \ + messages/MOSDPGInfo.h \ + messages/MOSDPGLog.h \ + messages/MOSDPGMissing.h \ + messages/MOSDPGNotify.h \ + messages/MOSDPGQuery.h \ + messages/MOSDPGRemove.h \ + messages/MOSDPGScan.h \ + messages/MBackfillReserve.h \ + messages/MRecoveryReserve.h \ + messages/MMonQuorumService.h \ + messages/MOSDPGTemp.h \ + messages/MOSDPGTrim.h \ + messages/MOSDPing.h \ + messages/MOSDRepScrub.h \ + messages/MOSDScrub.h \ + messages/MOSDSubOp.h \ + messages/MOSDSubOpReply.h \ + messages/MPGStats.h \ + messages/MPGStatsAck.h \ + messages/MPing.h \ + messages/MPoolOp.h \ + messages/MPoolOpReply.h \ + messages/MRemoveSnaps.h \ + messages/MRoute.h \ + messages/MForward.h \ + messages/MStatfs.h \ + messages/MStatfsReply.h \ + messages/MTimeCheck.h \ + messages/MWatchNotify.h \ + messages/PaxosServiceMessage.h + diff --git a/src/mon/Makefile.am b/src/mon/Makefile.am new file mode 100644 index 00000000000..d9094a81b0e --- /dev/null +++ b/src/mon/Makefile.am @@ -0,0 +1,45 @@ +libmon_la_SOURCES = \ + mon/Monitor.cc \ + mon/Paxos.cc \ + mon/PaxosService.cc \ + mon/OSDMonitor.cc \ + mon/MDSMonitor.cc \ + mon/MonmapMonitor.cc \ + mon/PGMonitor.cc \ + mon/PGMap.cc \ + mon/LogMonitor.cc \ + mon/AuthMonitor.cc \ + mon/Elector.cc \ + mon/MonitorStore.cc \ + mon/HealthMonitor.cc \ + mon/DataHealthService.cc \ + mon/ConfigKeyService.cc +libmon_la_LIBADD = $(LIBAUTH) $(LIBCOMMON) $(LIBOS) +noinst_LTLIBRARIES += libmon.la + +noinst_HEADERS += \ + mon/AuthMonitor.h \ + mon/DataHealthService.h \ + mon/Elector.h \ + mon/LogMonitor.h \ + mon/ConfigKeyService.h \ + mon/HealthMonitor.h \ + mon/HealthService.h \ + mon/MDSMonitor.h \ + mon/MonmapMonitor.h \ + mon/MonCap.h \ + mon/MonClient.h \ + mon/MonCommands.h \ + mon/MonMap.h \ + mon/Monitor.h \ + mon/MonitorStore.h \ + mon/MonitorDBStore.h \ + mon/OSDMonitor.h \ + mon/PGMap.h \ + mon/PGMonitor.h \ + mon/Paxos.h \ + mon/PaxosService.h \ + mon/QuorumService.h \ + mon/Session.h \ + mon/mon_types.h + diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 28fa80e00b7..53d7f75e699 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -479,7 +479,8 @@ COMMAND("osd pool rmsnap " \ COMMAND("osd pool create " \ "name=pool,type=CephPoolname " \ "name=pg_num,type=CephInt,range=0 " \ - "name=pgp_num,type=CephInt,range=0,req=false", \ + "name=pgp_num,type=CephInt,range=0,req=false " \ + "name=properties,type=CephString,n=N,req=false,goodchars=[A-Za-z0-9-_.=]", \ "create pool", "osd", "rw", "cli,rest") COMMAND("osd pool delete " \ "name=pool,type=CephPoolname " \ diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ede5f165b53..8eb88a829b1 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -2473,10 +2473,11 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m) MonSession *session = m->get_session(); if (!session) return -EPERM; + vector<string> properties; if (m->auid) - return prepare_new_pool(m->name, m->auid, m->crush_rule, 0, 0); + return prepare_new_pool(m->name, m->auid, m->crush_rule, 0, 0, properties); else - return prepare_new_pool(m->name, session->auid, m->crush_rule, 0, 0); + return prepare_new_pool(m->name, session->auid, m->crush_rule, 0, 0, properties); } /** @@ -2485,11 +2486,13 @@ int OSDMonitor::prepare_new_pool(MPoolOp *m) * @param crush_rule The crush rule to use. If <0, will use the system default * @param pg_num The pg_num to use. If set to 0, will use the system default * @param pgp_num The pgp_num to use. If set to 0, will use the system default + * @param properties An opaque list of key[=value] pairs for pool configuration * * @return 0 in all cases. That's silly. */ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, int crush_rule, - unsigned pg_num, unsigned pgp_num) + unsigned pg_num, unsigned pgp_num, + const vector<string> &properties) { for (map<int64_t,string>::iterator p = pending_inc.new_pool_names.begin(); p != pending_inc.new_pool_names.end(); @@ -2519,6 +2522,18 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, int crush_rule, pi->set_pgp_num(pgp_num ? pgp_num : g_conf->osd_pool_default_pgp_num); pi->last_change = pending_inc.epoch; pi->auid = auid; + for (vector<string>::const_iterator i = properties.begin(); + i != properties.end(); + i++) { + size_t equal = i->find('='); + if (equal != string::npos) + pi->properties[*i] = string(); + else { + const string key = i->substr(0, equal); + const string value = i->substr(equal); + pi->properties[key] = value; + } + } pending_inc.new_pool_names[pool] = name; return 0; } @@ -2699,9 +2714,15 @@ bool OSDMonitor::prepare_command(MMonCommand *m) err = -EINVAL; goto reply; } - int bucketno = newcrush.add_bucket(0, CRUSH_BUCKET_STRAW, + int bucketno; + err = newcrush.add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, type, 0, NULL, - NULL); + NULL, &bucketno); + if (err < 0) { + char buf[128]; + ss << "add_bucket error: '" << strerror_r(-err, buf, sizeof(buf)) << "'"; + goto reply; + } err = newcrush.set_item_name(bucketno, name); if (err < 0) { ss << "error setting bucket name to '" << name << "'"; @@ -3381,7 +3402,11 @@ done: string snapname; cmd_getval(g_ceph_context, cmdmap, "snap", snapname); const pg_pool_t *p = osdmap.get_pg_pool(pool); - if (p->snap_exists(snapname.c_str())) { + if (p->is_unmanaged_snaps_mode()) { + ss << "pool " << poolstr << " is in unmanaged snaps mode"; + err = -EINVAL; + goto reply; + } else if (p->snap_exists(snapname.c_str())) { ss << "pool " << poolstr << " snap " << snapname << " already exists"; err = 0; goto reply; @@ -3415,7 +3440,11 @@ done: string snapname; cmd_getval(g_ceph_context, cmdmap, "snap", snapname); const pg_pool_t *p = osdmap.get_pg_pool(pool); - if (!p->snap_exists(snapname.c_str())) { + if (p->is_unmanaged_snaps_mode()) { + ss << "pool " << poolstr << " is in unmanaged snaps mode"; + err = -EINVAL; + goto reply; + } else if (!p->snap_exists(snapname.c_str())) { ss << "pool " << poolstr << " snap " << snapname << " does not exist"; err = 0; goto reply; @@ -3466,9 +3495,13 @@ done: goto reply; } + vector<string> properties; + cmd_getval(g_ceph_context, cmdmap, "properties", properties); + err = prepare_new_pool(poolstr, 0, // auid=0 for admin created pool -1, // default crush rule - pg_num, pgp_num); + pg_num, pgp_num, + properties); if (err < 0 && err != -EEXIST) { goto reply; } @@ -3866,7 +3899,7 @@ bool OSDMonitor::preprocess_pool_op(MPoolOp *m) _pool_op_reply(m, 0, osdmap.get_epoch()); return true; } - + // check if the snap and snapname exists bool snap_exists = false; const pg_pool_t *p = osdmap.get_pg_pool(m->pool); @@ -3962,6 +3995,38 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m) int ret = 0; bool changed = false; + if (!osdmap.have_pg_pool(m->pool)) { + _pool_op_reply(m, -ENOENT, osdmap.get_epoch()); + return false; + } + + const pg_pool_t *pool = osdmap.get_pg_pool(m->pool); + + switch (m->op) { + case POOL_OP_CREATE_SNAP: + case POOL_OP_DELETE_SNAP: + if (!pool->is_unmanaged_snaps_mode()) { + bool snap_exists = pool->snap_exists(m->name.c_str()); + if ((m->op == POOL_OP_CREATE_SNAP && snap_exists) + || (m->op == POOL_OP_DELETE_SNAP && !snap_exists)) { + ret = 0; + } else { + break; + } + } else { + ret = -EINVAL; + } + _pool_op_reply(m, ret, osdmap.get_epoch()); + return false; + + case POOL_OP_CREATE_UNMANAGED_SNAP: + case POOL_OP_DELETE_UNMANAGED_SNAP: + if (pool->is_pool_snaps_mode()) { + _pool_op_reply(m, -EINVAL, osdmap.get_epoch()); + return false; + } + } + // projected pool info pg_pool_t pp; if (pending_inc.new_pools.count(m->pool)) @@ -3988,7 +4053,7 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m) goto out; } } - + switch (m->op) { case POOL_OP_CREATE_SNAP: if (!pp.snap_exists(m->name.c_str())) { @@ -4043,8 +4108,7 @@ bool OSDMonitor::prepare_pool_op(MPoolOp *m) out: wait_for_finished_proposal(new OSDMonitor::C_PoolOp(this, m, ret, pending_inc.epoch, &reply_data)); - propose_pending(); - return false; + return true; } bool OSDMonitor::prepare_pool_op_create(MPoolOp *m) diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 04f7cf5b196..304f9c4f609 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -235,7 +235,8 @@ private: bool prepare_pool_op_create (MPoolOp *m); bool prepare_pool_op_delete(MPoolOp *m); int prepare_new_pool(string& name, uint64_t auid, int crush_rule, - unsigned pg_num, unsigned pgp_num); + unsigned pg_num, unsigned pgp_num, + const vector<string> &properties); int prepare_new_pool(MPoolOp *m); void update_pool_flags(int64_t pool_id, uint64_t flags); diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 1bd3a3c1f51..764c4fee404 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -131,7 +131,7 @@ class Paxos; * This libary is based on the Paxos algorithm, but varies in a few key ways: * 1- Only a single new value is generated at a time, simplifying the recovery logic. * 2- Nodes track "committed" values, and share them generously (and trustingly) - * 3- A 'leasing' mechism is built-in, allowing nodes to determine when it is + * 3- A 'leasing' mechanism is built-in, allowing nodes to determine when it is * safe to "read" their copy of the last committed value. * * This provides a simple replication substrate that services can be built on top of. @@ -325,8 +325,7 @@ private: * * Instead of performing a full commit each time a read is requested, we * keep leases. Each lease will have an expiration date, which may or may - * not be extended. This member variable will keep when is the lease - * expiring. + * not be extended. */ utime_t lease_expire; /** @@ -1091,7 +1090,7 @@ public: * onto paxos-related keys), and then we will decode those same bufferlists * we just wrote and apply the transactions they hold. We will also update * our first and last committed values to point to the new values, if need - * be. All all this is done tightly wrapped in a transaction to ensure we + * be. All this is done tightly wrapped in a transaction to ensure we * enjoy the atomicity guarantees given by our awesome k/v store. * * @param m A message diff --git a/src/msg/Makefile.am b/src/msg/Makefile.am new file mode 100644 index 00000000000..a849a1ca26a --- /dev/null +++ b/src/msg/Makefile.am @@ -0,0 +1,20 @@ +libmsg_la_SOURCES = \ + msg/Accepter.cc \ + msg/DispatchQueue.cc \ + msg/Message.cc \ + msg/Messenger.cc \ + msg/Pipe.cc \ + msg/SimpleMessenger.cc \ + msg/msg_types.cc + +noinst_HEADERS += \ + msg/Accepter.h \ + msg/DispatchQueue.h \ + msg/Dispatcher.h \ + msg/Message.h \ + msg/Messenger.h \ + msg/Pipe.h \ + msg/SimpleMessenger.h \ + msg/msg_types.h + +noinst_LTLIBRARIES += libmsg.la diff --git a/src/os/BtrfsFileStoreBackend.cc b/src/os/BtrfsFileStoreBackend.cc index ac7d1014ac7..bb11a45e10b 100644 --- a/src/os/BtrfsFileStoreBackend.cc +++ b/src/os/BtrfsFileStoreBackend.cc @@ -12,7 +12,9 @@ * */ -#include <inttypes.h> +#include "include/int_types.h" +#include "include/types.h" + #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -22,7 +24,6 @@ #include <sys/ioctl.h> #include "include/compat.h" #include "include/linux_fiemap.h" -#include "include/types.h" #include "include/color.h" #include "include/buffer.h" #include "include/assert.h" diff --git a/src/os/DBObjectMap.cc b/src/os/DBObjectMap.cc index 5142f4d7420..90c840bbe9c 100644 --- a/src/os/DBObjectMap.cc +++ b/src/os/DBObjectMap.cc @@ -1,13 +1,13 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -#include <iostream> -#include <inttypes.h> +#include "include/int_types.h" #include "include/buffer.h" + +#include <iostream> #include <set> #include <map> #include <string> #include <tr1/memory> - #include <vector> #include "ObjectMap.h" diff --git a/src/os/FDCache.h b/src/os/FDCache.h index f0f40e7bbf4..00e632f3e0f 100644 --- a/src/os/FDCache.h +++ b/src/os/FDCache.h @@ -18,7 +18,7 @@ #include <memory> #include <errno.h> #include <cstdio> -#include "hobject.h" +#include "common/hobject.h" #include "common/Mutex.h" #include "common/Cond.h" #include "common/shared_cache.hpp" diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index d4d540df876..7ef415213b0 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -11,8 +11,8 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" -#include <inttypes.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> @@ -30,10 +30,6 @@ #include <iostream> #include <map> -#if defined(__FreeBSD__) -#include "include/inttypes.h" -#endif - #include "include/compat.h" #include "include/linux_fiemap.h" diff --git a/src/os/GenericFileStoreBackend.cc b/src/os/GenericFileStoreBackend.cc index d0b3df5f6f2..461158fdfab 100644 --- a/src/os/GenericFileStoreBackend.cc +++ b/src/os/GenericFileStoreBackend.cc @@ -12,7 +12,9 @@ * */ -#include <inttypes.h> +#include "include/int_types.h" +#include "include/types.h" + #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -27,7 +29,6 @@ #include "include/compat.h" #include "include/linux_fiemap.h" -#include "include/types.h" #include <iostream> #include <fstream> diff --git a/src/os/Makefile.am b/src/os/Makefile.am new file mode 100644 index 00000000000..b7fef8dd209 --- /dev/null +++ b/src/os/Makefile.am @@ -0,0 +1,49 @@ +libos_la_SOURCES = \ + os/FileJournal.cc \ + os/FileStore.cc \ + os/chain_xattr.cc \ + os/ObjectStore.cc \ + os/JournalingObjectStore.cc \ + os/LFNIndex.cc \ + os/HashIndex.cc \ + os/IndexManager.cc \ + os/FlatIndex.cc \ + os/DBObjectMap.cc \ + os/LevelDBStore.cc \ + os/WBThrottle.cc \ + os/BtrfsFileStoreBackend.cc \ + os/GenericFileStoreBackend.cc \ + os/ZFSFileStoreBackend.cc +noinst_LTLIBRARIES += libos.la + +noinst_HEADERS += \ + os/btrfs_ioctl.h \ + os/chain_xattr.h \ + os/CollectionIndex.h \ + os/FileJournal.h \ + os/FileStore.h \ + os/BtrfsFileStoreBackend.h \ + os/GenericFileStoreBackend.h \ + os/ZFSFileStoreBackend.h \ + os/FlatIndex.h \ + os/HashIndex.h \ + os/FDCache.h \ + os/WBThrottle.h \ + os/IndexManager.h \ + os/Journal.h \ + os/JournalingObjectStore.h \ + os/LFNIndex.h \ + os/ObjectStore.h \ + os/SequencerPosition.h \ + os/ObjectMap.h \ + os/DBObjectMap.h \ + os/KeyValueDB.h \ + os/LevelDBStore.h + +if WITH_LIBZFS +libos_zfs_a_SOURCES = os/ZFS.cc +libos_zfs_a_CXXFLAGS = ${AM_CXXFLAGS} ${LIBZFS_CFLAGS} +noinst_LIBRARIES += libos_zfs.a +noinst_HEADERS += os/ZFS.h +endif + diff --git a/src/os/WBThrottle.h b/src/os/WBThrottle.h index 070de08e123..d480a6b751c 100644 --- a/src/os/WBThrottle.h +++ b/src/os/WBThrottle.h @@ -20,7 +20,7 @@ #include <tr1/memory> #include "include/buffer.h" #include "common/Formatter.h" -#include "os/hobject.h" +#include "common/hobject.h" #include "include/interval_set.h" #include "FDCache.h" #include "common/Thread.h" diff --git a/src/os/ZFSFileStoreBackend.cc b/src/os/ZFSFileStoreBackend.cc index 0f01bd20ee7..aa52b8d2933 100644 --- a/src/os/ZFSFileStoreBackend.cc +++ b/src/os/ZFSFileStoreBackend.cc @@ -1,7 +1,9 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab -#include <inttypes.h> +#include "include/int_types.h" +#include "include/types.h" + #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -12,7 +14,6 @@ #include "include/compat.h" #include "include/linux_fiemap.h" -#include "include/types.h" #include "include/color.h" #include "include/buffer.h" #include "include/assert.h" diff --git a/src/os/chain_xattr.cc b/src/os/chain_xattr.cc index 96f334f8d00..62733e390d3 100644 --- a/src/os/chain_xattr.cc +++ b/src/os/chain_xattr.cc @@ -3,7 +3,8 @@ #include "chain_xattr.h" -#include <inttypes.h> +#include "include/int_types.h" + #include <unistd.h> #include <stdlib.h> #include <sys/types.h> @@ -21,10 +22,6 @@ #include <linux/fs.h> #endif -#if defined(__FreeBSD__) -#include "include/inttypes.h" -#endif - #include "common/xattr.h" /* diff --git a/src/osd/Ager.cc b/src/osd/Ager.cc index a90b1c1855d..f94da1f4218 100644 --- a/src/osd/Ager.cc +++ b/src/osd/Ager.cc @@ -8,7 +8,6 @@ #include "common/Clock.h" #include "common/debug.h" -#include "global/global_context.h" // ick #include <sys/types.h> @@ -59,7 +58,7 @@ uint64_t Ager::age_fill(float pc, utime_t until) { bl.push_back(bp); uint64_t wrote = 0; while (1) { - if (ceph_clock_now(g_ceph_context) > until) break; + if (ceph_clock_now(cct) > until) break; struct statfs st; store->statfs(&st); @@ -176,7 +175,7 @@ void Ager::age(int time, srand(0); - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(cct); utime_t until = start; until.sec_ref() += time; @@ -223,7 +222,7 @@ void Ager::age(int time, uint64_t wrote = 0; for (int c=1; c<=count; c++) { - if (ceph_clock_now(g_ceph_context) > until) break; + if (ceph_clock_now(cct) > until) break; //if (c == 7) start_debug = true; @@ -253,7 +252,7 @@ void Ager::age(int time, // dump freelist? /* - if (ceph_clock_now(g_ceph_context) > nextfl) { + if (ceph_clock_now(cct) > nextfl) { elapsed += freelist_inc; save_freelist(elapsed); nextfl.sec_ref() += freelist_inc; diff --git a/src/osd/Ager.h b/src/osd/Ager.h index 55db507993f..face0a62be4 100644 --- a/src/osd/Ager.h +++ b/src/osd/Ager.h @@ -7,12 +7,14 @@ #include "include/Distribution.h" #include "os/ObjectStore.h" #include "common/Clock.h" +#include "common/ceph_context.h" #include <list> #include <vector> using namespace std; class Ager { + CephContext *cct; ObjectStore *store; private: @@ -28,7 +30,7 @@ class Ager { file_object_t age_get_oid(); public: - Ager(ObjectStore *s) : store(s), did_distn(false) {} + Ager(CephContext *cct_, ObjectStore *s) : cct(cct_), store(s), did_distn(false) {} void age(int time, float high_water, // fill to this % diff --git a/src/osd/ClassHandler.cc b/src/osd/ClassHandler.cc index a9a920ba078..b1afe1e0626 100644 --- a/src/osd/ClassHandler.cc +++ b/src/osd/ClassHandler.cc @@ -39,7 +39,7 @@ int ClassHandler::open_class(const string& cname, ClassData **pcls) int ClassHandler::open_all_classes() { dout(10) << __func__ << dendl; - DIR *dir = ::opendir(g_conf->osd_class_dir.c_str()); + DIR *dir = ::opendir(cct->_conf->osd_class_dir.c_str()); if (!dir) return -errno; @@ -101,7 +101,7 @@ int ClassHandler::_load_class(ClassData *cls) cls->status == ClassData::CLASS_MISSING) { char fname[PATH_MAX]; snprintf(fname, sizeof(fname), "%s/" CLS_PREFIX "%s" CLS_SUFFIX, - g_conf->osd_class_dir.c_str(), + cct->_conf->osd_class_dir.c_str(), cls->name.c_str()); dout(10) << "_load_class " << cls->name << " from " << fname << dendl; diff --git a/src/osd/ClassHandler.h b/src/osd/ClassHandler.h index ae416bc6bfc..93cf3c07fbc 100644 --- a/src/osd/ClassHandler.h +++ b/src/osd/ClassHandler.h @@ -7,11 +7,14 @@ #include "common/Cond.h" #include "common/Mutex.h" +#include "common/ceph_context.h" class ClassHandler { public: + CephContext *cct; + struct ClassData; struct ClassMethod { @@ -76,7 +79,7 @@ private: int _load_class(ClassData *cls); public: - ClassHandler() : mutex("ClassHandler") {} + ClassHandler(CephContext *cct_) : cct(cct_), mutex("ClassHandler") {} int open_all_classes(); diff --git a/src/osd/ErasureCodeInterface.h b/src/osd/ErasureCodeInterface.h new file mode 100644 index 00000000000..5ce2842d562 --- /dev/null +++ b/src/osd/ErasureCodeInterface.h @@ -0,0 +1,210 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#ifndef CEPH_ERASURE_CODE_INTERFACE_H +#define CEPH_ERASURE_CODE_INTERFACE_H + +/*! @file ErasureCodeInterface.h + @brief Interface provided by erasure code plugins + + The erasure coded pools rely on plugins implementing + **ErasureCodeInterface** to encode and decode content. All codes + are systematic (i.e. the data is not mangled and can be + reconstructed by concatenating chunks ). + + All methods returns **0** on success and a negative value on + error. If the value returned on error is not explained in + **ErasureCodeInterface**, the sources or the documentation of the + interface implementer must be read to figure out what it means. It + is recommended that each error code matches an *errno* value that + relates to the cause of the error. + + Assuming the interface implementer provides three data chunks ( K + = 3 ) and two coding chunks ( M = 2 ), a buffer can be encoded as + follows: + + ~~~~~~~~~~~~~~~~{.c} + set<int> want_to_encode(0, 1, 2, // data chunks + 3, 4 // coding chunks + ); + bufferlist in = "ABCDEF"; + map<int, bufferlist> encoded + encode(want_to_encode, in, &encoded); + encoded[0] == "AB" // data chunk 0 + encoded[1] == "CD" // data chunk 1 + encoded[2] == "EF" // data chunk 2 + encoded[3] // coding chunk 0 + encoded[4] // coding chunk 1 + ~~~~~~~~~~~~~~~~ + + If encoded[2] ( which contains **EF** ) is missing and accessing + encoded[3] ( the first coding chunk ) is more expensive than + accessing encoded[4] ( the second coding chunk ), the + **minimum_to_decode_with_cost** method can be called as follows: + + ~~~~~~~~~~~~~~~~{.c} + set<int> want_to_read(2); // want the chunk containing "EF" + map<int,int> available( + 0 => 1, // data chunk 0 : available and costs 1 + 1 => 1, // data chunk 1 : available and costs 1 + 3 => 9, // coding chunk 1 : available and costs 9 + 4 => 1, // coding chunk 2 : available and costs 1 + ); + set<int> minimum; + minimum_to_decode_with_cost(want_to_read, + available, + &minimum); + minimum == set<int>(0, 1, 4); + ~~~~~~~~~~~~~~~~ + + It sets **minimum** with three chunks to reconstruct the desired + data chunk and will pick the second coding chunk ( 4 ) because it + is less expensive ( 1 < 9 ) to retrieve than the first coding + chunk ( 3 ). The caller is responsible for retrieving the chunks + and call **decode** to reconstruct the second data chunk content. + + ~~~~~~~~~~~~~~~~{.c} + map<int,bufferlist> chunks; + for i in minimum.keys(): + chunks[i] = fetch_chunk(i); // get chunk from storage + map<int, bufferlist> decoded; + decode(want_to_read, chunks, &decoded); + decoded[2] == "EF" + ~~~~~~~~~~~~~~~~ + + */ + +#include <map> +#include <set> +#include <tr1/memory> +#include "include/buffer.h" + +using namespace std; + +namespace ceph { + + class ErasureCodeInterface { + public: + virtual ~ErasureCodeInterface() {} + + /** + * Compute the smallest subset of **available** chunks that needs + * to be retrieved in order to successfully decode + * **want_to_read** chunks. + * + * It is strictly equivalent to calling + * **minimum_to_decode_with_cost** where each **available** chunk + * has the same cost. + * + * @see minimum_to_decode_with_cost + * + * @param [in] want_to_read chunk indexes to be decoded + * @param [in] available chunk indexes containing valid data + * @param [out] minimum chunk indexes to retrieve for decode + * @return **0** on success or a negative errno on error. + */ + virtual int minimum_to_decode(const set<int> &want_to_read, + const set<int> &available, + set<int> *minimum) = 0; + + /** + * Compute the smallest subset of **available** chunks that needs + * to be retrieved in order to successfully decode + * **want_to_read** chunks. If there are more than one possible + * subset, select the subset that contains the chunks with the + * lowest cost. + * + * The **available** parameter maps chunk indexes to their + * retrieval cost. The higher the cost value, the more costly it + * is to retrieve the chunk content. + * + * Returns -EIO if there are not enough chunk indexes in + * **available** to decode **want_to_read**. + * + * Returns 0 on success. + * + * The **minimum** argument must be a pointer to an empty set. + * + * @param [in] want_to_read chunk indexes to be decoded + * @param [in] available map chunk indexes containing valid data + * to their retrieval cost + * @param [out] minimum chunk indexes to retrieve for decode + * @return **0** on success or a negative errno on error. + */ + virtual int minimum_to_decode_with_cost(const set<int> &want_to_read, + const map<int, int> &available, + set<int> *minimum) = 0; + + /** + * Encode the content of **in** and store the result in + * **encoded**. The **encoded** map contains at least all + * chunk indexes found in the **want_to_encode** set. + * + * The **encoded** map is expected to be a pointer to an empty + * map. + * + * The **encoded** map may contain more chunks than required by + * **want_to_encode** and the caller is expected to permanently + * store all of them, not just the chunks from **want_to_encode**. + * + * Returns 0 on success. + * + * @param [in] want_to_encode chunk indexes to be encoded + * @param [in] in data to be encoded + * @param [out] encoded map chunk indexes to chunk data + * @return **0** on success or a negative errno on error. + */ + virtual int encode(const set<int> &want_to_encode, + const bufferlist &in, + map<int, bufferlist> *encoded) = 0; + + /** + * Decode the **chunks** and store at least **want_to_read** chunks + * in **decoded**. + * + * There must be enough **chunks** ( as returned by + * **minimum_to_decode** or **minimum_to_decode_with_cost** ) to + * perform a successfull decoding of all chunks found in + * **want_to_read**. + * + * The **decoded** map is expected to be a pointer to an empty + * map. + * + * The **decoded** map may contain more chunks than required by + * **want_to_read** and they can safely be used by the caller. + * + * If a chunk is listed in **want_to_read** and there is + * corresponding **bufferlist** in **chunks**, it will be copied + * verbatim into **decoded**. If not it will be reconstructed from + * the existing chunks. + * + * Returns 0 on success. + * + * @param [in] want_to_read chunk indexes to be decoded + * @param [in] chunks map chunk indexes to chunk data + * @param [out] decoded map chunk indexes to chunk data + * @return **0** on success or a negative errno on error. + */ + virtual int decode(const set<int> &want_to_read, + const map<int, bufferlist> &chunks, + map<int, bufferlist> *decoded) = 0; + }; + + typedef std::tr1::shared_ptr<ErasureCodeInterface> ErasureCodeInterfaceRef; + +} + +#endif diff --git a/src/osd/ErasureCodePlugin.cc b/src/osd/ErasureCodePlugin.cc new file mode 100644 index 00000000000..10b65b2604b --- /dev/null +++ b/src/osd/ErasureCodePlugin.cc @@ -0,0 +1,134 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#include "common/debug.h" + +#include <dlfcn.h> + +#include "ErasureCodePlugin.h" + +#define dout_subsys ceph_subsys_osd +#undef dout_prefix +#define dout_prefix _prefix(_dout) + +static ostream& _prefix(std::ostream* _dout) +{ + return *_dout << "ErasureCodePlugin: "; +} + +#define PLUGIN_PREFIX "libec_" +#define PLUGIN_SUFFIX ".so" +#define PLUGIN_INIT_FUNCTION "__erasure_code_init" + +ErasureCodePluginRegistry ErasureCodePluginRegistry::singleton; + +ErasureCodePluginRegistry::ErasureCodePluginRegistry() : + lock("ErasureCodePluginRegistry::lock") +{ +} + +ErasureCodePluginRegistry::~ErasureCodePluginRegistry() +{ + for (std::map<std::string,ErasureCodePlugin*>::iterator i = plugins.begin(); + i != plugins.end(); + i++) { + void *library = i->second->library; + delete i->second; + dlclose(library); + } +} + +int ErasureCodePluginRegistry::add(const std::string &name, + ErasureCodePlugin* plugin) +{ + if (plugins.find(name) != plugins.end()) + return -EEXIST; + plugins[name] = plugin; + return 0; +} + +ErasureCodePlugin *ErasureCodePluginRegistry::get(const std::string &name) +{ + if (plugins.find(name) != plugins.end()) + return plugins[name]; + else + return 0; +} + +int ErasureCodePluginRegistry::factory(const std::string &plugin_name, + const map<std::string,std::string> ¶meters, + ErasureCodeInterfaceRef *erasure_code) +{ + Mutex::Locker l(lock); + int r = 0; + ErasureCodePlugin *plugin = get(plugin_name); + if (plugin == 0) { + r = load(plugin_name, parameters, &plugin); + if (r != 0) + return r; + } + + return plugin->factory(parameters, erasure_code); +} + +int ErasureCodePluginRegistry::load(const std::string &plugin_name, + const map<std::string,std::string> ¶meters, + ErasureCodePlugin **plugin) +{ + assert(parameters.count("erasure-code-directory") != 0); + std::string fname = parameters.find("erasure-code-directory")->second + + "/" PLUGIN_PREFIX + + plugin_name + PLUGIN_SUFFIX; + dout(10) << "load " << plugin_name << " from " << fname << dendl; + + void *library = dlopen(fname.c_str(), RTLD_NOW); + if (!library) { + derr << "load dlopen(" << fname + << "): " << dlerror() << dendl; + return -EIO; + } + + int (*erasure_code_init)(const char *) = + (int (*)(const char *))dlsym(library, PLUGIN_INIT_FUNCTION); + if (erasure_code_init) { + std::string name = plugin_name; + int r = erasure_code_init(name.c_str()); + if (r != 0) { + derr << "erasure_code_init(" << plugin_name + << "): " << strerror(-r) << dendl; + return r; + } + } else { + derr << "load dlsym(" << fname + << ", " << PLUGIN_INIT_FUNCTION + << "): " << dlerror() << dendl; + dlclose(library); + return -ENOENT; + } + + *plugin = get(plugin_name); + if (*plugin == 0) { + derr << "load " << PLUGIN_INIT_FUNCTION << "()" + << "did not register " << plugin_name << dendl; + dlclose(library); + return -EBADF; + } + + (*plugin)->library = library; + + return 0; +} + diff --git a/src/osd/ErasureCodePlugin.h b/src/osd/ErasureCodePlugin.h new file mode 100644 index 00000000000..f1c1ccb31b3 --- /dev/null +++ b/src/osd/ErasureCodePlugin.h @@ -0,0 +1,69 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#ifndef CEPH_ERASURE_CODE_PLUGIN_H +#define CEPH_ERASURE_CODE_PLUGIN_H + +#include "common/Mutex.h" +#include "ErasureCodeInterface.h" + +extern "C" { + int __erasure_code_init(char *plugin_name); +} + +namespace ceph { + + class ErasureCodePlugin { + public: + void *library; + + ErasureCodePlugin() : + library(0) {} + virtual ~ErasureCodePlugin() {} + + virtual int factory(const map<std::string,std::string> ¶meters, + ErasureCodeInterfaceRef *erasure_code) = 0; + }; + + class ErasureCodePluginRegistry { + public: + Mutex lock; + std::map<std::string,ErasureCodePlugin*> plugins; + + static ErasureCodePluginRegistry singleton; + + ErasureCodePluginRegistry(); + ~ErasureCodePluginRegistry(); + + static ErasureCodePluginRegistry &instance() { + return singleton; + } + + int factory(const std::string &plugin, + const map<std::string,std::string> ¶meters, + ErasureCodeInterfaceRef *erasure_code); + + int add(const std::string &name, ErasureCodePlugin *plugin); + ErasureCodePlugin *get(const std::string &name); + + int load(const std::string &plugin_name, + const map<std::string,std::string> ¶meters, + ErasureCodePlugin **plugin); + + }; +} + +#endif diff --git a/src/osd/Makefile.am b/src/osd/Makefile.am new file mode 100644 index 00000000000..a6ab39275aa --- /dev/null +++ b/src/osd/Makefile.am @@ -0,0 +1,38 @@ +## erasure code plugins +erasure_codelibdir = $(libdir)/erasure-code +erasure_codelib_LTLIBRARIES = + +libosd_la_SOURCES = \ + osd/ErasureCodePlugin.cc \ + osd/PG.cc \ + osd/PGLog.cc \ + osd/ReplicatedPG.cc \ + osd/Ager.cc \ + osd/OSD.cc \ + osd/OSDCap.cc \ + osd/Watch.cc \ + osd/ClassHandler.cc \ + osd/OpRequest.cc \ + osd/SnapMapper.cc \ + osd/osd_types.cc \ + objclass/class_api.cc +libosd_la_LIBADD = $(LIBOSDC) $(LIBOS) +noinst_LTLIBRARIES += libosd.la + +noinst_HEADERS += \ + osd/Ager.h \ + osd/ClassHandler.h \ + osd/ErasureCodeInterface.h \ + osd/ErasureCodePlugin.h \ + osd/OSD.h \ + osd/OSDCap.h \ + osd/OSDMap.h \ + osd/ObjectVersioner.h \ + osd/OpRequest.h \ + osd/SnapMapper.h \ + osd/PG.h \ + osd/PGLog.h \ + osd/ReplicatedPG.h \ + osd/Watch.h \ + osd/osd_types.h + diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index cff0c8d6a52..faf82624825 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -156,6 +156,7 @@ static CompatSet get_osd_compat_set() { OSDService::OSDService(OSD *osd) : osd(osd), + cct(osd->cct), whoami(osd->whoami), store(osd->store), clog(osd->clog), pg_recovery_stats(osd->pg_recovery_stats), infos_oid(OSD::make_infos_oid()), @@ -186,17 +187,17 @@ OSDService::OSDService(OSD *osd) : watch_timer(osd->client_messenger->cct, watch_lock), next_notif_id(0), backfill_request_lock("OSD::backfill_request_lock"), - backfill_request_timer(g_ceph_context, backfill_request_lock, false), + backfill_request_timer(cct, backfill_request_lock, false), last_tid(0), tid_lock("OSDService::tid_lock"), - reserver_finisher(g_ceph_context), - local_reserver(&reserver_finisher, g_conf->osd_max_backfills), - remote_reserver(&reserver_finisher, g_conf->osd_max_backfills), + reserver_finisher(cct), + local_reserver(&reserver_finisher, cct->_conf->osd_max_backfills), + remote_reserver(&reserver_finisher, cct->_conf->osd_max_backfills), pg_temp_lock("OSDService::pg_temp_lock"), map_cache_lock("OSDService::map_lock"), - map_cache(g_conf->osd_map_cache_size), - map_bl_cache(g_conf->osd_map_cache_size), - map_bl_inc_cache(g_conf->osd_map_cache_size), + map_cache(cct->_conf->osd_map_cache_size), + map_bl_cache(cct->_conf->osd_map_cache_size), + map_bl_inc_cache(cct->_conf->osd_map_cache_size), in_progress_split_lock("OSDService::in_progress_split_lock"), full_status_lock("OSDService::full_status_lock"), cur_state(NONE), @@ -428,13 +429,13 @@ void OSDService::init() watch_timer.init(); } -ObjectStore *OSD::create_object_store(const std::string &dev, const std::string &jdev) +ObjectStore *OSD::create_object_store(CephContext *cct, const std::string &dev, const std::string &jdev) { struct stat st; if (::stat(dev.c_str(), &st) != 0) return 0; - if (g_conf->filestore) + if (cct->_conf->filestore) return new FileStore(dev, jdev); if (S_ISDIR(st.st_mode)) @@ -581,20 +582,20 @@ int OSD::convertfs(const std::string &dev, const std::string &jdev) return r; } -int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int whoami) +int OSD::mkfs(CephContext *cct, const std::string &dev, const std::string &jdev, uuid_d fsid, int whoami) { int ret; ObjectStore *store = NULL; try { - store = create_object_store(dev, jdev); + store = create_object_store(cct, dev, jdev); if (!store) { ret = -ENOENT; goto out; } // if we are fed a uuid for this osd, use it. - store->set_fsid(g_conf->osd_uuid); + store->set_fsid(cct->_conf->osd_uuid); ret = store->mkfs(); if (ret) { @@ -609,15 +610,15 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int } // age? - if (g_conf->osd_age_time != 0) { - if (g_conf->osd_age_time >= 0) { - dout(0) << "aging..." << dendl; - Ager ager(store); - ager.age(g_conf->osd_age_time, - g_conf->osd_age, - g_conf->osd_age - .05, - 50000, - g_conf->osd_age - .05); + if (cct->_conf->osd_age_time != 0) { + if (cct->_conf->osd_age_time >= 0) { + dout(0) << "aging..." << dendl; + Ager ager(cct, store); + ager.age(cct->_conf->osd_age_time, + cct->_conf->osd_age, + cct->_conf->osd_age - .05, + 50000, + cct->_conf->osd_age - .05); } } @@ -650,13 +651,13 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int sb.compat_features = get_osd_compat_set(); // benchmark? - if (g_conf->osd_auto_weight) { + if (cct->_conf->osd_auto_weight) { bufferlist bl; bufferptr bp(1048576); bp.zero(); bl.push_back(bp); dout(0) << "testing disk bandwidth..." << dendl; - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(cct); object_t oid("disk_bw_test"); for (int i=0; i<1000; i++) { ObjectStore::Transaction *t = new ObjectStore::Transaction; @@ -664,7 +665,7 @@ int OSD::mkfs(const std::string &dev, const std::string &jdev, uuid_d fsid, int store->queue_transaction(NULL, t); } store->sync(); - utime_t end = ceph_clock_now(g_ceph_context); + utime_t end = ceph_clock_now(cct); end -= start; dout(0) << "measured " << (1000.0 / (double)end) << " mb/sec" << dendl; ObjectStore::Transaction tr; @@ -726,17 +727,17 @@ out: return ret; } -int OSD::mkjournal(const std::string &dev, const std::string &jdev) +int OSD::mkjournal(CephContext *cct, const std::string &dev, const std::string &jdev) { - ObjectStore *store = create_object_store(dev, jdev); + ObjectStore *store = create_object_store(cct, dev, jdev); if (!store) return -ENOENT; return store->mkjournal(); } -int OSD::flushjournal(const std::string &dev, const std::string &jdev) +int OSD::flushjournal(CephContext *cct, const std::string &dev, const std::string &jdev) { - ObjectStore *store = create_object_store(dev, jdev); + ObjectStore *store = create_object_store(cct, dev, jdev); if (!store) return -ENOENT; int err = store->mount(); @@ -748,9 +749,9 @@ int OSD::flushjournal(const std::string &dev, const std::string &jdev) return err; } -int OSD::dump_journal(const std::string &dev, const std::string &jdev, ostream& out) +int OSD::dump_journal(CephContext *cct, const std::string &dev, const std::string &jdev, ostream& out) { - ObjectStore *store = create_object_store(dev, jdev); + ObjectStore *store = create_object_store(cct, dev, jdev); if (!store) return -ENOENT; int err = store->dump_journal(out); @@ -907,21 +908,21 @@ int OSD::peek_journal_fsid(string path, uuid_d& fsid) // cons/des -OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger, +OSD::OSD(CephContext *cct_, int id, Messenger *internal_messenger, Messenger *external_messenger, Messenger *hb_clientm, Messenger *hb_front_serverm, Messenger *hb_back_serverm, Messenger *osdc_messenger, MonClient *mc, const std::string &dev, const std::string &jdev) : - Dispatcher(external_messenger->cct), + Dispatcher(cct_), osd_lock("OSD::osd_lock"), - tick_timer(external_messenger->cct, osd_lock), - authorize_handler_cluster_registry(new AuthAuthorizeHandlerRegistry(external_messenger->cct, + tick_timer(cct, osd_lock), + authorize_handler_cluster_registry(new AuthAuthorizeHandlerRegistry(cct, cct->_conf->auth_supported.length() ? cct->_conf->auth_supported : cct->_conf->auth_cluster_required)), - authorize_handler_service_registry(new AuthAuthorizeHandlerRegistry(external_messenger->cct, + authorize_handler_service_registry(new AuthAuthorizeHandlerRegistry(cct, cct->_conf->auth_supported.length() ? cct->_conf->auth_supported : cct->_conf->auth_service_required)), @@ -932,17 +933,17 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger, logger(NULL), recoverystate_perf(NULL), store(NULL), - clog(external_messenger->cct, client_messenger, &mc->monmap, LogClient::NO_FLAGS), + clog(cct, client_messenger, &mc->monmap, LogClient::NO_FLAGS), whoami(id), dev_path(dev), journal_path(jdev), dispatch_running(false), asok_hook(NULL), osd_compat(get_osd_compat_set()), state(STATE_INITIALIZING), boot_epoch(0), up_epoch(0), bind_epoch(0), - op_tp(external_messenger->cct, "OSD::op_tp", g_conf->osd_op_threads, "osd_op_threads"), - recovery_tp(external_messenger->cct, "OSD::recovery_tp", g_conf->osd_recovery_threads, "osd_recovery_threads"), - disk_tp(external_messenger->cct, "OSD::disk_tp", g_conf->osd_disk_threads, "osd_disk_threads"), - command_tp(external_messenger->cct, "OSD::command_tp", 1), + op_tp(cct, "OSD::op_tp", cct->_conf->osd_op_threads, "osd_op_threads"), + recovery_tp(cct, "OSD::recovery_tp", cct->_conf->osd_recovery_threads, "osd_recovery_threads"), + disk_tp(cct, "OSD::disk_tp", cct->_conf->osd_disk_threads, "osd_disk_threads"), + command_tp(cct, "OSD::command_tp", 1), paused_recovery(false), heartbeat_lock("OSD::heartbeat_lock"), heartbeat_stop(false), heartbeat_need_update(true), heartbeat_epoch(0), @@ -953,28 +954,29 @@ OSD::OSD(int id, Messenger *internal_messenger, Messenger *external_messenger, heartbeat_dispatcher(this), stat_lock("OSD::stat_lock"), finished_lock("OSD::finished_lock"), + op_tracker(cct), test_ops_hook(NULL), - op_wq(this, g_conf->osd_op_thread_timeout, &op_tp), - peering_wq(this, g_conf->osd_op_thread_timeout, &op_tp), + op_wq(this, cct->_conf->osd_op_thread_timeout, &op_tp), + peering_wq(this, cct->_conf->osd_op_thread_timeout, &op_tp), map_lock("OSD::map_lock"), peer_map_epoch_lock("OSD::peer_map_epoch_lock"), - debug_drop_pg_create_probability(g_conf->osd_debug_drop_pg_create_probability), - debug_drop_pg_create_duration(g_conf->osd_debug_drop_pg_create_duration), + debug_drop_pg_create_probability(cct->_conf->osd_debug_drop_pg_create_probability), + debug_drop_pg_create_duration(cct->_conf->osd_debug_drop_pg_create_duration), debug_drop_pg_create_left(-1), outstanding_pg_stats(false), up_thru_wanted(0), up_thru_pending(0), pg_stat_queue_lock("OSD::pg_stat_queue_lock"), osd_stat_updated(false), pg_stat_tid(0), pg_stat_tid_flushed(0), - command_wq(this, g_conf->osd_command_thread_timeout, &command_tp), + command_wq(this, cct->_conf->osd_command_thread_timeout, &command_tp), recovery_ops_active(0), - recovery_wq(this, g_conf->osd_recovery_thread_timeout, &recovery_tp), + recovery_wq(this, cct->_conf->osd_recovery_thread_timeout, &recovery_tp), replay_queue_lock("OSD::replay_queue_lock"), - snap_trim_wq(this, g_conf->osd_snap_trim_thread_timeout, &disk_tp), - scrub_wq(this, g_conf->osd_scrub_thread_timeout, &disk_tp), - scrub_finalize_wq(this, g_conf->osd_scrub_finalize_thread_timeout, &op_tp), - rep_scrub_wq(this, g_conf->osd_scrub_thread_timeout, &disk_tp), - remove_wq(store, g_conf->osd_remove_thread_timeout, &disk_tp), + snap_trim_wq(this, cct->_conf->osd_snap_trim_thread_timeout, &disk_tp), + scrub_wq(this, cct->_conf->osd_scrub_thread_timeout, &disk_tp), + scrub_finalize_wq(this, cct->_conf->osd_scrub_finalize_thread_timeout, &op_tp), + rep_scrub_wq(this, cct->_conf->osd_scrub_thread_timeout, &disk_tp), + remove_wq(store, cct->_conf->osd_remove_thread_timeout, &disk_tp), next_removal_seq(0), service(this) { @@ -986,8 +988,8 @@ OSD::~OSD() delete authorize_handler_cluster_registry; delete authorize_handler_service_registry; delete class_handler; - g_ceph_context->get_perfcounters_collection()->remove(recoverystate_perf); - g_ceph_context->get_perfcounters_collection()->remove(logger); + cct->get_perfcounters_collection()->remove(recoverystate_perf); + cct->get_perfcounters_collection()->remove(logger); delete recoverystate_perf; delete logger; delete store; @@ -1010,7 +1012,7 @@ int OSD::pre_init() return 0; assert(!store); - store = create_object_store(dev_path, journal_path); + store = create_object_store(cct, dev_path, journal_path); if (!store) { derr << "OSD::pre_init: unable to create object store" << dendl; return -ENODEV; @@ -1022,7 +1024,7 @@ int OSD::pre_init() return -EBUSY; } - g_conf->add_observer(this); + cct->_conf->add_observer(this); return 0; } @@ -1200,10 +1202,10 @@ int OSD::init() return r; } - class_handler = new ClassHandler(); + class_handler = new ClassHandler(cct); cls_initialize(class_handler); - if (g_conf->osd_open_classes_on_start) { + if (cct->_conf->osd_open_classes_on_start) { int r = class_handler->open_all_classes(); if (r) dout(1) << "warning: got an error loading one or more classes: " << cpp_strerror(r) << dendl; @@ -1262,7 +1264,7 @@ int OSD::init() heartbeat_thread.create(); // tick - tick_timer.add_event_after(g_conf->osd_heartbeat_interval, new C_Tick(this)); + tick_timer.add_event_after(cct->_conf->osd_heartbeat_interval, new C_Tick(this)); service.init(); service.publish_map(osdmap); @@ -1400,7 +1402,7 @@ void OSD::create_logger() { dout(10) << "create_logger" << dendl; - PerfCountersBuilder osd_plb(g_ceph_context, "osd", l_osd_first, l_osd_last); + PerfCountersBuilder osd_plb(cct, "osd", l_osd_first, l_osd_last); osd_plb.add_u64(l_osd_opq, "opq"); // op queue length (waiting to be processed yet) osd_plb.add_u64(l_osd_op_wip, "op_wip"); // rep ops currently being processed (primary) @@ -1460,15 +1462,19 @@ void OSD::create_logger() osd_plb.add_u64_counter(l_osd_waiting_for_map, "messages_delayed_for_map"); // dup osdmap epochs + osd_plb.add_u64(l_osd_stat_bytes, "stat_bytes"); + osd_plb.add_u64(l_osd_stat_bytes_used, "stat_bytes_used"); + osd_plb.add_u64(l_osd_stat_bytes_avail, "stat_bytes_avail"); + logger = osd_plb.create_perf_counters(); - g_ceph_context->get_perfcounters_collection()->add(logger); + cct->get_perfcounters_collection()->add(logger); } void OSD::create_recoverystate_perf() { dout(10) << "create_recoverystate_perf" << dendl; - PerfCountersBuilder rs_perf(g_ceph_context, "recoverystate_perf", rs_first, rs_last); + PerfCountersBuilder rs_perf(cct, "recoverystate_perf", rs_first, rs_last); rs_perf.add_time_avg(rs_initial_latency, "initial_latency"); rs_perf.add_time_avg(rs_started_latency, "started_latency"); @@ -1501,12 +1507,12 @@ void OSD::create_recoverystate_perf() rs_perf.add_time_avg(rs_waitupthru_latency, "waitupthru_latency"); recoverystate_perf = rs_perf.create_perf_counters(); - g_ceph_context->get_perfcounters_collection()->add(recoverystate_perf); + cct->get_perfcounters_collection()->add(recoverystate_perf); } void OSD::suicide(int exitcode) { - if (g_conf->filestore_blackhole) { + if (cct->_conf->filestore_blackhole) { derr << " filestore_blackhole=true, doing abbreviated shutdown" << dendl; _exit(exitcode); } @@ -1546,11 +1552,11 @@ int OSD::shutdown() heartbeat_lock.Unlock(); // Debugging - g_ceph_context->_conf->set_val("debug_osd", "100"); - g_ceph_context->_conf->set_val("debug_journal", "100"); - g_ceph_context->_conf->set_val("debug_filestore", "100"); - g_ceph_context->_conf->set_val("debug_ms", "100"); - g_ceph_context->_conf->apply_changes(NULL); + cct->_conf->set_val("debug_osd", "100"); + cct->_conf->set_val("debug_journal", "100"); + cct->_conf->set_val("debug_filestore", "100"); + cct->_conf->set_val("debug_ms", "100"); + cct->_conf->apply_changes(NULL); // Shutdown PGs for (hash_map<pg_t, PG*>::iterator p = pg_map.begin(); @@ -1666,7 +1672,7 @@ int OSD::shutdown() #ifdef PG_DEBUG_REFS service.dump_live_pgids(); #endif - g_conf->remove_observer(this); + cct->_conf->remove_observer(this); monc->shutdown(); osd_lock.Unlock(); @@ -2223,7 +2229,7 @@ void OSD::build_past_intervals_parallel() pg->unlock(); // don't let the transaction get too big - if (++num >= g_conf->osd_target_transaction_size) { + if (++num >= cct->_conf->osd_target_transaction_size) { store->apply_transaction(t); t = ObjectStore::Transaction(); num = 0; @@ -2516,14 +2522,14 @@ void OSD::project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from, float OSDService::get_full_ratio() { - float full_ratio = g_conf->osd_failsafe_full_ratio; + float full_ratio = cct->_conf->osd_failsafe_full_ratio; if (full_ratio > 1.0) full_ratio /= 100.0; return full_ratio; } float OSDService::get_nearfull_ratio() { - float nearfull_ratio = g_conf->osd_failsafe_nearfull_ratio; + float nearfull_ratio = cct->_conf->osd_failsafe_nearfull_ratio; if (nearfull_ratio > 1.0) nearfull_ratio /= 100.0; return nearfull_ratio; } @@ -2551,7 +2557,7 @@ void OSDService::check_nearfull_warning(const osd_stat_t &osd_stat) if (cur_state != new_state) { cur_state = new_state; - } else if (now - last_msg < g_conf->osd_op_complaint_time) { + } else if (now - last_msg < cct->_conf->osd_op_complaint_time) { return; } last_msg = now; @@ -2573,7 +2579,7 @@ bool OSDService::too_full_for_backfill(double *_ratio, double *_max_ratio) { Mutex::Locker l(full_status_lock); double max_ratio; - max_ratio = g_conf->osd_backfill_full_ratio; + max_ratio = cct->_conf->osd_backfill_full_ratio; if (_ratio) *_ratio = cur_ratio; if (_max_ratio) @@ -2588,9 +2594,17 @@ void OSD::update_osd_stat() struct statfs stbuf; store->statfs(&stbuf); - osd_stat.kb = stbuf.f_blocks * stbuf.f_bsize / 1024; - osd_stat.kb_used = (stbuf.f_blocks - stbuf.f_bfree) * stbuf.f_bsize / 1024; - osd_stat.kb_avail = stbuf.f_bavail * stbuf.f_bsize / 1024; + uint64_t bytes = stbuf.f_blocks * stbuf.f_bsize; + uint64_t used = (stbuf.f_blocks - stbuf.f_bfree) * stbuf.f_bsize; + uint64_t avail = stbuf.f_bavail * stbuf.f_bsize; + + osd_stat.kb = bytes >> 10; + osd_stat.kb_used = used >> 10; + osd_stat.kb_avail = avail >> 10; + + logger->set(l_osd_stat_bytes, bytes); + logger->set(l_osd_stat_bytes_used, used); + logger->set(l_osd_stat_bytes_avail, avail); osd_stat.hb_in.clear(); for (map<int,HeartbeatInfo>::iterator p = heartbeat_peers.begin(); p != heartbeat_peers.end(); ++p) @@ -2668,13 +2682,13 @@ void OSD::maybe_update_heartbeat_peers() assert(osd_lock.is_locked()); if (is_waiting_for_healthy()) { - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); if (last_heartbeat_resample == utime_t()) { last_heartbeat_resample = now; heartbeat_need_update = true; } else if (!heartbeat_need_update) { utime_t dur = now - last_heartbeat_resample; - if (dur > g_conf->osd_heartbeat_grace) { + if (dur > cct->_conf->osd_heartbeat_grace) { dout(10) << "maybe_update_heartbeat_peers forcing update after " << dur << " seconds" << dendl; heartbeat_need_update = true; last_heartbeat_resample = now; @@ -2747,7 +2761,7 @@ void OSD::maybe_update_heartbeat_peers() // too few? int start = osdmap->get_next_up_osd_after(whoami); for (int n = start; n >= 0; ) { - if ((int)heartbeat_peers.size() >= g_conf->osd_heartbeat_min_peers) + if ((int)heartbeat_peers.size() >= cct->_conf->osd_heartbeat_min_peers) break; if (!extras.count(n) && !want.count(n) && n != whoami) { dout(10) << " adding random peer osd." << n << dendl; @@ -2761,7 +2775,7 @@ void OSD::maybe_update_heartbeat_peers() // too many? for (set<int>::iterator p = extras.begin(); - (int)heartbeat_peers.size() > g_conf->osd_heartbeat_min_peers && p != extras.end(); + (int)heartbeat_peers.size() > cct->_conf->osd_heartbeat_min_peers && p != extras.end(); ++p) { if (want.count(*p)) continue; @@ -2811,7 +2825,7 @@ void OSD::handle_osd_ping(MOSDPing *m) case MOSDPing::PING: { - if (g_conf->osd_debug_drop_ping_probability > 0) { + if (cct->_conf->osd_debug_drop_ping_probability > 0) { if (debug_heartbeat_drops_remaining.count(from)) { if (debug_heartbeat_drops_remaining[from] == 0) { debug_heartbeat_drops_remaining.erase(from); @@ -2822,10 +2836,10 @@ void OSD::handle_osd_ping(MOSDPing *m) << " remaining to drop" << dendl; break; } - } else if (g_conf->osd_debug_drop_ping_probability > + } else if (cct->_conf->osd_debug_drop_ping_probability > ((((double)(rand()%100))/100.0))) { debug_heartbeat_drops_remaining[from] = - g_conf->osd_debug_drop_ping_duration; + cct->_conf->osd_debug_drop_ping_duration; dout(5) << "Dropping heartbeat from " << from << ", " << debug_heartbeat_drops_remaining[from] << " remaining to drop" << dendl; @@ -2833,7 +2847,7 @@ void OSD::handle_osd_ping(MOSDPing *m) } } - if (!g_ceph_context->get_heartbeat_map()->is_healthy()) { + if (!cct->get_heartbeat_map()->is_healthy()) { dout(10) << "internal heartbeat not healthy, dropping ping request" << dendl; break; } @@ -2901,8 +2915,8 @@ void OSD::handle_osd_ping(MOSDPing *m) } } - utime_t cutoff = ceph_clock_now(g_ceph_context); - cutoff -= g_conf->osd_heartbeat_grace; + utime_t cutoff = ceph_clock_now(cct); + cutoff -= cct->_conf->osd_heartbeat_grace; if (i->second.is_healthy(cutoff)) { // Cancel false reports if (failure_queue.count(from)) { @@ -2938,11 +2952,11 @@ void OSD::heartbeat_entry() while (!heartbeat_stop) { heartbeat(); - double wait = .5 + ((float)(rand() % 10)/10.0) * (float)g_conf->osd_heartbeat_interval; + double wait = .5 + ((float)(rand() % 10)/10.0) * (float)cct->_conf->osd_heartbeat_interval; utime_t w; w.set_from_double(wait); dout(30) << "heartbeat_entry sleeping for " << wait << dendl; - heartbeat_cond.WaitInterval(g_ceph_context, heartbeat_lock, w); + heartbeat_cond.WaitInterval(cct, heartbeat_lock, w); if (is_stopping()) return; dout(30) << "heartbeat_entry woke up" << dendl; @@ -2952,16 +2966,16 @@ void OSD::heartbeat_entry() void OSD::heartbeat_check() { assert(heartbeat_lock.is_locked()); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); double age = hbclient_messenger->get_dispatch_queue_max_age(now); - if (age > (g_conf->osd_heartbeat_grace / 2)) { + if (age > (cct->_conf->osd_heartbeat_grace / 2)) { derr << "skipping heartbeat_check, hbqueue max age: " << age << dendl; return; // hb dispatch is too backed up for our hb status to be meaningful } // check for incoming heartbeats (move me elsewhere?) utime_t cutoff = now; - cutoff -= g_conf->osd_heartbeat_grace; + cutoff -= cct->_conf->osd_heartbeat_grace; for (map<int,HeartbeatInfo>::iterator p = heartbeat_peers.begin(); p != heartbeat_peers.end(); ++p) { @@ -3010,7 +3024,7 @@ void OSD::heartbeat() dout(5) << "heartbeat: " << osd_stat << dendl; - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); // send heartbeats for (map<int,HeartbeatInfo>::iterator i = heartbeat_peers.begin(); @@ -3043,7 +3057,7 @@ void OSD::heartbeat() // hmm.. am i all alone? dout(30) << "heartbeat lonely?" << dendl; if (heartbeat_peers.empty()) { - if (now - last_mon_heartbeat > g_conf->osd_mon_heartbeat_interval && is_active()) { + if (now - last_mon_heartbeat > cct->_conf->osd_mon_heartbeat_interval && is_active()) { last_mon_heartbeat = now; dout(10) << "i have no heartbeat peers; checking mon for new map" << dendl; monc->sub_want("osdmap", osdmap->get_epoch() + 1, CEPH_SUBSCRIBE_ONETIME); @@ -3121,19 +3135,19 @@ void OSD::tick() heartbeat_lock.Unlock(); // mon report? - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); if (outstanding_pg_stats && - (now - g_conf->osd_mon_ack_timeout) > last_pg_stats_ack) { + (now - cct->_conf->osd_mon_ack_timeout) > last_pg_stats_ack) { dout(1) << "mon hasn't acked PGStats in " << now - last_pg_stats_ack << " seconds, reconnecting elsewhere" << dendl; monc->reopen_session(); - last_pg_stats_ack = ceph_clock_now(g_ceph_context); // reset clock + last_pg_stats_ack = ceph_clock_now(cct); // reset clock last_pg_stats_sent = utime_t(); } - if (now - last_pg_stats_sent > g_conf->osd_mon_report_interval_max) { + if (now - last_pg_stats_sent > cct->_conf->osd_mon_report_interval_max) { osd_stat_updated = true; do_mon_report(); - } else if (now - last_mon_report > g_conf->osd_mon_report_interval_min) { + } else if (now - last_mon_report > cct->_conf->osd_mon_report_interval_min) { do_mon_report(); } @@ -3213,7 +3227,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, string poolstr; - cmd_getval(g_ceph_context, cmdmap, "pool", poolstr); + cmd_getval(service->cct, cmdmap, "pool", poolstr); pool = curmap->const_lookup_pg_pool_name(poolstr.c_str()); //If we can't find it by name then maybe id specified if (pool < 0 && isdigit(poolstr[0])) @@ -3224,7 +3238,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, } r = -1; string objname, nspace; - cmd_getval(g_ceph_context, cmdmap, "objname", objname); + cmd_getval(service->cct, cmdmap, "objname", objname); std::size_t found = objname.find_first_of('/'); if (found != string::npos) { nspace = objname.substr(0, found); @@ -3246,8 +3260,8 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, map<string, bufferlist> newattrs; bufferlist val; string key, valstr; - cmd_getval(g_ceph_context, cmdmap, "key", key); - cmd_getval(g_ceph_context, cmdmap, "val", valstr); + cmd_getval(service->cct, cmdmap, "key", key); + cmd_getval(service->cct, cmdmap, "val", valstr); val.append(valstr); newattrs[key] = val; @@ -3260,7 +3274,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, } else if (command == "rmomapkey") { string key; set<string> keys; - cmd_getval(g_ceph_context, cmdmap, "key", key); + cmd_getval(service->cct, cmdmap, "key", key); keys.insert(key); t.omap_rmkeys(coll_t(pgid), obj, keys); @@ -3273,7 +3287,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, bufferlist newheader; string headerstr; - cmd_getval(g_ceph_context, cmdmap, "header", headerstr); + cmd_getval(service->cct, cmdmap, "header", headerstr); newheader.append(headerstr); t.omap_setheader(coll_t(pgid), obj, newheader); r = store->apply_transaction(t); @@ -3297,7 +3311,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, } } else if (command == "truncobj") { int64_t trunclen; - cmd_getval(g_ceph_context, cmdmap, "len", trunclen); + cmd_getval(service->cct, cmdmap, "len", trunclen); t.truncate(coll_t(pgid), obj, trunclen); r = store->apply_transaction(t); if (r < 0) @@ -3319,6 +3333,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store, // ========================================= bool remove_dir( + CephContext *cct, ObjectStore *store, SnapMapper *mapper, OSDriver *osdriver, ObjectStore::Sequencer *osr, @@ -3346,7 +3361,7 @@ bool remove_dir( assert(0); } t->remove(coll, *i); - if (num >= g_conf->osd_target_transaction_size) { + if (num >= cct->_conf->osd_target_transaction_size) { C_SaferCond waiter; store->queue_transaction(osr, t, &waiter); bool cont = dstate->pause_clearing(); @@ -3386,12 +3401,12 @@ void OSD::RemoveWQ::_process(pair<PGRef, DeletingStateRef> item) if (pg->have_temp_coll()) { bool cont = remove_dir( - store, &mapper, &driver, pg->osr.get(), pg->get_temp_coll(), item.second); + pg->cct, store, &mapper, &driver, pg->osr.get(), pg->get_temp_coll(), item.second); if (!cont) return; } bool cont = remove_dir( - store, &mapper, &driver, pg->osr.get(), coll, item.second); + pg->cct, store, &mapper, &driver, pg->osr.get(), coll, item.second); if (!cont) return; @@ -3427,7 +3442,7 @@ void OSD::do_mon_report() { dout(7) << "do_mon_report" << dendl; - utime_t now(ceph_clock_now(g_ceph_context)); + utime_t now(ceph_clock_now(cct)); last_mon_report = now; // do any pending reports @@ -3450,7 +3465,7 @@ void OSD::ms_handle_connect(Connection *con) send_alive(); service.send_pg_temp(); send_failures(); - send_pg_stats(ceph_clock_now(g_ceph_context)); + send_pg_stats(ceph_clock_now(cct)); monc->sub_want("osd_pg_creates", 0, CEPH_SUBSCRIBE_ONETIME); monc->renew_subs(); @@ -3511,7 +3526,7 @@ void OSD::_maybe_boot(epoch_t oldest, epoch_t newest) // send pings sooner rather than later heartbeat_kick(); } else if (osdmap->get_epoch() >= oldest - 1 && - osdmap->get_epoch() + g_conf->osd_map_message_max > newest) { + osdmap->get_epoch() + cct->_conf->osd_map_message_max > newest) { _send_boot(); return; } @@ -3533,15 +3548,15 @@ void OSD::start_waiting_for_healthy() bool OSD::_is_healthy() { - if (!g_ceph_context->get_heartbeat_map()->is_healthy()) { + if (!cct->get_heartbeat_map()->is_healthy()) { dout(1) << "is_healthy false -- internal heartbeat failed" << dendl; return false; } if (is_waiting_for_healthy()) { Mutex::Locker l(heartbeat_lock); - utime_t cutoff = ceph_clock_now(g_ceph_context); - cutoff -= g_conf->osd_heartbeat_grace; + utime_t cutoff = ceph_clock_now(cct); + cutoff -= cct->_conf->osd_heartbeat_grace; int num = 0, up = 0; for (map<int,HeartbeatInfo>::iterator p = heartbeat_peers.begin(); p != heartbeat_peers.end(); @@ -3550,7 +3565,7 @@ bool OSD::_is_healthy() ++up; ++num; } - if ((float)up < (float)num * g_conf->osd_heartbeat_min_healthy_ratio) { + if ((float)up < (float)num * cct->_conf->osd_heartbeat_min_healthy_ratio) { dout(1) << "is_healthy false -- only " << up << "/" << num << " up peers (less than 1/3)" << dendl; return false; } @@ -3607,7 +3622,7 @@ void OSD::queue_want_up_thru(epoch_t want) up_thru_wanted = want; // expedite, a bit. WARNING this will somewhat delay other mon queries. - last_mon_report = ceph_clock_now(g_ceph_context); + last_mon_report = ceph_clock_now(cct); send_alive(); } else { dout(10) << "queue_want_up_thru want " << want << " <= queued " << up_thru_wanted @@ -3702,7 +3717,7 @@ void OSD::send_failures() heartbeat_lock.Lock(); locked = true; } - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); while (!failure_queue.empty()) { int osd = failure_queue.begin()->first; int failed_for = (int)(double)(now - failure_queue.begin()->second); @@ -3771,7 +3786,7 @@ void OSD::send_pg_stats(const utime_t &now) if (!outstanding_pg_stats) { outstanding_pg_stats = true; - last_pg_stats_ack = ceph_clock_now(g_ceph_context); + last_pg_stats_ack = ceph_clock_now(cct); } monc->send_mon_message(m); } @@ -3788,7 +3803,7 @@ void OSD::handle_pg_stats_ack(MPGStatsAck *ack) return; } - last_pg_stats_ack = ceph_clock_now(g_ceph_context); + last_pg_stats_ack = ceph_clock_now(cct); pg_stat_queue_lock.Lock(); @@ -4001,7 +4016,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist goto out; } - cmd_getval(g_ceph_context, cmdmap, "prefix", prefix); + cmd_getval(cct, cmdmap, "prefix", prefix); if (prefix == "get_command_descriptions") { int cmdnum = 0; @@ -4023,7 +4038,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist goto out; } - cmd_getval(g_ceph_context, cmdmap, "format", format); + cmd_getval(cct, cmdmap, "format", format); f.reset(new_formatter(format)); if (prefix == "version") { @@ -4039,7 +4054,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist } else if (prefix == "injectargs") { vector<string> argsvec; - cmd_getval(g_ceph_context, cmdmap, "injected_args", argsvec); + cmd_getval(cct, cmdmap, "injected_args", argsvec); if (argsvec.empty()) { r = -EINVAL; @@ -4050,7 +4065,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist for (vector<string>::iterator a = ++argsvec.begin(); a != argsvec.end(); ++a) args += " " + *a; osd_lock.Unlock(); - g_conf->injectargs(args, &ss); + cct->_conf->injectargs(args, &ss); osd_lock.Lock(); } @@ -4058,14 +4073,14 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist // 'tell <pgid>' (which comes in without any of that prefix)? else if (prefix == "pg" || - (cmd_getval(g_ceph_context, cmdmap, "pgid", pgidstr) && + (cmd_getval(cct, cmdmap, "pgid", pgidstr) && (prefix == "query" || prefix == "mark_unfound_lost" || prefix == "list_missing") )) { pg_t pgid; - if (!cmd_getval(g_ceph_context, cmdmap, "pgid", pgidstr)) { + if (!cmd_getval(cct, cmdmap, "pgid", pgidstr)) { ss << "no pgid specified"; r = -EINVAL; } else if (!pgid.parse(pgidstr.c_str())) { @@ -4079,7 +4094,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist } else { // simulate pg <pgid> cmd= for pg->do-command if (prefix != "pg") - cmd_putval(g_ceph_context, cmdmap, "cmd", prefix); + cmd_putval(cct, cmdmap, "cmd", prefix); r = pg->do_command(cmdmap, ss, data, odata); pg->unlock(); } @@ -4090,8 +4105,8 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist int64_t count; int64_t bsize; // default count 1G, size 4MB - cmd_getval(g_ceph_context, cmdmap, "count", count, (int64_t)1 << 30); - cmd_getval(g_ceph_context, cmdmap, "bsize", bsize, (int64_t)4 << 20); + cmd_getval(cct, cmdmap, "count", count, (int64_t)1 << 30); + cmd_getval(cct, cmdmap, "bsize", bsize, (int64_t)4 << 20); bufferlist bl; bufferptr bp(bsize); @@ -4101,7 +4116,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist ObjectStore::Transaction *cleanupt = new ObjectStore::Transaction; store->sync_and_flush(); - utime_t start = ceph_clock_now(g_ceph_context); + utime_t start = ceph_clock_now(cct); for (int64_t pos = 0; pos < count; pos += bsize) { char nm[30]; snprintf(nm, sizeof(nm), "disk_bw_test_%lld", (long long)pos); @@ -4113,7 +4128,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist cleanupt->remove(coll_t::META_COLL, soid); } store->sync_and_flush(); - utime_t end = ceph_clock_now(g_ceph_context); + utime_t end = ceph_clock_now(cct); // clean up store->queue_transaction(NULL, cleanupt); @@ -4143,7 +4158,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist ss << "could not issue heap profiler command -- not using tcmalloc!"; } else { string heapcmd; - cmd_getval(g_ceph_context, cmdmap, "heapcmd", heapcmd); + cmd_getval(cct, cmdmap, "heapcmd", heapcmd); // XXX 1-element vector, change at callee or make vector here? vector<string> heapcmd_vec; get_str_vec(heapcmd, heapcmd_vec); @@ -4153,7 +4168,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist else if (prefix == "debug dump_missing") { string file_name; - cmd_getval(g_ceph_context, cmdmap, "filename", file_name); + cmd_getval(cct, cmdmap, "filename", file_name); std::ofstream fout(file_name.c_str()); if (!fout.is_open()) { ss << "failed to open file '" << file_name << "'"; @@ -4199,27 +4214,27 @@ void OSD::do_command(Connection *con, tid_t tid, vector<string>& cmd, bufferlist } else if (prefix == "debug kick_recovery_wq") { int64_t delay; - cmd_getval(g_ceph_context, cmdmap, "delay", delay); + cmd_getval(cct, cmdmap, "delay", delay); ostringstream oss; oss << delay; - r = g_conf->set_val("osd_recovery_delay_start", oss.str().c_str()); + r = cct->_conf->set_val("osd_recovery_delay_start", oss.str().c_str()); if (r != 0) { ss << "kick_recovery_wq: error setting " << "osd_recovery_delay_start to '" << delay << "': error " << r; goto out; } - g_conf->apply_changes(NULL); + cct->_conf->apply_changes(NULL); ss << "kicking recovery queue. set osd_recovery_delay_start " - << "to " << g_conf->osd_recovery_delay_start; - defer_recovery_until = ceph_clock_now(g_ceph_context); - defer_recovery_until += g_conf->osd_recovery_delay_start; + << "to " << cct->_conf->osd_recovery_delay_start; + defer_recovery_until = ceph_clock_now(cct); + defer_recovery_until += cct->_conf->osd_recovery_delay_start; recovery_wq.wake(); } else if (prefix == "cpu_profiler") { string arg; - cmd_getval(g_ceph_context, cmdmap, "arg", arg); + cmd_getval(cct, cmdmap, "arg", arg); vector<string> argvec; get_str_vec(arg, argvec); cpu_profiler_handle_command(argvec, ds); @@ -4523,7 +4538,7 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type, uint64_t global_id; uint64_t auid = CEPH_AUTH_UID_DEFAULT; - isvalid = authorize_handler->verify_authorizer(g_ceph_context, monc->rotating_secrets, + isvalid = authorize_handler->verify_authorizer(cct, monc->rotating_secrets, authorizer_data, authorizer_reply, name, global_id, caps_info, session_key, &auid); if (isvalid) { @@ -4797,17 +4812,17 @@ bool OSD::scrub_should_schedule() return false; } - if (loadavgs[0] >= g_conf->osd_scrub_load_threshold) { + if (loadavgs[0] >= cct->_conf->osd_scrub_load_threshold) { dout(20) << "scrub_should_schedule loadavg " << loadavgs[0] - << " >= max " << g_conf->osd_scrub_load_threshold + << " >= max " << cct->_conf->osd_scrub_load_threshold << " = no, load too high" << dendl; return false; } dout(20) << "scrub_should_schedule loadavg " << loadavgs[0] - << " < max " << g_conf->osd_scrub_load_threshold + << " < max " << cct->_conf->osd_scrub_load_threshold << " = yes" << dendl; - return loadavgs[0] < g_conf->osd_scrub_load_threshold; + return loadavgs[0] < cct->_conf->osd_scrub_load_threshold; } void OSD::sched_scrub() @@ -4818,7 +4833,7 @@ void OSD::sched_scrub() dout(20) << "sched_scrub load_is_low=" << (int)load_is_low << dendl; - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); //dout(20) << " " << last_scrub_pg << dendl; @@ -4830,15 +4845,15 @@ void OSD::sched_scrub() dout(30) << "sched_scrub examine " << pgid << " at " << t << dendl; utime_t diff = now - t; - if ((double)diff < g_conf->osd_scrub_min_interval) { + if ((double)diff < cct->_conf->osd_scrub_min_interval) { dout(10) << "sched_scrub " << pgid << " at " << t - << ": " << (double)diff << " < min (" << g_conf->osd_scrub_min_interval << " seconds)" << dendl; + << ": " << (double)diff << " < min (" << cct->_conf->osd_scrub_min_interval << " seconds)" << dendl; break; } - if ((double)diff < g_conf->osd_scrub_max_interval && !load_is_low) { + if ((double)diff < cct->_conf->osd_scrub_max_interval && !load_is_low) { // save ourselves some effort dout(10) << "sched_scrub " << pgid << " high load at " << t - << ": " << (double)diff << " < max (" << g_conf->osd_scrub_max_interval << " seconds)" << dendl; + << ": " << (double)diff << " < max (" << cct->_conf->osd_scrub_max_interval << " seconds)" << dendl; break; } @@ -4846,11 +4861,11 @@ void OSD::sched_scrub() if (pg) { if (pg->is_active() && (load_is_low || - (double)diff >= g_conf->osd_scrub_max_interval || + (double)diff >= cct->_conf->osd_scrub_max_interval || pg->scrubber.must_scrub)) { dout(10) << "sched_scrub scrubbing " << pgid << " at " << t << (pg->scrubber.must_scrub ? ", explicitly requested" : - ( (double)diff >= g_conf->osd_scrub_max_interval ? ", diff >= max" : "")) + ( (double)diff >= cct->_conf->osd_scrub_max_interval ? ", diff >= max" : "")) << dendl; if (pg->sched_scrub()) { pg->unlock(); @@ -4869,13 +4884,13 @@ bool OSDService::inc_scrubs_pending() bool result = false; sched_scrub_lock.Lock(); - if (scrubs_pending + scrubs_active < g_conf->osd_max_scrubs) { + if (scrubs_pending + scrubs_active < cct->_conf->osd_max_scrubs) { dout(20) << "inc_scrubs_pending " << scrubs_pending << " -> " << (scrubs_pending+1) - << " (max " << g_conf->osd_max_scrubs << ", active " << scrubs_active << ")" << dendl; + << " (max " << cct->_conf->osd_max_scrubs << ", active " << scrubs_active << ")" << dendl; result = true; ++scrubs_pending; } else { - dout(20) << "inc_scrubs_pending " << scrubs_pending << " + " << scrubs_active << " active >= max " << g_conf->osd_max_scrubs << dendl; + dout(20) << "inc_scrubs_pending " << scrubs_pending << " + " << scrubs_active << " active >= max " << cct->_conf->osd_max_scrubs << dendl; } sched_scrub_lock.Unlock(); @@ -4886,7 +4901,7 @@ void OSDService::dec_scrubs_pending() { sched_scrub_lock.Lock(); dout(20) << "dec_scrubs_pending " << scrubs_pending << " -> " << (scrubs_pending-1) - << " (max " << g_conf->osd_max_scrubs << ", active " << scrubs_active << ")" << dendl; + << " (max " << cct->_conf->osd_max_scrubs << ", active " << scrubs_active << ")" << dendl; --scrubs_pending; assert(scrubs_pending >= 0); sched_scrub_lock.Unlock(); @@ -4899,12 +4914,12 @@ void OSDService::inc_scrubs_active(bool reserved) if (reserved) { --(scrubs_pending); dout(20) << "inc_scrubs_active " << (scrubs_active-1) << " -> " << scrubs_active - << " (max " << g_conf->osd_max_scrubs + << " (max " << cct->_conf->osd_max_scrubs << ", pending " << (scrubs_pending+1) << " -> " << scrubs_pending << ")" << dendl; assert(scrubs_pending >= 0); } else { dout(20) << "inc_scrubs_active " << (scrubs_active-1) << " -> " << scrubs_active - << " (max " << g_conf->osd_max_scrubs + << " (max " << cct->_conf->osd_max_scrubs << ", pending " << scrubs_pending << ")" << dendl; } sched_scrub_lock.Unlock(); @@ -4914,7 +4929,7 @@ void OSDService::dec_scrubs_active() { sched_scrub_lock.Lock(); dout(20) << "dec_scrubs_active " << scrubs_active << " -> " << (scrubs_active-1) - << " (max " << g_conf->osd_max_scrubs << ", pending " << scrubs_pending << ")" << dendl; + << " (max " << cct->_conf->osd_max_scrubs << ", pending " << scrubs_pending << ")" << dendl; --scrubs_active; sched_scrub_lock.Unlock(); } @@ -4933,10 +4948,10 @@ bool OSDService::prepare_to_stop() osdmap->get_epoch(), false )); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); utime_t timeout; - timeout.set_from_double(now + g_conf->osd_mon_shutdown_timeout); - while ((ceph_clock_now(g_ceph_context) < timeout) && + timeout.set_from_double(now + cct->_conf->osd_mon_shutdown_timeout); + while ((ceph_clock_now(cct) < timeout) && (state != STOPPING)) { is_stopping_cond.WaitUntil(is_stopping_lock, timeout); } @@ -5155,7 +5170,7 @@ void OSD::handle_osd_map(MOSDMap *m) t.remove(coll_t::META_COLL, get_inc_osdmap_pobject_name(e)); superblock.oldest_map = e+1; num++; - if (num >= g_conf->osd_target_transaction_size && + if (num >= cct->_conf->osd_target_transaction_size && (uint64_t)num > (last - first)) // make sure we at least keep pace with incoming maps break; } @@ -5168,7 +5183,7 @@ void OSD::handle_osd_map(MOSDMap *m) map_lock.get_write(); - C_Contexts *fin = new C_Contexts(g_ceph_context); + C_Contexts *fin = new C_Contexts(cct); // advance through the new maps for (epoch_t cur = start; cur <= superblock.newest_map; cur++) { @@ -5195,7 +5210,7 @@ void OSD::handle_osd_map(MOSDMap *m) superblock.current_epoch = cur; advance_map(t, fin); - had_map_since = ceph_clock_now(g_ceph_context); + had_map_since = ceph_clock_now(cct); } if (osdmap->is_up(whoami) && @@ -5629,15 +5644,15 @@ void OSD::send_incremental_map(epoch_t since, Connection *con) return; } - if (to > since && (int64_t)(to - since) > g_conf->osd_map_share_max_epochs) { - dout(10) << " " << (to - since) << " > max " << g_conf->osd_map_share_max_epochs + if (to > since && (int64_t)(to - since) > cct->_conf->osd_map_share_max_epochs) { + dout(10) << " " << (to - since) << " > max " << cct->_conf->osd_map_share_max_epochs << ", only sending most recent" << dendl; - since = to - g_conf->osd_map_share_max_epochs; + since = to - cct->_conf->osd_map_share_max_epochs; } while (since < to) { - if (to - since > (epoch_t)g_conf->osd_map_message_max) - to = since + g_conf->osd_map_message_max; + if (to - since > (epoch_t)cct->_conf->osd_map_message_max) + to = since + cct->_conf->osd_map_message_max; MOSDMap *m = build_incremental_map_msg(since, to); send_map(m, con); since = to; @@ -5704,7 +5719,7 @@ OSDMapRef OSDService::_add_map(OSDMap *o) { epoch_t e = o->get_epoch(); - if (g_conf->osd_map_dedup) { + if (cct->_conf->osd_map_dedup) { // Dedup against an existing map at a nearby epoch OSDMapRef for_dedup = map_cache.lower_bound(e); if (for_dedup) { @@ -5896,7 +5911,7 @@ void OSD::handle_pg_create(OpRequestRef op) // drop the next N pg_creates in a row? if (debug_drop_pg_create_left < 0 && - g_conf->osd_debug_drop_pg_create_probability > + cct->_conf->osd_debug_drop_pg_create_probability > ((((double)(rand()%100))/100.0))) { debug_drop_pg_create_left = debug_drop_pg_create_duration; } @@ -6020,8 +6035,8 @@ void OSD::handle_pg_create(OpRequestRef op) PG::RecoveryCtx OSD::create_context() { ObjectStore::Transaction *t = new ObjectStore::Transaction; - C_Contexts *on_applied = new C_Contexts(g_ceph_context); - C_Contexts *on_safe = new C_Contexts(g_ceph_context); + C_Contexts *on_applied = new C_Contexts(cct); + C_Contexts *on_safe = new C_Contexts(cct); map< int, map<pg_t,pg_query_t> > *query_map = new map<int, map<pg_t, pg_query_t> >; map<int,vector<pair<pg_notify_t, pg_interval_map_t> > > *notify_list = @@ -6042,8 +6057,8 @@ void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg) ctx.transaction, ctx.on_applied, ctx.on_safe); assert(tr == 0); ctx.transaction = new ObjectStore::Transaction; - ctx.on_applied = new C_Contexts(g_ceph_context); - ctx.on_safe = new C_Contexts(g_ceph_context); + ctx.on_applied = new C_Contexts(cct); + ctx.on_safe = new C_Contexts(cct); } } @@ -6697,7 +6712,7 @@ void OSD::check_replay_queue() { assert(osd_lock.is_locked()); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); list< pair<pg_t,utime_t> > pgids; replay_queue_lock.Lock(); while (!replay_queue.empty() && @@ -6741,12 +6756,12 @@ bool OSDService::queue_for_recovery(PG *pg) bool OSD::_recover_now() { - if (recovery_ops_active >= g_conf->osd_recovery_max_active) { + if (recovery_ops_active >= cct->_conf->osd_recovery_max_active) { dout(15) << "_recover_now active " << recovery_ops_active - << " >= max " << g_conf->osd_recovery_max_active << dendl; + << " >= max " << cct->_conf->osd_recovery_max_active << dendl; return false; } - if (ceph_clock_now(g_ceph_context) < defer_recovery_until) { + if (ceph_clock_now(cct) < defer_recovery_until) { dout(15) << "_recover_now defer until " << defer_recovery_until << dendl; return false; } @@ -6758,14 +6773,14 @@ void OSD::do_recovery(PG *pg, ThreadPool::TPHandle &handle) { // see how many we should try to start. note that this is a bit racy. recovery_wq.lock(); - int max = MAX(g_conf->osd_recovery_max_active - recovery_ops_active, - g_conf->osd_recovery_max_single_start); + int max = MAX(cct->_conf->osd_recovery_max_active - recovery_ops_active, + cct->_conf->osd_recovery_max_single_start); if (max > 0) { - dout(10) << "do_recovery can start " << max << " (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active + dout(10) << "do_recovery can start " << max << " (" << recovery_ops_active << "/" << cct->_conf->osd_recovery_max_active << " rops)" << dendl; recovery_ops_active += max; // take them now, return them if we don't use them. } else { - dout(10) << "do_recovery can start 0 (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active + dout(10) << "do_recovery can start 0 (" << recovery_ops_active << "/" << cct->_conf->osd_recovery_max_active << " rops)" << dendl; } recovery_wq.unlock(); @@ -6826,7 +6841,7 @@ void OSD::start_recovery_op(PG *pg, const hobject_t& soid) { recovery_wq.lock(); dout(10) << "start_recovery_op " << *pg << " " << soid - << " (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active << " rops)" + << " (" << recovery_ops_active << "/" << cct->_conf->osd_recovery_max_active << " rops)" << dendl; assert(recovery_ops_active >= 0); recovery_ops_active++; @@ -6845,7 +6860,7 @@ void OSD::finish_recovery_op(PG *pg, const hobject_t& soid, bool dequeue) recovery_wq.lock(); dout(10) << "finish_recovery_op " << *pg << " " << soid << " dequeue=" << dequeue - << " (" << recovery_ops_active << "/" << g_conf->osd_recovery_max_active << " rops)" + << " (" << recovery_ops_active << "/" << cct->_conf->osd_recovery_max_active << " rops)" << dendl; // adjust count @@ -6950,9 +6965,9 @@ void OSD::handle_op(OpRequestRef op) } } - if (g_conf->osd_debug_drop_op_probability > 0 && + if (cct->_conf->osd_debug_drop_op_probability > 0 && !m->get_source().is_mds()) { - if ((double)rand() / (double)RAND_MAX < g_conf->osd_debug_drop_op_probability) { + if ((double)rand() / (double)RAND_MAX < cct->_conf->osd_debug_drop_op_probability) { dout(0) << "handle_op DEBUG artificially dropping op " << *m << dendl; return; } @@ -6974,11 +6989,11 @@ void OSD::handle_op(OpRequestRef op) } // too big? - if (g_conf->osd_max_write_size && - m->get_data_len() > g_conf->osd_max_write_size << 20) { + if (cct->_conf->osd_max_write_size && + m->get_data_len() > cct->_conf->osd_max_write_size << 20) { // journal can't hold commit! derr << "handle_op msg data len " << m->get_data_len() - << " > osd_max_write_size " << (g_conf->osd_max_write_size << 20) + << " > osd_max_write_size " << (cct->_conf->osd_max_write_size << 20) << " on " << *m << dendl; service.reply_op_error(op, -OSD_WRITETOOBIG); return; @@ -7099,7 +7114,7 @@ bool OSD::op_is_discardable(MOSDOp *op) */ void OSD::enqueue_op(PG *pg, OpRequestRef op) { - utime_t latency = ceph_clock_now(g_ceph_context) - op->request->get_recv_stamp(); + utime_t latency = ceph_clock_now(cct) - op->request->get_recv_stamp(); dout(15) << "enqueue_op " << op << " prio " << op->request->get_priority() << " cost " << op->request->get_cost() << " latency " << latency @@ -7190,7 +7205,7 @@ void OSD::dequeue_op( PGRef pg, OpRequestRef op, ThreadPool::TPHandle &handle) { - utime_t latency = ceph_clock_now(g_ceph_context) - op->request->get_recv_stamp(); + utime_t latency = ceph_clock_now(cct) - op->request->get_recv_stamp(); dout(10) << "dequeue_op " << op << " prio " << op->request->get_priority() << " cost " << op->request->get_cost() << " latency " << latency @@ -7304,8 +7319,8 @@ void OSD::handle_conf_change(const struct md_config_t *conf, const std::set <std::string> &changed) { if (changed.count("osd_max_backfills")) { - service.local_reserver.set_max(g_conf->osd_max_backfills); - service.remote_reserver.set_max(g_conf->osd_max_backfills); + service.local_reserver.set_max(cct->_conf->osd_max_backfills); + service.remote_reserver.set_max(cct->_conf->osd_max_backfills); } } @@ -7382,3 +7397,34 @@ int OSD::init_op_flags(OpRequestRef op) return 0; } + +bool OSD::RecoveryWQ::_enqueue(PG *pg) { + if (!pg->recovery_item.is_on_list()) { + pg->get("RecoveryWQ"); + osd->recovery_queue.push_back(&pg->recovery_item); + + if (osd->cct->_conf->osd_recovery_delay_start > 0) { + osd->defer_recovery_until = ceph_clock_now(osd->cct); + osd->defer_recovery_until += osd->cct->_conf->osd_recovery_delay_start; + } + return true; + } + return false; +} + +void OSD::PeeringWQ::_dequeue(list<PG*> *out) { + set<PG*> got; + for (list<PG*>::iterator i = peering_queue.begin(); + i != peering_queue.end() && + out->size() < osd->cct->_conf->osd_peering_wq_batch_size; + ) { + if (in_use.count(*i)) { + ++i; + } else { + out->push_back(*i); + got.insert(*i); + peering_queue.erase(i++); + } + } + in_use.insert(got.begin(), got.end()); +} diff --git a/src/osd/OSD.h b/src/osd/OSD.h index bd5e3d0bbbd..f5f50be4af8 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -27,6 +27,7 @@ #include "common/WorkQueue.h" #include "common/LogClient.h" #include "common/AsyncReserver.h" +#include "common/ceph_context.h" #include "os/ObjectStore.h" #include "OSDCap.h" @@ -114,6 +115,10 @@ enum { l_osd_waiting_for_map, + l_osd_stat_bytes, + l_osd_stat_bytes_used, + l_osd_stat_bytes_avail, + l_osd_last, }; @@ -282,6 +287,7 @@ class OSD; class OSDService { public: OSD *osd; + CephContext *cct; SharedPtrRegistry<pg_t, ObjectStore::Sequencer> osr_registry; SharedPtrRegistry<pg_t, DeletingState> deleting_pgs; const int whoami; @@ -433,7 +439,7 @@ public: bool ms_get_authorizer(int dest_type, AuthAuthorizer **authorizer, bool force_new); - ObjecterDispatcher(OSDService *o) : Dispatcher(g_ceph_context), osd(o) {} + ObjecterDispatcher(OSDService *o) : Dispatcher(cct), osd(o) {} } objecter_dispatcher; friend class ObjecterDispatcher; @@ -856,7 +862,7 @@ public: struct HeartbeatDispatcher : public Dispatcher { OSD *osd; - HeartbeatDispatcher(OSD *o) : Dispatcher(g_ceph_context), osd(o) {} + HeartbeatDispatcher(OSD *o) : Dispatcher(cct), osd(o) {} bool ms_dispatch(Message *m) { return osd->heartbeat_dispatch(m); }; @@ -1003,22 +1009,7 @@ private: bool _empty() { return peering_queue.empty(); } - void _dequeue(list<PG*> *out) { - set<PG*> got; - for (list<PG*>::iterator i = peering_queue.begin(); - i != peering_queue.end() && - out->size() < g_conf->osd_peering_wq_batch_size; - ) { - if (in_use.count(*i)) { - ++i; - } else { - out->push_back(*i); - got.insert(*i); - peering_queue.erase(i++); - } - } - in_use.insert(got.begin(), got.end()); - } + void _dequeue(list<PG*> *out); void _process( const list<PG *> &pgs, ThreadPool::TPHandle &handle) { @@ -1394,19 +1385,7 @@ protected: bool _empty() { return osd->recovery_queue.empty(); } - bool _enqueue(PG *pg) { - if (!pg->recovery_item.is_on_list()) { - pg->get("RecoveryWQ"); - osd->recovery_queue.push_back(&pg->recovery_item); - - if (g_conf->osd_recovery_delay_start > 0) { - osd->defer_recovery_until = ceph_clock_now(g_ceph_context); - osd->defer_recovery_until += g_conf->osd_recovery_delay_start; - } - return true; - } - return false; - } + bool _enqueue(PG *pg); void _dequeue(PG *pg) { if (pg->recovery_item.remove_myself()) pg->put("RecoveryWQ"); @@ -1693,7 +1672,8 @@ protected: public: /* internal and external can point to the same messenger, they will still * be cleaned up properly*/ - OSD(int id, + OSD(CephContext *cct_, + int id, Messenger *internal, Messenger *external, Messenger *hb_client, @@ -1705,15 +1685,15 @@ protected: // static bits static int find_osd_dev(char *result, int whoami); - static ObjectStore *create_object_store(const std::string &dev, const std::string &jdev); + static ObjectStore *create_object_store(CephContext *cct, const std::string &dev, const std::string &jdev); static int convertfs(const std::string &dev, const std::string &jdev); static int do_convertfs(ObjectStore *store); static int convert_collection(ObjectStore *store, coll_t cid); - static int mkfs(const std::string &dev, const std::string &jdev, + static int mkfs(CephContext *cct, const std::string &dev, const std::string &jdev, uuid_d fsid, int whoami); - static int mkjournal(const std::string &dev, const std::string &jdev); - static int flushjournal(const std::string &dev, const std::string &jdev); - static int dump_journal(const std::string &dev, const std::string &jdev, ostream& out); + static int mkjournal(CephContext *cct, const std::string &dev, const std::string &jdev); + static int flushjournal(CephContext *cct, const std::string &dev, const std::string &jdev); + static int dump_journal(CephContext *cct, const std::string &dev, const std::string &jdev, ostream& out); /* remove any non-user xattrs from a map of them */ void filter_xattrs(map<string, bufferptr>& attrs) { for (map<string, bufferptr>::iterator iter = attrs.begin(); diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 4b35b0c48ea..8007d613b8c 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1845,7 +1845,9 @@ void OSDMap::build_simple_crush_map(CephContext *cct, CrushWrapper& crush, crush.set_type_name(6, "root"); // root - int rootid = crush.add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, 6 /* pool */, 0, NULL, NULL); + int rootid; + int r = crush.add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, 6 /* pool */, 0, NULL, NULL, &rootid); + assert(r == 0); crush.set_item_name(rootid, "default"); for (int o=0; o<nosd; o++) { @@ -1975,7 +1977,9 @@ void OSDMap::build_simple_crush_map_from_conf(CephContext *cct, CrushWrapper& cr set<string> hosts, racks; // root - int rootid = crush.add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, 6 /* pool */, 0, NULL, NULL); + int rootid; + int r = crush.add_bucket(0, CRUSH_BUCKET_STRAW, CRUSH_HASH_DEFAULT, 6 /* pool */, 0, NULL, NULL, &rootid); + assert(r == 0); crush.set_item_name(rootid, "default"); // add osds diff --git a/src/osd/OpRequest.cc b/src/osd/OpRequest.cc index c694362a8a5..1ffe3073051 100644 --- a/src/osd/OpRequest.cc +++ b/src/osd/OpRequest.cc @@ -30,9 +30,9 @@ OpRequest::OpRequest(Message *req, OpTracker *tracker) : seq(0) { received_time = request->get_recv_stamp(); tracker->register_inflight_op(&xitem); - if (req->get_priority() < g_conf->osd_client_op_priority) { + if (req->get_priority() < tracker->cct->_conf->osd_client_op_priority) { // don't warn as quickly for low priority ops - warn_interval_multiplier = g_conf->osd_recovery_op_warn_multiple; + warn_interval_multiplier = tracker->cct->_conf->osd_recovery_op_warn_multiple; } } @@ -56,14 +56,14 @@ void OpHistory::cleanup(utime_t now) { while (arrived.size() && (now - arrived.begin()->first > - (double)(g_conf->osd_op_history_duration))) { + (double)(tracker->cct->_conf->osd_op_history_duration))) { duration.erase(make_pair( arrived.begin()->second->get_duration(), arrived.begin()->second)); arrived.erase(arrived.begin()); } - while (duration.size() > g_conf->osd_op_history_size) { + while (duration.size() > tracker->cct->_conf->osd_op_history_size) { arrived.erase(make_pair( duration.begin()->second->get_arrived(), duration.begin()->second)); @@ -75,8 +75,8 @@ void OpHistory::dump_ops(utime_t now, Formatter *f) { cleanup(now); f->open_object_section("OpHistory"); - f->dump_int("num to keep", g_conf->osd_op_history_size); - f->dump_int("duration to keep", g_conf->osd_op_history_duration); + f->dump_int("num to keep", tracker->cct->_conf->osd_op_history_size); + f->dump_int("duration to keep", tracker->cct->_conf->osd_op_history_duration); { f->open_array_section("Ops"); for (set<pair<utime_t, OpRequestRef> >::const_iterator i = @@ -95,7 +95,7 @@ void OpHistory::dump_ops(utime_t now, Formatter *f) void OpTracker::dump_historic_ops(Formatter *f) { Mutex::Locker locker(ops_in_flight_lock); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); history.dump_ops(now, f); } @@ -105,7 +105,7 @@ void OpTracker::dump_ops_in_flight(Formatter *f) f->open_object_section("ops_in_flight"); // overall dump f->dump_int("num_ops", ops_in_flight.size()); f->open_array_section("ops"); // list of OpRequests - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); for (xlist<OpRequest*>::iterator p = ops_in_flight.begin(); !p.end(); ++p) { f->open_object_section("op"); (*p)->dump(now, f); @@ -126,7 +126,7 @@ void OpTracker::unregister_inflight_op(OpRequest *i) { Mutex::Locker locker(ops_in_flight_lock); assert(i->xitem.get_list() == &ops_in_flight); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); i->xitem.remove_myself(); i->request->clear_data(); history.insert(now, OpRequestRef(i)); @@ -138,9 +138,9 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector) if (!ops_in_flight.size()) return false; - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); utime_t too_old = now; - too_old -= g_conf->osd_op_complaint_time; + too_old -= cct->_conf->osd_op_complaint_time; utime_t oldest_secs = now - ops_in_flight.front()->received_time; @@ -148,11 +148,11 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector) << "; oldest is " << oldest_secs << " seconds old" << dendl; - if (oldest_secs < g_conf->osd_op_complaint_time) + if (oldest_secs < cct->_conf->osd_op_complaint_time) return false; xlist<OpRequest*>::iterator i = ops_in_flight.begin(); - warning_vector.reserve(g_conf->osd_op_log_threshold + 1); + warning_vector.reserve(cct->_conf->osd_op_log_threshold + 1); int slow = 0; // total slow int warned = 0; // total logged @@ -161,13 +161,13 @@ bool OpTracker::check_ops_in_flight(std::vector<string> &warning_vector) // exponential backoff of warning intervals if (((*i)->received_time + - (g_conf->osd_op_complaint_time * + (cct->_conf->osd_op_complaint_time * (*i)->warn_interval_multiplier)) < now) { // will warn if (warning_vector.empty()) warning_vector.push_back(""); warned++; - if (warned > g_conf->osd_op_log_threshold) + if (warned > cct->_conf->osd_op_log_threshold) break; utime_t age = now - (*i)->received_time; @@ -259,7 +259,7 @@ void OpRequest::dump(utime_t now, Formatter *f) const void OpTracker::mark_event(OpRequest *op, const string &dest) { - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); return _mark_event(op, dest, now); } @@ -297,7 +297,7 @@ OpRequestRef OpTracker::create_request(Message *ref) void OpRequest::mark_event(const string &event) { - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(tracker->cct); { Mutex::Locker l(lock); events.push_back(make_pair(now, event)); diff --git a/src/osd/OpRequest.h b/src/osd/OpRequest.h index fc8a8ab82c9..50ade71a1b9 100644 --- a/src/osd/OpRequest.h +++ b/src/osd/OpRequest.h @@ -26,15 +26,17 @@ #include "osd/osd_types.h" struct OpRequest; +class OpTracker; typedef std::tr1::shared_ptr<OpRequest> OpRequestRef; class OpHistory { set<pair<utime_t, OpRequestRef> > arrived; set<pair<double, OpRequestRef> > duration; void cleanup(utime_t now); bool shutdown; + OpTracker *tracker; public: - OpHistory() : shutdown(false) {} + OpHistory(OpTracker *tracker_) : shutdown(false), tracker(tracker_) {} ~OpHistory() { assert(arrived.empty()); assert(duration.empty()); @@ -52,13 +54,18 @@ class OpTracker { void operator()(OpRequest *op); }; friend class RemoveOnDelete; + friend class OpRequest; + friend class OpHistory; uint64_t seq; Mutex ops_in_flight_lock; xlist<OpRequest *> ops_in_flight; OpHistory history; +protected: + CephContext *cct; + public: - OpTracker() : seq(0), ops_in_flight_lock("OpTracker mutex") {} + OpTracker(CephContext *cct_) : seq(0), ops_in_flight_lock("OpTracker mutex"), history(this), cct(cct_) {} void dump_ops_in_flight(Formatter *f); void dump_historic_ops(Formatter *f); void register_inflight_op(xlist<OpRequest*>::item *i); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 2b81856b202..f319d160a39 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1,3 +1,4 @@ + // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab /* @@ -142,6 +143,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, const PGPool &_pool, pg_t p, const hobject_t& loid, const hobject_t& ioid) : osd(o), + cct(o->cct), osdriver(osd->store, coll_t(), OSD::make_snapmapper_oid()), snap_mapper( &osdriver, @@ -158,7 +160,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, deleting(false), dirty_info(false), dirty_big_info(false), info(p), info_struct_v(0), - coll(p), pg_log(g_ceph_context), log_oid(loid), biginfo_oid(ioid), + coll(p), pg_log(cct), log_oid(loid), biginfo_oid(ioid), recovery_item(this), scrub_item(this), scrub_finalize_item(this), snap_trim_item(this), stat_queue_item(this), recovery_ops_active(0), waiting_on_backfill(0), @@ -1094,7 +1096,7 @@ void PG::activate(ObjectStore::Transaction& t, if (is_primary() && pool.info.crash_replay_interval > 0 && may_need_replay(get_osdmap())) { - replay_until = ceph_clock_now(g_ceph_context); + replay_until = ceph_clock_now(cct); replay_until += pool.info.crash_replay_interval; dout(10) << "activate starting replay interval for " << pool.info.crash_replay_interval << " until " << replay_until << dendl; @@ -1223,7 +1225,7 @@ void PG::activate(ObjectStore::Transaction& t, m = new MOSDPGLog(get_osdmap()->get_epoch(), pi); // send some recent log, so that op dup detection works well. - m->log.copy_up_to(pg_log.get_log(), g_conf->osd_min_pg_log_entries); + m->log.copy_up_to(pg_log.get_log(), cct->_conf->osd_min_pg_log_entries); m->info.log_tail = m->log.tail; pi.log_tail = m->log.tail; // sigh... @@ -1918,7 +1920,7 @@ void PG::publish_stats_to_osd() else state_clear(PG_STATE_INCONSISTENT); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); info.stats.last_fresh = now; if (info.stats.state != state) { info.stats.state = state; @@ -2625,8 +2627,8 @@ bool PG::sched_scrub() return false; } - bool time_for_deep = (ceph_clock_now(g_ceph_context) > - info.history.last_deep_scrub_stamp + g_conf->osd_deep_scrub_interval); + bool time_for_deep = (ceph_clock_now(cct) > + info.history.last_deep_scrub_stamp + cct->_conf->osd_deep_scrub_interval); //NODEEP_SCRUB so ignore time initiated deep-scrub if (osd->osd->get_osdmap()->test_flag(CEPH_OSDMAP_NODEEP_SCRUB)) @@ -2778,7 +2780,7 @@ void PG::_scan_list( int r; __u64 pos = 0; while ( (r = osd->store->read(coll, poid, pos, - g_conf->osd_deep_scrub_stride, bl, + cct->_conf->osd_deep_scrub_stride, bl, true)) > 0) { handle.reset_tp_timeout(); h << bl; @@ -2812,8 +2814,8 @@ void PG::_scan_list( assert(iter); uint64_t keys_scanned = 0; for (iter->seek_to_first(); iter->valid() ; iter->next()) { - if (g_conf->osd_scan_list_ping_tp_interval && - (keys_scanned % g_conf->osd_scan_list_ping_tp_interval == 0)) { + if (cct->_conf->osd_scan_list_ping_tp_interval && + (keys_scanned % cct->_conf->osd_scan_list_ping_tp_interval == 0)) { handle.reset_tp_timeout(); } ++keys_scanned; @@ -2969,7 +2971,7 @@ void PG::schedule_backfill_full_retry() { Mutex::Locker lock(osd->backfill_request_lock); osd->backfill_request_timer.add_event_after( - g_conf->osd_backfill_retry_interval, + cct->_conf->osd_backfill_retry_interval, new QueuePeeringEvt<RequestBackfill>( this, get_osdmap()->get_epoch(), RequestBackfill())); @@ -3629,8 +3631,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle) while (!boundary_found) { vector<hobject_t> objects; ret = osd->store->collection_list_partial(coll, start, - g_conf->osd_scrub_chunk_min, - g_conf->osd_scrub_chunk_max, + cct->_conf->osd_scrub_chunk_min, + cct->_conf->osd_scrub_chunk_max, 0, &objects, &scrubber.end); assert(ret >= 0); @@ -4213,7 +4215,7 @@ void PG::scrub_finish() // finish up unreg_next_scrub(); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); info.history.last_scrub = info.last_update; info.history.last_scrub_stamp = now; if (scrubber.deep) { @@ -4687,7 +4689,7 @@ void PG::proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &oinfo) if (last_complete_ondisk.epoch >= info.history.last_epoch_started) { // DEBUG: verify that the snaps are empty in snap_mapper - if (g_conf->osd_debug_verify_snaps_on_info) { + if (cct->_conf->osd_debug_verify_snaps_on_info) { interval_set<snapid_t> p; p.union_of(oinfo.purged_snaps, info.purged_snaps); p.subtract(info.purged_snaps); @@ -5062,7 +5064,7 @@ void PG::handle_activate_map(RecoveryCtx *rctx) ActMap evt; recovery_state.handle_event(evt, rctx); if (osdmap_ref->get_epoch() - last_persisted_osdmap_ref->get_epoch() > - g_conf->osd_pg_epoch_persisted_max_stale) { + cct->_conf->osd_pg_epoch_persisted_max_stale) { dout(20) << __func__ << ": Dirtying info: last_persisted is " << last_persisted_osdmap_ref->get_epoch() << " while current is " << osdmap_ref->get_epoch() << dendl; @@ -5116,9 +5118,9 @@ std::ostream& operator<<(std::ostream& oss, /*------Crashed-------*/ PG::RecoveryState::Crashed::Crashed(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Crashed") { - state_name = "Crashed"; context< RecoveryMachine >().log_enter(state_name); assert(0 == "we got a bad state machine event"); } @@ -5126,9 +5128,9 @@ PG::RecoveryState::Crashed::Crashed(my_context ctx) /*------Initial-------*/ PG::RecoveryState::Initial::Initial(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Initial") { - state_name = "Initial"; context< RecoveryMachine >().log_enter(state_name); } @@ -5171,15 +5173,15 @@ void PG::RecoveryState::Initial::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_initial_latency, dur); } /*------Started-------*/ PG::RecoveryState::Started::Started(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started") { - state_name = "Started"; context< RecoveryMachine >().log_enter(state_name); } @@ -5220,15 +5222,15 @@ void PG::RecoveryState::Started::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_started_latency, dur); } /*--------Reset---------*/ PG::RecoveryState::Reset::Reset(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Reset") { - state_name = "Reset"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; pg->flushed = false; @@ -5295,15 +5297,15 @@ void PG::RecoveryState::Reset::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_reset_latency, dur); } /*-------Start---------*/ PG::RecoveryState::Start::Start(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Start") { - state_name = "Start"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5320,15 +5322,15 @@ void PG::RecoveryState::Start::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_start_latency, dur); } /*---------Primary--------*/ PG::RecoveryState::Primary::Primary(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary") { - state_name = "Started/Primary"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; assert(pg->want_acting.empty()); @@ -5369,15 +5371,16 @@ void PG::RecoveryState::Primary::exit() context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; pg->want_acting.clear(); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_primary_latency, dur); } /*---------Peering--------*/ PG::RecoveryState::Peering::Peering(my_context ctx) - : my_base(ctx), flushed(false) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering"), + flushed(false) { - state_name = "Started/Primary/Peering"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5457,16 +5460,16 @@ void PG::RecoveryState::Peering::exit() pg->state_clear(PG_STATE_PEERING); pg->clear_probe_targets(); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_peering_latency, dur); } /*------Backfilling-------*/ PG::RecoveryState::Backfilling::Backfilling(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/Backfilling") { - state_name = "Started/Primary/Active/Backfilling"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; pg->backfill_reserved = true; @@ -5495,16 +5498,16 @@ void PG::RecoveryState::Backfilling::exit() pg->backfill_reserved = false; pg->backfill_reserving = false; pg->state_clear(PG_STATE_BACKFILL); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_backfilling_latency, dur); } /*--WaitRemoteBackfillReserved--*/ PG::RecoveryState::WaitRemoteBackfillReserved::WaitRemoteBackfillReserved(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/WaitRemoteBackfillReserved") { - state_name = "Started/Primary/Active/WaitRemoteBackfillReserved"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; pg->state_set(PG_STATE_BACKFILL_WAIT); @@ -5530,7 +5533,7 @@ void PG::RecoveryState::WaitRemoteBackfillReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitremotebackfillreserved_latency, dur); } @@ -5557,9 +5560,9 @@ PG::RecoveryState::WaitRemoteBackfillReserved::react(const RemoteReservationReje /*--WaitLocalBackfillReserved--*/ PG::RecoveryState::WaitLocalBackfillReserved::WaitLocalBackfillReserved(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/WaitLocalBackfillReserved") { - state_name = "Started/Primary/Active/WaitLocalBackfillReserved"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; pg->state_set(PG_STATE_BACKFILL_WAIT); @@ -5575,15 +5578,15 @@ void PG::RecoveryState::WaitLocalBackfillReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitlocalbackfillreserved_latency, dur); } /*----NotBackfilling------*/ PG::RecoveryState::NotBackfilling::NotBackfilling(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/NotBackfilling") { - state_name = "Started/Primary/Active/NotBackfilling"; context< RecoveryMachine >().log_enter(state_name); } @@ -5591,15 +5594,15 @@ void PG::RecoveryState::NotBackfilling::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_notbackfilling_latency, dur); } /*---RepNotRecovering----*/ PG::RecoveryState::RepNotRecovering::RepNotRecovering(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/ReplicaActive/RepNotRecovering") { - state_name = "Started/ReplicaActive/RepNotRecovering"; context< RecoveryMachine >().log_enter(state_name); } @@ -5607,15 +5610,15 @@ void PG::RecoveryState::RepNotRecovering::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_repnotrecovering_latency, dur); } /*---RepWaitRecoveryReserved--*/ PG::RecoveryState::RepWaitRecoveryReserved::RepWaitRecoveryReserved(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/ReplicaActive/RepWaitRecoveryReserved") { - state_name = "Started/ReplicaActive/RepWaitRecoveryReserved"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5644,15 +5647,15 @@ void PG::RecoveryState::RepWaitRecoveryReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_repwaitrecoveryreserved_latency, dur); } /*-RepWaitBackfillReserved*/ PG::RecoveryState::RepWaitBackfillReserved::RepWaitBackfillReserved(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/ReplicaActive/RepWaitBackfillReserved") { - state_name = "Started/ReplicaActive/RepWaitBackfillReserved"; context< RecoveryMachine >().log_enter(state_name); } @@ -5663,7 +5666,7 @@ PG::RecoveryState::RepNotRecovering::react(const RequestBackfillPrio &evt) double ratio, max_ratio; if (pg->osd->too_full_for_backfill(&ratio, &max_ratio) && - !g_conf->osd_debug_skip_full_check_in_backfill_reservation) { + !pg->cct->_conf->osd_debug_skip_full_check_in_backfill_reservation) { dout(10) << "backfill reservation rejected: full ratio is " << ratio << ", which is greater than max allowed ratio " << max_ratio << dendl; @@ -5682,7 +5685,7 @@ void PG::RecoveryState::RepWaitBackfillReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_repwaitbackfillreserved_latency, dur); } @@ -5710,9 +5713,9 @@ PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteReservationRejecte /*---RepRecovering-------*/ PG::RecoveryState::RepRecovering::RepRecovering(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/ReplicaActive/RepRecovering") { - state_name = "Started/ReplicaActive/RepRecovering"; context< RecoveryMachine >().log_enter(state_name); } @@ -5729,15 +5732,15 @@ void PG::RecoveryState::RepRecovering::exit() context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_RepRecovering_latency, dur); } /*------Activating--------*/ PG::RecoveryState::Activating::Activating(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/Activating") { - state_name = "Started/Primary/Active/Activating"; context< RecoveryMachine >().log_enter(state_name); } @@ -5745,14 +5748,14 @@ void PG::RecoveryState::Activating::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_activating_latency, dur); } PG::RecoveryState::WaitLocalRecoveryReserved::WaitLocalRecoveryReserved(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/WaitLocalRecoveryReserved") { - state_name = "Started/Primary/Active/WaitLocalRecoveryReserved"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; pg->state_set(PG_STATE_RECOVERY_WAIT); @@ -5767,15 +5770,15 @@ void PG::RecoveryState::WaitLocalRecoveryReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitlocalrecoveryreserved_latency, dur); } PG::RecoveryState::WaitRemoteRecoveryReserved::WaitRemoteRecoveryReserved(my_context ctx) : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/WaitRemoteRecoveryReserved"), acting_osd_it(context< Active >().sorted_acting_set.begin()) { - state_name = "Started/Primary/Active/WaitRemoteRecoveryReserved"; context< RecoveryMachine >().log_enter(state_name); post_event(RemoteRecoveryReserved()); } @@ -5814,14 +5817,14 @@ void PG::RecoveryState::WaitRemoteRecoveryReserved::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitremoterecoveryreserved_latency, dur); } PG::RecoveryState::Recovering::Recovering(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/Recovering") { - state_name = "Started/Primary/Active/Recovering"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5877,16 +5880,16 @@ void PG::RecoveryState::Recovering::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_recovering_latency, dur); } PG::RecoveryState::Recovered::Recovered(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/Recovered") { int newest_update_osd; - state_name = "Started/Primary/Active/Recovered"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5911,14 +5914,14 @@ void PG::RecoveryState::Recovered::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_recovered_latency, dur); } PG::RecoveryState::Clean::Clean(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active/Clean") { - state_name = "Started/Primary/Active/Clean"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -5939,18 +5942,18 @@ void PG::RecoveryState::Clean::exit() context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; pg->state_clear(PG_STATE_CLEAN); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_clean_latency, dur); } /*---------Active---------*/ PG::RecoveryState::Active::Active(my_context ctx) : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Active"), sorted_acting_set(context< RecoveryMachine >().pg->acting.begin(), context< RecoveryMachine >().pg->acting.end()), all_replicas_activated(false) { - state_name = "Started/Primary/Active"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6004,7 +6007,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap) } // if we haven't reported our PG stats in a long time, do so now. - if (pg->info.stats.reported_epoch + g_conf->osd_pg_stat_report_interval_max < advmap.osdmap->get_epoch()) { + if (pg->info.stats.reported_epoch + pg->cct->_conf->osd_pg_stat_report_interval_max < advmap.osdmap->get_epoch()) { dout(20) << "reporting stats to osd after " << (advmap.osdmap->get_epoch() - pg->info.stats.reported_epoch) << " epochs" << dendl; pg->publish_stats_to_osd(); @@ -6025,13 +6028,13 @@ boost::statechart::result PG::RecoveryState::Active::react(const ActMap&) pg->discover_all_missing(*context< RecoveryMachine >().get_query_map()); } - if (g_conf->osd_check_for_log_corruption) + if (pg->cct->_conf->osd_check_for_log_corruption) pg->check_log_for_corruption(pg->osd->store); int unfound = pg->pg_log.get_missing().num_missing() - pg->missing_loc.size(); if (unfound > 0 && pg->all_unfound_are_queried_or_lost(pg->get_osdmap())) { - if (g_conf->osd_auto_mark_unfound_lost) { + if (pg->cct->_conf->osd_auto_mark_unfound_lost) { pg->osd->clog.error() << pg->info.pgid << " has " << unfound << " objects unfound and apparently lost, would automatically marking lost but NOT IMPLEMENTED\n"; //pg->mark_all_unfound_lost(*context< RecoveryMachine >().get_cur_transaction()); @@ -6190,16 +6193,15 @@ void PG::RecoveryState::Active::exit() pg->state_clear(PG_STATE_BACKFILL_WAIT); pg->state_clear(PG_STATE_RECOVERY_WAIT); pg->state_clear(PG_STATE_REPLAY); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_active_latency, dur); } /*------ReplicaActive-----*/ PG::RecoveryState::ReplicaActive::ReplicaActive(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/ReplicaActive") { - state_name = "Started/ReplicaActive"; - context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6283,14 +6285,15 @@ void PG::RecoveryState::ReplicaActive::exit() context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; pg->osd->remote_reserver.cancel_reservation(pg->info.pgid); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_replicaactive_latency, dur); } /*-------Stray---*/ PG::RecoveryState::Stray::Stray(my_context ctx) - : my_base(ctx) { - state_name = "Started/Stray"; + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Stray") +{ context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6385,15 +6388,15 @@ void PG::RecoveryState::Stray::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_stray_latency, dur); } /*--------GetInfo---------*/ PG::RecoveryState::GetInfo::GetInfo(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/GetInfo") { - state_name = "Started/Primary/Peering/GetInfo"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6560,15 +6563,16 @@ void PG::RecoveryState::GetInfo::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_getinfo_latency, dur); } /*------GetLog------------*/ -PG::RecoveryState::GetLog::GetLog(my_context ctx) : - my_base(ctx), newest_update_osd(-1), msg(0) +PG::RecoveryState::GetLog::GetLog(my_context ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/GetLog"), + newest_update_osd(-1), msg(0) { - state_name = "Started/Primary/Peering/GetLog"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6675,15 +6679,15 @@ void PG::RecoveryState::GetLog::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_getlog_latency, dur); } /*------WaitActingChange--------*/ PG::RecoveryState::WaitActingChange::WaitActingChange(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/WaitActingChange") { - state_name = "Started/Primary/Peering/WaitActingChange"; context< RecoveryMachine >().log_enter(state_name); } @@ -6735,15 +6739,15 @@ void PG::RecoveryState::WaitActingChange::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitactingchange_latency, dur); } /*------Incomplete--------*/ PG::RecoveryState::Incomplete::Incomplete(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/Incomplete") { - state_name = "Started/Primary/Peering/Incomplete"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6772,15 +6776,15 @@ void PG::RecoveryState::Incomplete::exit() PG *pg = context< RecoveryMachine >().pg; pg->state_clear(PG_STATE_INCOMPLETE); - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_incomplete_latency, dur); } /*------GetMissing--------*/ PG::RecoveryState::GetMissing::GetMissing(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/GetMissing") { - state_name = "Started/Primary/Peering/GetMissing"; context< RecoveryMachine >().log_enter(state_name); PG *pg = context< RecoveryMachine >().pg; @@ -6897,15 +6901,15 @@ void PG::RecoveryState::GetMissing::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_getmissing_latency, dur); } /*---WaitFlushedPeering---*/ PG::RecoveryState::WaitFlushedPeering::WaitFlushedPeering(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/WaitFlushedPeering") { - state_name = "Started/Primary/Peering/WaitFlushedPeering"; PG *pg = context< RecoveryMachine >().pg; context< RecoveryMachine >().log_enter(state_name); if (context< RecoveryMachine >().pg->flushed) @@ -6933,9 +6937,9 @@ PG::RecoveryState::WaitFlushedPeering::react(const QueryState &q) /*------WaitUpThru--------*/ PG::RecoveryState::WaitUpThru::WaitUpThru(my_context ctx) - : my_base(ctx) + : my_base(ctx), + NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering/WaitUpThru") { - state_name = "Started/Primary/Peering/WaitUpThru"; context< RecoveryMachine >().log_enter(state_name); } @@ -6978,7 +6982,7 @@ void PG::RecoveryState::WaitUpThru::exit() { context< RecoveryMachine >().log_exit(state_name, enter_time); PG *pg = context< RecoveryMachine >().pg; - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; pg->osd->recoverystate_perf->tinc(rs_waitupthru_latency, dur); } @@ -6994,9 +6998,9 @@ void PG::RecoveryState::RecoveryMachine::log_enter(const char *state_name) void PG::RecoveryState::RecoveryMachine::log_exit(const char *state_name, utime_t enter_time) { - utime_t dur = ceph_clock_now(g_ceph_context) - enter_time; + utime_t dur = ceph_clock_now(pg->cct) - enter_time; dout(5) << "exit " << state_name << " " << dur << " " << event_count << " " << event_time << dendl; - pg->osd->pg_recovery_stats.log_exit(state_name, ceph_clock_now(g_ceph_context) - enter_time, + pg->osd->pg_recovery_stats.log_exit(state_name, ceph_clock_now(pg->cct) - enter_time, event_count, event_time); event_count = 0; event_time = utime_t(); @@ -7193,6 +7197,22 @@ bool PG::PriorSet::affected_by_map(const OSDMapRef osdmap, const PG *debug_pg) c return false; } +void PG::RecoveryState::start_handle(RecoveryCtx *new_ctx) { + assert(!rctx); + rctx = new_ctx; + if (rctx) + rctx->start_time = ceph_clock_now(pg->cct); +} + +void PG::RecoveryState::end_handle() { + if (rctx) { + utime_t dur = ceph_clock_now(pg->cct) - rctx->start_time; + machine.event_time += dur; + } + machine.event_count++; + rctx = 0; +} + void intrusive_ptr_add_ref(PG *pg) { pg->get("intptr"); } void intrusive_ptr_release(PG *pg) { pg->put("intptr"); } diff --git a/src/osd/PG.h b/src/osd/PG.h index 720ce67bca3..cbafd0f43d9 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -46,6 +46,7 @@ #include "common/cmdparse.h" #include "common/tracked_int_ptr.hpp" #include "common/WorkQueue.h" +#include "common/ceph_context.h" #include "include/str_list.h" #include <list> @@ -189,6 +190,7 @@ public: /*** PG ****/ protected: OSDService *osd; + CephContext *cct; OSDriver osdriver; SnapMapper snap_mapper; public: @@ -383,7 +385,9 @@ public: const char *state_name; utime_t enter_time; const char *get_state_name() { return state_name; } - NamedState() : state_name(0), enter_time(ceph_clock_now(g_ceph_context)) {} + NamedState(CephContext *cct_, const char *state_name_) + : state_name(state_name_), + enter_time(ceph_clock_now(cct_)) {}; virtual ~NamedState() {} }; @@ -1060,21 +1064,8 @@ public: /* Encapsulates PG recovery process */ class RecoveryState { - void start_handle(RecoveryCtx *new_ctx) { - assert(!rctx); - rctx = new_ctx; - if (rctx) - rctx->start_time = ceph_clock_now(g_ceph_context); - } - - void end_handle() { - if (rctx) { - utime_t dur = ceph_clock_now(g_ceph_context) - rctx->start_time; - machine.event_time += dur; - } - machine.event_count++; - rctx = 0; - } + void start_handle(RecoveryCtx *new_ctx); + void end_handle(); /* States */ struct Initial; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index bc7e17d3613..2456d176834 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -126,8 +126,8 @@ void ReplicatedPG::wait_for_missing_object(const hobject_t& soid, OpRequestRef o else { dout(7) << "missing " << soid << " v " << v << ", pulling." << dendl; map<int, vector<PullOp> > pulls; - prepare_pull(soid, v, g_conf->osd_client_op_priority, &pulls); - send_pulls(g_conf->osd_client_op_priority, pulls); + prepare_pull(soid, v, cct->_conf->osd_client_op_priority, &pulls); + send_pulls(cct->_conf->osd_client_op_priority, pulls); } waiting_for_missing_object[soid].push_back(op); op->mark_delayed("waiting for missing object"); @@ -184,8 +184,8 @@ void ReplicatedPG::wait_for_degraded_object(const hobject_t& soid, OpRequestRef } } map<int, vector<PushOp> > pushes; - prep_object_replica_pushes(soid, v, g_conf->osd_client_op_priority, &pushes); - send_pushes(g_conf->osd_client_op_priority, pushes); + prep_object_replica_pushes(soid, v, cct->_conf->osd_client_op_priority, &pushes); + send_pushes(cct->_conf->osd_client_op_priority, pushes); } waiting_for_degraded_object[soid].push_back(op); op->mark_delayed("waiting for degraded object"); @@ -280,14 +280,14 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, string prefix; string format; - cmd_getval(g_ceph_context, cmdmap, "format", format); + cmd_getval(cct, cmdmap, "format", format); boost::scoped_ptr<Formatter> f(new_formatter(format)); // demand that we have a formatter if (!f) f.reset(new_formatter("json")); string command; - cmd_getval(g_ceph_context, cmdmap, "cmd", command); + cmd_getval(cct, cmdmap, "cmd", command); if (command == "query") { f->open_object_section("pg"); f->dump_string("state", pg_state_string(get_state())); @@ -314,7 +314,7 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, } else if (command == "mark_unfound_lost") { string mulcmd; - cmd_getval(g_ceph_context, cmdmap, "mulcmd", mulcmd); + cmd_getval(cct, cmdmap, "mulcmd", mulcmd); if (mulcmd != "revert") { ss << "mode must be 'revert'; mark and delete not yet implemented"; return -EINVAL; @@ -345,7 +345,7 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, else if (command == "list_missing") { hobject_t offset; string offset_json; - if (cmd_getval(g_ceph_context, cmdmap, "offset", offset_json)) { + if (cmd_getval(cct, cmdmap, "offset", offset_json)) { json_spirit::Value v; try { if (!json_spirit::read(offset_json, v)) @@ -369,7 +369,7 @@ int ReplicatedPG::do_command(cmdmap_t cmdmap, ostream& ss, f->open_array_section("objects"); int32_t num = 0; bufferlist bl; - while (p != missing.missing.end() && num < g_conf->osd_command_max_records) { + while (p != missing.missing.end() && num < cct->_conf->osd_command_max_records) { f->open_object_section("object"); { f->open_object_section("oid"); @@ -459,7 +459,7 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) dout(10) << " pgls pg=" << m->get_pg() << " != " << info.pgid << dendl; result = 0; // hmm? } else { - unsigned list_size = MIN(g_conf->osd_max_pgls, p->op.pgls.count); + unsigned list_size = MIN(cct->_conf->osd_max_pgls, p->op.pgls.count); dout(10) << " pgls pg=" << m->get_pg() << " count " << list_size << dendl; // read into a buffer @@ -571,6 +571,7 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK); reply->set_data(outdata); reply->set_result(result); + reply->set_reply_versions(info.last_update, info.last_user_version); osd->send_message_osd_client(reply, m->get_connection()); delete filter; } @@ -583,14 +584,14 @@ void ReplicatedPG::calc_trim_to() return; } - size_t target = g_conf->osd_min_pg_log_entries; + size_t target = cct->_conf->osd_min_pg_log_entries; if (is_degraded() || state_test(PG_STATE_RECOVERING | PG_STATE_RECOVERY_WAIT | PG_STATE_BACKFILL | PG_STATE_BACKFILL_WAIT | PG_STATE_BACKFILL_TOOFULL)) { - target = g_conf->osd_max_pg_log_entries; + target = cct->_conf->osd_max_pg_log_entries; } if (min_last_complete_ondisk != eversion_t() && @@ -967,6 +968,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) if (already_ack(oldv)) { MOSDOpReply *reply = new MOSDOpReply(m, 0, get_osdmap()->get_epoch(), 0); reply->add_flags(CEPH_OSD_FLAG_ACK); + reply->set_reply_versions(oldv, entry->user_version); osd->send_message_osd_client(reply, m->get_connection()); } else { dout(10) << " waiting for " << oldv << " to ack" << dendl; @@ -1024,7 +1026,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) ctx->user_at_version = obc->obs.oi.user_version; // note my stats - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); // note some basic context for op replication that prepare_transaction may clobber eversion_t old_last_update = pg_log.get_head(); @@ -1125,7 +1127,7 @@ void ReplicatedPG::execute_ctx(OpContext *ctx) append_log(ctx->log, pg_trim_to, ctx->local_t); // verify that we are doing this in order? - if (g_conf->osd_debug_op_order && m->get_source().is_client()) { + if (cct->_conf->osd_debug_op_order && m->get_source().is_client()) { map<client_t,tid_t>& cm = debug_op_order[obc->obs.oi.soid]; tid_t t = m->get_tid(); client_t n = m->get_source().num(); @@ -1173,7 +1175,7 @@ void ReplicatedPG::log_op_stats(OpContext *ctx) OpRequestRef op = ctx->op; MOSDOp *m = static_cast<MOSDOp*>(op->request); - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); utime_t latency = now; latency -= ctx->op->request->get_recv_stamp(); @@ -1219,7 +1221,7 @@ void ReplicatedPG::log_op_stats(OpContext *ctx) void ReplicatedPG::log_subop_stats(OpRequestRef op, int tag_inb, int tag_lat) { - utime_t now = ceph_clock_now(g_ceph_context); + utime_t now = ceph_clock_now(cct); utime_t latency = now; latency -= op->request->get_recv_stamp(); @@ -1336,8 +1338,8 @@ void ReplicatedPG::do_scan( BackfillInterval bi; osr->flush(); scan_range( - m->begin, g_conf->osd_backfill_scan_min, - g_conf->osd_backfill_scan_max, &bi, handle); + m->begin, cct->_conf->osd_backfill_scan_min, + cct->_conf->osd_backfill_scan_max, &bi, handle); MOSDPGScan *reply = new MOSDPGScan(MOSDPGScan::OP_SCAN_DIGEST, get_osdmap()->get_epoch(), m->query_epoch, info.pgid, bi.begin, bi.end); @@ -1403,7 +1405,7 @@ void ReplicatedPG::_do_push(OpRequestRef op) reply->pgid = info.pgid; reply->map_epoch = m->map_epoch; reply->replies.swap(replies); - reply->compute_cost(g_ceph_context); + reply->compute_cost(cct); t->register_on_complete(new C_OSD_SendMessageOnConn( osd, reply, m->get_connection())); @@ -1434,7 +1436,7 @@ void ReplicatedPG::_do_pull_response(OpRequestRef op) reply->pgid = info.pgid; reply->map_epoch = m->map_epoch; reply->pulls.swap(replies); - reply->compute_cost(g_ceph_context); + reply->compute_cost(cct); t->register_on_complete(new C_OSD_SendMessageOnConn( osd, reply, m->get_connection())); @@ -1492,12 +1494,12 @@ void ReplicatedPG::do_backfill(OpRequestRef op) case MOSDPGBackfill::OP_BACKFILL_FINISH: { assert(is_replica()); - assert(g_conf->osd_kill_backfill_at != 1); + assert(cct->_conf->osd_kill_backfill_at != 1); MOSDPGBackfill *reply = new MOSDPGBackfill(MOSDPGBackfill::OP_BACKFILL_FINISH_ACK, get_osdmap()->get_epoch(), m->query_epoch, info.pgid); - reply->set_priority(g_conf->osd_recovery_op_priority); + reply->set_priority(cct->_conf->osd_recovery_op_priority); osd->send_message_osd_cluster(reply, m->get_connection()); queue_peering_event( CephPeeringEvtRef( @@ -1511,7 +1513,7 @@ void ReplicatedPG::do_backfill(OpRequestRef op) case MOSDPGBackfill::OP_BACKFILL_PROGRESS: { assert(is_replica()); - assert(g_conf->osd_kill_backfill_at != 2); + assert(cct->_conf->osd_kill_backfill_at != 2); info.last_backfill = m->last_backfill; if (m->compat_stat_sum) { @@ -1531,7 +1533,7 @@ void ReplicatedPG::do_backfill(OpRequestRef op) case MOSDPGBackfill::OP_BACKFILL_FINISH_ACK: { assert(is_primary()); - assert(g_conf->osd_kill_backfill_at != 3); + assert(cct->_conf->osd_kill_backfill_at != 3); finish_recovery_op(hobject_t::get_max()); } break; @@ -1580,7 +1582,7 @@ ReplicatedPG::RepGather *ReplicatedPG::trim_object(const hobject_t &coid) &obc->obs, obc->ssc, this); - ctx->mtime = ceph_clock_now(g_ceph_context); + ctx->mtime = ceph_clock_now(cct); ctx->at_version.epoch = get_osdmap()->get_epoch(); ctx->at_version.version = pg_log.get_head().version + 1; @@ -2102,11 +2104,11 @@ int ReplicatedPG::do_tmapup(OpContext *ctx, bufferlist::iterator& bp, OSDOp& osd return result; } -static int check_offset_and_length(uint64_t offset, uint64_t length) +static int check_offset_and_length(uint64_t offset, uint64_t length, uint64_t max) { - if (offset >= g_conf->osd_max_object_size || - length > g_conf->osd_max_object_size || - offset + length > g_conf->osd_max_object_size) + if (offset >= max || + length > max || + offset + length > max) return -EFBIG; return 0; @@ -2165,9 +2167,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) // munge ZERO -> TRUNCATE? (don't munge to DELETE or we risk hosing attributes) if (op.op == CEPH_OSD_OP_ZERO && obs.exists && - op.extent.offset < g_conf->osd_max_object_size && + op.extent.offset < cct->_conf->osd_max_object_size && op.extent.length >= 1 && - op.extent.length <= g_conf->osd_max_object_size && + op.extent.length <= cct->_conf->osd_max_object_size && op.extent.offset + op.extent.length >= oi.size) { if (op.extent.offset >= oi.size) { // no-op @@ -2267,7 +2269,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) uint64_t last = op.extent.offset; for (miter = m.begin(); miter != m.end(); ++miter) { // verify hole? - if (g_conf->osd_verify_sparse_read_holes && + if (cct->_conf->osd_verify_sparse_read_holes && last < miter->first) { bufferlist t; uint64_t len = miter->first - last; @@ -2292,7 +2294,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } // verify trailing hole? - if (g_conf->osd_verify_sparse_read_holes) { + if (cct->_conf->osd_verify_sparse_read_holes) { uint64_t end = MIN(op.extent.offset + op.extent.length, oi.size); if (last < end) { bufferlist t; @@ -2646,7 +2648,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) timeout = 0; } if (!timeout) - timeout = g_conf->osd_default_notify_timeout; + timeout = cct->_conf->osd_default_notify_timeout; notify_info_t n; n.timeout = timeout; @@ -2716,7 +2718,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) oi.truncate_size = op.extent.truncate_size; } } - result = check_offset_and_length(op.extent.offset, op.extent.length); + result = check_offset_and_length(op.extent.offset, op.extent.length, cct->_conf->osd_max_object_size); if (result < 0) break; t.write(coll, soid, op.extent.offset, op.extent.length, osd_op.indata); @@ -2736,7 +2738,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) result = -EINVAL; break; } - result = check_offset_and_length(op.extent.offset, op.extent.length); + result = check_offset_and_length(op.extent.offset, op.extent.length, cct->_conf->osd_max_object_size); if (result < 0) break; if (obs.exists) { @@ -2768,7 +2770,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_ZERO: ++ctx->num_write; { // zero - result = check_offset_and_length(op.extent.offset, op.extent.length); + result = check_offset_and_length(op.extent.offset, op.extent.length, cct->_conf->osd_max_object_size); if (result < 0) break; assert(op.extent.length); @@ -2831,7 +2833,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) break; } - if (op.extent.offset > g_conf->osd_max_object_size) { + if (op.extent.offset > cct->_conf->osd_max_object_size) { result = -EFBIG; break; } @@ -2915,7 +2917,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) dout(10) << "watch: peer_addr=" << ctx->op->request->get_connection()->get_peer_addr() << dendl; - watch_info_t w(cookie, g_conf->osd_client_watch_timeout, + watch_info_t w(cookie, cct->_conf->osd_client_watch_timeout, ctx->op->request->get_connection()->get_peer_addr()); if (do_watch) { if (oi.watchers.count(make_pair(cookie, entity))) { @@ -2948,7 +2950,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_SETXATTR: ++ctx->num_write; { - if (op.xattr.value_len > g_conf->osd_max_attr_size) { + if (op.xattr.value_len > cct->_conf->osd_max_attr_size) { result = -EFBIG; break; } @@ -3046,8 +3048,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } } - if (g_conf->osd_tmapput_sets_uses_tmap) { - assert(g_conf->osd_auto_upgrade_tmap); + if (cct->_conf->osd_tmapput_sets_uses_tmap) { + assert(cct->_conf->osd_auto_upgrade_tmap); oi.uses_tmap = true; } @@ -3096,7 +3098,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } set<string> out_set; - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { dout(20) << "CEPH_OSD_OP_OMAPGETKEYS: " << " Reading " << oi.soid << " omap from tmap" << dendl; map<string, bufferlist> vals; @@ -3154,7 +3156,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) } map<string, bufferlist> out_set; - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { dout(20) << "CEPH_OSD_OP_OMAPGETVALS: " << " Reading " << oi.soid << " omap from tmap" << dendl; map<string, bufferlist> vals; @@ -3205,7 +3207,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPGETHEADER: ++ctx->num_read; { - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { dout(20) << "CEPH_OSD_OP_OMAPGETHEADER: " << " Reading " << oi.soid << " omap from tmap" << dendl; map<string, bufferlist> vals; @@ -3236,7 +3238,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) goto fail; } map<string, bufferlist> out; - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { dout(20) << "CEPH_OSD_OP_OMAPGET: " << " Reading " << oi.soid << " omap from tmap" << dendl; map<string, bufferlist> vals; @@ -3335,7 +3337,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPSETVALS: ++ctx->num_write; { - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { _copy_up_tmap(ctx); } if (!obs.exists) { @@ -3365,7 +3367,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) case CEPH_OSD_OP_OMAPSETHEADER: ++ctx->num_write; { - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { _copy_up_tmap(ctx); } if (!obs.exists) { @@ -3385,7 +3387,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) result = -ENOENT; break; } - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { _copy_up_tmap(ctx); } t.touch(coll, soid); @@ -3401,7 +3403,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops) result = -ENOENT; break; } - if (oi.uses_tmap && g_conf->osd_auto_upgrade_tmap) { + if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) { _copy_up_tmap(ctx); } t.touch(coll, soid); @@ -4184,7 +4186,7 @@ void ReplicatedPG::_copy_some(OpContext *ctx, CopyOpRef cop) dout(10) << __func__ << " " << ctx << " " << cop << dendl; ObjectOperation op; op.assert_version(cop->version); - op.copy_get(&cop->cursor, g_conf->osd_copyfrom_max_chunk, + op.copy_get(&cop->cursor, cct->_conf->osd_copyfrom_max_chunk, &cop->size, &cop->mtime, &cop->attrs, &cop->data, &cop->omap, &cop->rval); @@ -4537,7 +4539,7 @@ void ReplicatedPG::eval_repop(RepGather *repop) // _prior_ to being committed; it will not get set with // writeahead journaling, for instance. if (repop->ctx->readable_stamp == utime_t()) - repop->ctx->readable_stamp = ceph_clock_now(g_ceph_context); + repop->ctx->readable_stamp = ceph_clock_now(cct); } } @@ -4652,7 +4654,7 @@ ReplicatedPG::RepGather *ReplicatedPG::new_repop(OpContext *ctx, ObjectContextRe RepGather *repop = new RepGather(ctx, obc, rep_tid, info.last_complete); - repop->start = ceph_clock_now(g_ceph_context); + repop->start = ceph_clock_now(cct); repop_queue.push_back(&repop->queue_item); repop_map[repop->rep_tid] = repop; @@ -4851,7 +4853,7 @@ void ReplicatedPG::handle_watch_timeout(WatchRef watch) osd_reqid_t reqid(osd->get_cluster_msgr_name(), 0, rep_tid); OpContext *ctx = new OpContext(OpRequestRef(), reqid, ops, &obc->obs, obc->ssc, this); - ctx->mtime = ceph_clock_now(g_ceph_context); + ctx->mtime = ceph_clock_now(cct); ctx->at_version.epoch = get_osdmap()->get_epoch(); ctx->at_version.version = pg_log.get_head().version + 1; @@ -5410,7 +5412,7 @@ void ReplicatedPG::calc_head_subsets(ObjectContextRef obc, SnapSet& snapset, con if (size) data_subset.insert(0, size); - if (!g_conf->osd_recover_clone_overlap) { + if (!cct->_conf->osd_recover_clone_overlap) { dout(10) << "calc_head_subsets " << head << " -- osd_recover_clone_overlap disabled" << dendl; return; } @@ -5437,7 +5439,7 @@ void ReplicatedPG::calc_head_subsets(ObjectContextRef obc, SnapSet& snapset, con } - if (cloning.num_intervals() > g_conf->osd_recover_clone_overlap_limit) { + if (cloning.num_intervals() > cct->_conf->osd_recover_clone_overlap_limit) { dout(10) << "skipping clone, too many holes" << dendl; clone_subsets.clear(); cloning.clear(); @@ -5464,7 +5466,7 @@ void ReplicatedPG::calc_clone_subsets(SnapSet& snapset, const hobject_t& soid, if (size) data_subset.insert(0, size); - if (!g_conf->osd_recover_clone_overlap) { + if (!cct->_conf->osd_recover_clone_overlap) { dout(10) << "calc_clone_subsets " << soid << " -- osd_recover_clone_overlap disabled" << dendl; return; } @@ -5513,7 +5515,7 @@ void ReplicatedPG::calc_clone_subsets(SnapSet& snapset, const hobject_t& soid, << " overlap " << next << dendl; } - if (cloning.num_intervals() > g_conf->osd_recover_clone_overlap_limit) { + if (cloning.num_intervals() > cct->_conf->osd_recover_clone_overlap_limit) { dout(10) << "skipping clone, too many holes" << dendl; clone_subsets.clear(); cloning.clear(); @@ -5804,7 +5806,7 @@ int ReplicatedPG::send_pull_legacy(int prio, int peer, subop->set_priority(prio); subop->ops = vector<OSDOp>(1); subop->ops[0].op.op = CEPH_OSD_OP_PULL; - subop->ops[0].op.extent.length = g_conf->osd_recovery_max_chunk; + subop->ops[0].op.extent.length = cct->_conf->osd_recovery_max_chunk; subop->recovery_info = recovery_info; subop->recovery_progress = progress; @@ -6161,16 +6163,16 @@ void ReplicatedPG::send_pushes(int prio, map<int, vector<PushOp> > &pushes) msg->set_priority(prio); for (; (j != i->second.end() && - cost < g_conf->osd_max_push_cost && - pushes < g_conf->osd_max_push_objects) ; + cost < cct->_conf->osd_max_push_cost && + pushes < cct->_conf->osd_max_push_objects) ; ++j) { dout(20) << __func__ << ": sending push " << *j << " to osd." << i->first << dendl; - cost += j->cost(g_ceph_context); + cost += j->cost(cct); pushes += 1; msg->pushes.push_back(*j); } - msg->compute_cost(g_ceph_context); + msg->compute_cost(cct); osd->send_message_osd_cluster(msg, con); } } @@ -6207,7 +6209,7 @@ void ReplicatedPG::send_pulls(int prio, map<int, vector<PullOp> > &pulls) msg->pgid = info.pgid; msg->map_epoch = get_osdmap()->get_epoch(); msg->pulls.swap(i->second); - msg->compute_cost(g_ceph_context); + msg->compute_cost(cct); osd->send_message_osd_cluster(msg, con); } } @@ -6262,7 +6264,7 @@ int ReplicatedPG::build_push_op(const ObjectRecoveryInfo &recovery_info, new_progress.first = false; } - uint64_t available = g_conf->osd_recovery_max_chunk; + uint64_t available = cct->_conf->osd_recovery_max_chunk; if (!progress.omap_complete) { ObjectMap::ObjectMapIterator iter = osd->store->get_omap_iterator(coll, @@ -6816,7 +6818,7 @@ void ReplicatedPG::mark_all_unfound_lost(int what) ObjectStore::Transaction *t = new ObjectStore::Transaction; C_PG_MarkUnfoundLost *c = new C_PG_MarkUnfoundLost(this); - utime_t mtime = ceph_clock_now(g_ceph_context); + utime_t mtime = ceph_clock_now(cct); info.last_update.epoch = get_osdmap()->get_epoch(); const pg_missing_t &missing = pg_log.get_missing(); map<hobject_t, pg_missing_t::item>::const_iterator m = missing.missing.begin(); @@ -7457,7 +7459,7 @@ int ReplicatedPG::recover_primary(int max, ThreadPool::TPHandle &handle) ++skipped; } else { int r = prepare_pull( - soid, need, g_conf->osd_recovery_op_priority, &pulls); + soid, need, cct->_conf->osd_recovery_op_priority, &pulls); switch (r) { case PULL_YES: ++started; @@ -7480,7 +7482,7 @@ int ReplicatedPG::recover_primary(int max, ThreadPool::TPHandle &handle) pg_log.set_last_requested(v); } - send_pulls(g_conf->osd_recovery_op_priority, pulls); + send_pulls(cct->_conf->osd_recovery_op_priority, pulls); return started; } @@ -7580,12 +7582,12 @@ int ReplicatedPG::recover_replicas(int max, ThreadPool::TPHandle &handle) dout(10) << __func__ << ": recover_object_replicas(" << soid << ")" << dendl; map<hobject_t,pg_missing_t::item>::const_iterator r = m.missing.find(soid); started += prep_object_replica_pushes(soid, r->second.need, - g_conf->osd_recovery_op_priority, + cct->_conf->osd_recovery_op_priority, &pushes); } } - send_pushes(g_conf->osd_recovery_op_priority, pushes); + send_pushes(cct->_conf->osd_recovery_op_priority, pushes); return started; } @@ -7757,7 +7759,7 @@ int ReplicatedPG::recover_backfill( prep_backfill_object_push( i->first, i->second.first, i->second.second, backfill_target, &pushes); } - send_pushes(g_conf->osd_recovery_op_priority, pushes); + send_pushes(cct->_conf->osd_recovery_op_priority, pushes); release_waiting_for_backfill_pos(); dout(5) << "backfill_pos is " << backfill_pos << " and pinfo.last_backfill is " @@ -7814,7 +7816,7 @@ void ReplicatedPG::prep_backfill_object_push( ObjectContextRef obc = get_object_context(oid, false); obc->ondisk_read_lock(); (*pushes)[peer].push_back(PushOp()); - prep_push_to_replica(obc, oid, peer, g_conf->osd_recovery_op_priority, + prep_push_to_replica(obc, oid, peer, cct->_conf->osd_recovery_op_priority, &((*pushes)[peer].back())); obc->ondisk_read_unlock(); } @@ -7866,7 +7868,7 @@ void ReplicatedPG::check_local() assert(info.last_update >= pg_log.get_tail()); // otherwise we need some help! - if (!g_conf->osd_debug_verify_stray_on_activate) + if (!cct->_conf->osd_debug_verify_stray_on_activate) return; // just scan the log. @@ -8116,9 +8118,10 @@ void ReplicatedPG::SnapTrimmer::log_exit(const char *state_name, utime_t enter_t << "SnapTrimmer state<" << get_state_name() << ">: ") /* NotTrimming */ -ReplicatedPG::NotTrimming::NotTrimming(my_context ctx) : my_base(ctx) +ReplicatedPG::NotTrimming::NotTrimming(my_context ctx) + : my_base(ctx), + NamedState(context< SnapTrimmer >().pg->cct, "NotTrimming") { - state_name = "NotTrimming"; context< SnapTrimmer >().requeue = false; context< SnapTrimmer >().log_enter(state_name); } @@ -8157,9 +8160,10 @@ boost::statechart::result ReplicatedPG::NotTrimming::react(const SnapTrim&) } /* TrimmingObjects */ -ReplicatedPG::TrimmingObjects::TrimmingObjects(my_context ctx) : my_base(ctx) +ReplicatedPG::TrimmingObjects::TrimmingObjects(my_context ctx) + : my_base(ctx), + NamedState(context< SnapTrimmer >().pg->cct, "Trimming/TrimmingObjects") { - state_name = "Trimming/TrimmingObjects"; context< SnapTrimmer >().log_enter(state_name); } @@ -8207,9 +8211,10 @@ boost::statechart::result ReplicatedPG::TrimmingObjects::react(const SnapTrim&) return discard_event(); } /* WaitingOnReplicasObjects */ -ReplicatedPG::WaitingOnReplicas::WaitingOnReplicas(my_context ctx) : my_base(ctx) +ReplicatedPG::WaitingOnReplicas::WaitingOnReplicas(my_context ctx) + : my_base(ctx), + NamedState(context< SnapTrimmer >().pg->cct, "Trimming/WaitingOnReplicas") { - state_name = "Trimming/WaitingOnReplicas"; context< SnapTrimmer >().log_enter(state_name); context< SnapTrimmer >().requeue = false; } diff --git a/src/osd/SnapMapper.h b/src/osd/SnapMapper.h index 560cc43497f..f0d0baa2190 100644 --- a/src/osd/SnapMapper.h +++ b/src/osd/SnapMapper.h @@ -21,7 +21,7 @@ #include <string.h> #include "common/map_cacher.hpp" -#include "os/hobject.h" +#include "common/hobject.h" #include "include/buffer.h" #include "include/encoding.h" #include "include/object.h" diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index e68c6a14313..e94fd02a5ad 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -684,6 +684,14 @@ void pg_pool_t::dump(Formatter *f) const f->dump_int("read_tier", read_tier); f->dump_int("write_tier", write_tier); f->dump_string("cache_mode", get_cache_mode_name()); + f->open_array_section("properties"); + for (map<string,string>::const_iterator i = properties.begin(); + i != properties.end(); + ++i) { + string name = i->first; + f->dump_string(name.c_str(), i->second); + } + f->close_section(); } @@ -888,7 +896,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const return; } - ENCODE_START(9, 5, bl); + ENCODE_START(10, 5, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -915,6 +923,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(c, bl); ::encode(read_tier, bl); ::encode(write_tier, bl); + ::encode(properties, bl); ENCODE_FINISH(bl); } @@ -982,6 +991,9 @@ void pg_pool_t::decode(bufferlist::iterator& bl) ::decode(read_tier, bl); ::decode(write_tier, bl); } + if (struct_v >= 10) { + ::decode(properties, bl); + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1023,6 +1035,8 @@ void pg_pool_t::generate_test_instances(list<pg_pool_t*>& o) a.cache_mode = CACHEMODE_WRITEBACK; a.read_tier = 1; a.write_tier = 1; + a.properties["p-1"] = "v-1"; + a.properties["empty"] = string(); o.push_back(new pg_pool_t(a)); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index b1f7983e586..901d9dbb488 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -26,7 +26,7 @@ #include "include/interval_set.h" #include "common/snap_types.h" #include "common/Formatter.h" -#include "os/hobject.h" +#include "common/hobject.h" #include "Watch.h" #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026" @@ -823,6 +823,7 @@ private: public: + map<string,string> properties; /// interpreted according to the pool type epoch_t last_change; /// most recent epoch changed, exclusing snapshot changes snapid_t snap_seq; /// seq for per-pool snapshot epoch_t snap_epoch; /// osdmap epoch of last snap diff --git a/src/osdc/Makefile.am b/src/osdc/Makefile.am new file mode 100644 index 00000000000..3a8a2165aaa --- /dev/null +++ b/src/osdc/Makefile.am @@ -0,0 +1,17 @@ +libosdc_la_SOURCES = \ + osdc/Objecter.cc \ + osdc/ObjectCacher.cc \ + osdc/Filer.cc \ + osdc/Striper.cc \ + osdc/Journaler.cc +noinst_LTLIBRARIES += libosdc.la + +noinst_HEADERS += \ + osdc/Blinker.h \ + osdc/Filer.h \ + osdc/Journaler.h \ + osdc/ObjectCacher.h \ + osdc/Objecter.h \ + osdc/Striper.h \ + osdc/WritebackHandler.h + diff --git a/src/perfglue/Makefile.am b/src/perfglue/Makefile.am new file mode 100644 index 00000000000..c34e7f16760 --- /dev/null +++ b/src/perfglue/Makefile.am @@ -0,0 +1,23 @@ +libperfglue_la_SOURCES = + +if WITH_TCMALLOC +libperfglue_la_SOURCES += perfglue/heap_profiler.cc +AM_CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free +AM_CXXFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free +else +libperfglue_la_SOURCES += perfglue/disabled_heap_profiler.cc +endif # WITH_TCMALLOC + +if WITH_PROFILER +libperfglue_la_SOURCES += perfglue/cpu_profiler.cc +else +libperfglue_la_SOURCES += perfglue/disabled_stubs.cc +endif # WITH_PROFILER + +libperfglue_la_LIBADD = -ltcmalloc +noinst_LTLIBRARIES += libperfglue.la + +noinst_HEADERS += \ + perfglue/cpu_profiler.h \ + perfglue/heap_profiler.h + diff --git a/src/rbd.cc b/src/rbd.cc index 7d5d46611ec..eea9733c4b9 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -8,6 +8,7 @@ * LGPL2. See file COPYING. * */ +#include "include/int_types.h" #include "mon/MonClient.h" #include "mon/MonMap.h" @@ -33,7 +34,6 @@ #include <boost/scoped_ptr.hpp> #include <dirent.h> #include <errno.h> -#include <inttypes.h> #include <iostream> #include <memory> #include <sstream> @@ -2484,7 +2484,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (r < 0) { cerr << "rbd: error opening pool " << poolname << ": " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } } @@ -2511,7 +2511,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (r < 0) { cerr << "rbd: error opening image " << imgname << ": " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } } @@ -2526,7 +2526,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (r < 0) { cerr << "rbd: error setting snapshot context: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } } @@ -2535,14 +2535,14 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (r < 0) { cerr << "rbd: error opening pool " << dest_poolname << ": " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } } if (opt_cmd == OPT_CREATE || opt_cmd == OPT_RESIZE) { if (!size_set) { cerr << "rbd: must specify --size <MB>" << std::endl; - return EXIT_FAILURE; + return EINVAL; } } @@ -2558,7 +2558,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ default: cerr << "rbd: list: " << cpp_strerror(-r) << std::endl; } - return EXIT_FAILURE; + return -r; } break; @@ -2566,19 +2566,19 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (order && (order < 12 || order > 25)) { cerr << "rbd: order must be between 12 (4 KB) and 25 (32 MB)" << std::endl; - return EXIT_FAILURE; + return EINVAL; } if ((stripe_unit && !stripe_count) || (!stripe_unit && stripe_count)) { cerr << "must specify both (or neither) of stripe-unit and stripe-count" << std::endl; usage(); - return EXIT_FAILURE; + return EINVAL; } r = do_create(rbd, io_ctx, imgname, size, &order, format, features, stripe_unit, stripe_count); if (r < 0) { cerr << "rbd: create error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2586,14 +2586,14 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (order && (order < 12 || order > 25)) { cerr << "rbd: order must be between 12 (4 KB) and 25 (32 MB)" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_clone(rbd, io_ctx, imgname, snapname, dest_io_ctx, destname, features, &order); if (r < 0) { cerr << "rbd: clone error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2601,7 +2601,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_flatten(image); if (r < 0) { cerr << "rbd: flatten error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2609,7 +2609,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_rename(rbd, io_ctx, imgname, destname); if (r < 0) { cerr << "rbd: rename error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2617,7 +2617,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_show_info(imgname, image, snapname, formatter.get()); if (r < 0) { cerr << "rbd: info: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2647,18 +2647,18 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = image.stat(info, sizeof(info)); if (r < 0) { cerr << "rbd: resize error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } if (info.size > size && !resize_allow_shrink) { cerr << "rbd: shrinking an image is only allowed with the --allow-shrink flag" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_resize(image, size); if (r < 0) { cerr << "rbd: resize error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2671,87 +2671,87 @@ if (!set_conf_param(v, p1, p2, p3)) { \ if (r < 0) { cerr << "rbd: failed to list snapshots: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_SNAP_CREATE: if (!imgname || !snapname) { cerr << "rbd: snap create requires image and snapname" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_add_snap(image, snapname); if (r < 0) { cerr << "rbd: failed to create snapshot: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_SNAP_ROLLBACK: if (!imgname) { cerr << "rbd: snap rollback requires image name" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_rollback_snap(image, snapname); if (r < 0) { cerr << "rbd: rollback failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_SNAP_REMOVE: if (!imgname) { cerr << "rbd: snap remove requires image name" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_remove_snap(image, snapname); - if (r == -EBUSY) { - cerr << "rbd: snapshot '" << snapname << "' is protected from removal." - << std::endl; - return EXIT_FAILURE; - } if (r < 0) { - cerr << "rbd: failed to remove snapshot: " << cpp_strerror(-r) - << std::endl; - return EXIT_FAILURE; + if (r == -EBUSY) { + cerr << "rbd: snapshot '" << snapname << "' is protected from removal." + << std::endl; + } else { + cerr << "rbd: failed to remove snapshot: " << cpp_strerror(-r) + << std::endl; + } + return -r; } break; case OPT_SNAP_PURGE: if (!imgname) { cerr << "rbd: snap purge requires image name" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_purge_snaps(image); if (r < 0) { cerr << "rbd: removing snaps failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_SNAP_PROTECT: if (!imgname) { cerr << "rbd: snap protect requires image name" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_protect_snap(image, snapname); if (r < 0) { cerr << "rbd: protecting snap failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_SNAP_UNPROTECT: if (!imgname) { cerr << "rbd: snap unprotect requires image name" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_unprotect_snap(image, snapname); if (r < 0) { cerr << "rbd: unprotecting snap failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2759,19 +2759,19 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_list_children(image, formatter.get()); if (r < 0) { cerr << "rbd: listing children failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_EXPORT: if (!path) { cerr << "rbd: export requires pathname" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_export(image, path); if (r < 0) { cerr << "rbd: export error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2779,32 +2779,32 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_diff(image, fromsnapname, formatter.get()); if (r < 0) { cerr << "rbd: diff error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_EXPORT_DIFF: if (!path) { cerr << "rbd: export-diff requires pathname" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_export_diff(image, fromsnapname, snapname, path); if (r < 0) { cerr << "rbd: export-diff error: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; case OPT_IMPORT: if (!path) { cerr << "rbd: import requires pathname" << std::endl; - return EXIT_FAILURE; + return EINVAL; } r = do_import(rbd, dest_io_ctx, destname, &order, path, format, features, size); if (r < 0) { cerr << "rbd: import failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2813,7 +2813,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_import_diff(image, path); if (r < 0) { cerr << "rbd: import-diff failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2821,7 +2821,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_copy(image, dest_io_ctx, destname); if (r < 0) { cerr << "rbd: copy failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2829,7 +2829,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_watch(io_ctx, imgname); if (r < 0) { cerr << "rbd: watch failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2837,7 +2837,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_kernel_add(poolname, imgname, snapname); if (r < 0) { cerr << "rbd: add failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2845,7 +2845,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_kernel_rm(devpath); if (r < 0) { cerr << "rbd: remove failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2853,7 +2853,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_kernel_showmapped(formatter.get()); if (r < 0) { cerr << "rbd: showmapped failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2861,7 +2861,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_lock_list(image, formatter.get()); if (r < 0) { cerr << "rbd: listing locks failed: " << cpp_strerror(r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2878,7 +2878,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ } else { cerr << "rbd: taking lock failed: " << cpp_strerror(r) << std::endl; } - return EXIT_FAILURE; + return -r; } break; @@ -2886,7 +2886,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_lock_remove(image, lock_cookie, lock_client); if (r < 0) { cerr << "rbd: releasing lock failed: " << cpp_strerror(r) << std::endl; - return EXIT_FAILURE; + return -r; } break; @@ -2894,7 +2894,7 @@ if (!set_conf_param(v, p1, p2, p3)) { \ r = do_bench_write(image, bench_io_size, bench_io_threads, bench_bytes, bench_pattern); if (r < 0) { cerr << "bench-write failed: " << cpp_strerror(-r) << std::endl; - return EXIT_FAILURE; + return -r; } break; } diff --git a/src/rbd_fuse/rbd-fuse.c b/src/rbd_fuse/rbd-fuse.c index 5a4bfe2702c..eea6edb9eb8 100644 --- a/src/rbd_fuse/rbd-fuse.c +++ b/src/rbd_fuse/rbd-fuse.c @@ -3,6 +3,8 @@ */ #define FUSE_USE_VERSION 26 +#include "include/int_types.h" + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -15,7 +17,6 @@ #include <sys/types.h> #include <unistd.h> #include <getopt.h> -#include <inttypes.h> #include "include/rbd/librbd.h" diff --git a/src/rgw/Makefile.am b/src/rgw/Makefile.am new file mode 100644 index 00000000000..b812d908569 --- /dev/null +++ b/src/rgw/Makefile.am @@ -0,0 +1,155 @@ +if WITH_RADOSGW +librgw_la_SOURCES = \ + rgw/librgw.cc \ + rgw/rgw_acl.cc \ + rgw/rgw_acl_s3.cc \ + rgw/rgw_acl_swift.cc \ + rgw/rgw_client_io.cc \ + rgw/rgw_fcgi.cc \ + rgw/rgw_xml.cc \ + rgw/rgw_usage.cc \ + rgw/rgw_json_enc.cc \ + rgw/rgw_user.cc \ + rgw/rgw_bucket.cc\ + rgw/rgw_tools.cc \ + rgw/rgw_rados.cc \ + rgw/rgw_http_client.cc \ + rgw/rgw_rest_client.cc \ + rgw/rgw_rest_conn.cc \ + rgw/rgw_op.cc \ + rgw/rgw_common.cc \ + rgw/rgw_cache.cc \ + rgw/rgw_formats.cc \ + rgw/rgw_log.cc \ + rgw/rgw_multi.cc \ + rgw/rgw_policy_s3.cc \ + rgw/rgw_gc.cc \ + rgw/rgw_multi_del.cc \ + rgw/rgw_env.cc \ + rgw/rgw_cors.cc \ + rgw/rgw_cors_s3.cc \ + rgw/rgw_auth_s3.cc \ + rgw/rgw_metadata.cc \ + rgw/rgw_replica_log.cc \ + rgw/rgw_keystone.cc +librgw_la_CXXFLAGS = -Woverloaded-virtual ${AM_CXXFLAGS} +noinst_LTLIBRARIES += librgw.la + +LIBRGW_DEPS += \ + $(LIBRADOS) \ + libcls_rgw_client.la \ + libcls_log_client.a \ + libcls_statelog_client.a \ + libcls_replica_log_client.a \ + libcls_lock_client.la \ + libcls_refcount_client.la \ + libcls_version_client.a \ + -lcurl \ + -lexpat \ + -lm \ + -lfcgi + +radosgw_SOURCES = \ + rgw/rgw_resolve.cc \ + rgw/rgw_rest.cc \ + rgw/rgw_rest_swift.cc \ + rgw/rgw_rest_s3.cc \ + rgw/rgw_rest_usage.cc \ + rgw/rgw_rest_user.cc \ + rgw/rgw_rest_bucket.cc \ + rgw/rgw_rest_metadata.cc \ + rgw/rgw_replica_log.cc \ + rgw/rgw_rest_log.cc \ + rgw/rgw_rest_opstate.cc \ + rgw/rgw_rest_replica_log.cc \ + rgw/rgw_rest_config.cc \ + rgw/rgw_http_client.cc \ + rgw/rgw_swift.cc \ + rgw/rgw_swift_auth.cc \ + rgw/rgw_main.cc +radosgw_LDADD = $(LIBRGW) $(LIBRGW_DEPS) -lresolv $(CEPH_GLOBAL) +bin_PROGRAMS += radosgw + +radosgw_admin_SOURCES = rgw/rgw_admin.cc +radosgw_admin_LDADD = $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) +bin_PROGRAMS += radosgw-admin + +ceph_rgw_multiparser_SOURCES = rgw/rgw_multiparser.cc +ceph_rgw_multiparser_LDADD = $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_rgw_multiparser + +ceph_rgw_jsonparser_SOURCES = \ + rgw/rgw_jsonparser.cc \ + rgw/rgw_common.cc \ + rgw/rgw_env.cc \ + rgw/rgw_json_enc.cc +ceph_rgw_jsonparser_LDADD = $(LIBRGW) $(LIBRGW_DEPS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_rgw_jsonparser + +# inject rgw stuff in the decoder testcase +DENCODER_SOURCES += \ + rgw/rgw_dencoder.cc \ + rgw/rgw_acl.cc \ + rgw/rgw_common.cc \ + rgw/rgw_env.cc \ + rgw/rgw_json_enc.cc +DENCODER_DEPS += \ + libcls_lock_client.la \ + libcls_rgw_client.la \ + libcls_replica_log_client.a \ + libcls_refcount_client.la + + +endif # WITH_RADOSGW + + +noinst_HEADERS += \ + rgw/logrotate.conf \ + rgw/rgw_acl.h \ + rgw/rgw_acl_s3.h \ + rgw/rgw_acl_swift.h \ + rgw/rgw_client_io.h \ + rgw/rgw_fcgi.h \ + rgw/rgw_xml.h \ + rgw/rgw_cache.h \ + rgw/rgw_common.h \ + rgw/rgw_cors.h \ + rgw/rgw_cors_s3.h \ + rgw/rgw_cors_swift.h \ + rgw/rgw_string.h \ + rgw/rgw_formats.h \ + rgw/rgw_http_errors.h \ + rgw/rgw_log.h \ + rgw/rgw_multi.h \ + rgw/rgw_policy_s3.h \ + rgw/rgw_gc.h \ + rgw/rgw_metadata.h \ + rgw/rgw_multi_del.h \ + rgw/rgw_op.h \ + rgw/rgw_http_client.h \ + rgw/rgw_swift.h \ + rgw/rgw_swift_auth.h \ + rgw/rgw_rados.h \ + rgw/rgw_replica_log.h \ + rgw/rgw_resolve.h \ + rgw/rgw_rest.h \ + rgw/rgw_rest_swift.h \ + rgw/rgw_rest_s3.h \ + rgw/rgw_auth_s3.h \ + rgw/rgw_rest_admin.h \ + rgw/rgw_rest_usage.h \ + rgw/rgw_rest_user.h \ + rgw/rgw_rest_bucket.h \ + rgw/rgw_rest_client.h \ + rgw/rgw_rest_conn.h \ + rgw/rgw_tools.h \ + rgw/rgw_rest_metadata.h \ + rgw/rgw_rest_log.h \ + rgw/rgw_rest_opstate.h \ + rgw/rgw_rest_replica_log.h \ + rgw/rgw_rest_config.h \ + rgw/rgw_usage.h \ + rgw/rgw_user.h \ + rgw/rgw_bucket.h \ + rgw/rgw_keystone.h + diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index ef0a2604d51..c872314fe4e 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -123,8 +123,8 @@ void req_info::rebuild_from(req_info& src) req_state::req_state(CephContext *_cct, class RGWEnv *e) : cct(_cct), cio(NULL), op(OP_UNKNOWN), - bucket_cors(NULL), has_acl_header(false), - os_auth_token(NULL), info(_cct, e) + has_acl_header(false), + os_auth_token(NULL), info(_cct, e) { enable_ops_log = e->conf->enable_ops_log; enable_usage_log = e->conf->enable_usage_log; @@ -162,7 +162,6 @@ req_state::req_state(CephContext *_cct, class RGWEnv *e) : cct(_cct), cio(NULL), req_state::~req_state() { delete formatter; delete bucket_acl; - delete bucket_cors; delete object_acl; free((void *)object); free((void *)bucket_name); diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 405c3d9b3ba..2c7c0c716be 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -821,7 +821,6 @@ struct req_state { RGWUserInfo user; RGWAccessControlPolicy *bucket_acl; RGWAccessControlPolicy *object_acl; - RGWCORSConfiguration *bucket_cors; bool system_request; diff --git a/src/rgw/rgw_cors.cc b/src/rgw/rgw_cors.cc index 033bfa2f215..4be83605b50 100644 --- a/src/rgw/rgw_cors.cc +++ b/src/rgw/rgw_cors.cc @@ -79,7 +79,10 @@ static bool is_string_in_set(set<string>& s, string h) { << ", at offset not less than " << flen << dendl; if (h.compare((h.size() - sl.size()), sl.size(), sl) != 0) continue; + ssplit.pop_front(); } + if (!ssplit.empty()) + continue; return true; } } diff --git a/src/rgw/rgw_cors.h b/src/rgw/rgw_cors.h index 415f3f0b869..1e0ec3bc7ec 100644 --- a/src/rgw/rgw_cors.h +++ b/src/rgw/rgw_cors.h @@ -25,11 +25,13 @@ #define RGW_CORS_HEAD 0x4 #define RGW_CORS_POST 0x8 #define RGW_CORS_DELETE 0x10 -#define RGW_CORS_ALL (RGW_CORS_GET | \ - RGW_CORS_PUT | \ - RGW_CORS_HEAD | \ - RGW_CORS_POST | \ - RGW_CORS_DELETE) +#define RGW_CORS_COPY 0x20 +#define RGW_CORS_ALL (RGW_CORS_GET | \ + RGW_CORS_PUT | \ + RGW_CORS_HEAD | \ + RGW_CORS_POST | \ + RGW_CORS_DELETE | \ + RGW_CORS_COPY) #define CORS_MAX_AGE_INVALID ((uint32_t)-1) diff --git a/src/rgw/rgw_cors_s3.cc b/src/rgw/rgw_cors_s3.cc index c1448f26b23..01150a9e65b 100644 --- a/src/rgw/rgw_cors_s3.cc +++ b/src/rgw/rgw_cors_s3.cc @@ -44,6 +44,8 @@ void RGWCORSRule_S3::to_xml(XMLFormatter& f) { f.dump_string("AllowedMethod", "HEAD"); if (allowed_methods & RGW_CORS_POST) f.dump_string("AllowedMethod", "POST"); + if (allowed_methods & RGW_CORS_COPY) + f.dump_string("AllowedMethod", "COPY"); /*AllowedOrigins*/ for(set<string>::iterator it = allowed_origins.begin(); it != allowed_origins.end(); @@ -87,6 +89,8 @@ bool RGWCORSRule_S3::xml_end(const char *el) { allowed_methods |= RGW_CORS_HEAD; } else if (strcasecmp(s, "PUT") == 0) { allowed_methods |= RGW_CORS_PUT; + } else if (strcasecmp(s, "COPY") == 0) { + allowed_methods |= RGW_CORS_COPY; } else { return false; } diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 12301ba9c5f..54db609521c 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -323,7 +323,7 @@ void RGWProcess::handle_request(RGWRequest *req) RGWRESTMgr *mgr; RGWHandler *handler = rest->get_handler(store, s, &client_io, &mgr, &init_error); if (init_error != 0) { - abort_early(s, init_error); + abort_early(s, NULL, init_error); goto done; } @@ -332,7 +332,7 @@ void RGWProcess::handle_request(RGWRequest *req) req->log(s, "getting op"); op = handler->get_op(store); if (!op) { - abort_early(s, -ERR_METHOD_NOT_ALLOWED); + abort_early(s, NULL, -ERR_METHOD_NOT_ALLOWED); goto done; } req->op = op; @@ -341,26 +341,26 @@ void RGWProcess::handle_request(RGWRequest *req) ret = handler->authorize(); if (ret < 0) { dout(10) << "failed to authorize request" << dendl; - abort_early(s, ret); + abort_early(s, op, ret); goto done; } if (s->user.suspended) { dout(10) << "user is suspended, uid=" << s->user.user_id << dendl; - abort_early(s, -ERR_USER_SUSPENDED); + abort_early(s, op, -ERR_USER_SUSPENDED); goto done; } req->log(s, "reading permissions"); ret = handler->read_permissions(op); if (ret < 0) { - abort_early(s, ret); + abort_early(s, op, ret); goto done; } req->log(s, "verifying op mask"); ret = op->verify_op_mask(); if (ret < 0) { - abort_early(s, ret); + abort_early(s, op, ret); goto done; } @@ -370,7 +370,7 @@ void RGWProcess::handle_request(RGWRequest *req) if (s->system_request) { dout(2) << "overriding permissions due to system operation" << dendl; } else { - abort_early(s, ret); + abort_early(s, op, ret); goto done; } } @@ -378,7 +378,7 @@ void RGWProcess::handle_request(RGWRequest *req) req->log(s, "verifying op params"); ret = op->verify_params(); if (ret < 0) { - abort_early(s, ret); + abort_early(s, op, ret); goto done; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index d34e18bc4ba..114b8709a22 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -421,6 +421,111 @@ int RGWOp::verify_op_mask() return 0; } +static bool validate_cors_rule_method(RGWCORSRule *rule, const char *req_meth) { + uint8_t flags = 0; + if (strcmp(req_meth, "GET") == 0) flags = RGW_CORS_GET; + else if (strcmp(req_meth, "POST") == 0) flags = RGW_CORS_POST; + else if (strcmp(req_meth, "PUT") == 0) flags = RGW_CORS_PUT; + else if (strcmp(req_meth, "DELETE") == 0) flags = RGW_CORS_DELETE; + else if (strcmp(req_meth, "HEAD") == 0) flags = RGW_CORS_HEAD; + + if ((rule->get_allowed_methods() & flags) == flags) { + dout(10) << "Method " << req_meth << " is supported" << dendl; + } else { + dout(5) << "Method " << req_meth << " is not supported" << dendl; + return false; + } + + return true; +} + +int RGWOp::read_bucket_cors() +{ + bufferlist bl; + + map<string, bufferlist>::iterator aiter = s->bucket_attrs.find(RGW_ATTR_CORS); + if (aiter == s->bucket_attrs.end()) { + ldout(s->cct, 20) << "no CORS configuration attr found" << dendl; + cors_exist = false; + return 0; /* no CORS configuration found */ + } + + cors_exist = true; + + bl = aiter->second; + + bufferlist::iterator iter = bl.begin(); + try { + bucket_cors.decode(iter); + } catch (buffer::error& err) { + ldout(s->cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl; + return -EIO; + } + if (s->cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15)) { + RGWCORSConfiguration_S3 *s3cors = static_cast<RGWCORSConfiguration_S3 *>(&bucket_cors); + ldout(s->cct, 15) << "Read RGWCORSConfiguration"; + s3cors->to_xml(*_dout); + *_dout << dendl; + } + return 0; +} + +static void get_cors_response_headers(RGWCORSRule *rule, const char *req_hdrs, string& hdrs, string& exp_hdrs, unsigned *max_age) { + if (req_hdrs) { + list<string> hl; + get_str_list(req_hdrs, hl); + for(list<string>::iterator it = hl.begin(); it != hl.end(); ++it) { + if (!rule->is_header_allowed((*it).c_str(), (*it).length())) { + dout(5) << "Header " << (*it) << " is not registered in this rule" << dendl; + } else { + if (hdrs.length() > 0) hdrs.append(","); + hdrs.append((*it)); + } + } + } + rule->format_exp_headers(exp_hdrs); + *max_age = rule->get_max_age(); +} + +bool RGWOp::generate_cors_headers(string& origin, string& method, string& headers, string& exp_headers, unsigned *max_age) +{ + const char *orig = s->info.env->get("HTTP_ORIGIN"); + if (!orig) { + return false; + } + origin = orig; + int ret = read_bucket_cors(); + if (ret < 0) { + return false; + } + + if (!cors_exist) { + dout(2) << "No CORS configuration set yet for this bucket" << dendl; + return false; + } + + RGWCORSRule *rule = bucket_cors.host_name_rule(orig); + if (!rule) + return false; + + const char *req_meth = s->info.env->get("HTTP_ACCESS_CONTROL_REQUEST_METHOD"); + if (!req_meth) { + req_meth = s->info.method; + } + + if (req_meth) + method = req_meth; + + if (!validate_cors_rule_method(rule, req_meth)) { + return false; + } + + const char *req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_ALLOW_HEADERS"); + + get_cors_response_headers(rule, req_hdrs, headers, exp_headers, max_age); + + return true; +} int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket, RGWObjEnt& ent, RGWAccessControlPolicy *bucket_policy, off_t start_ofs, off_t end_ofs) { @@ -1166,7 +1271,7 @@ int RGWPutObjProcessor_Multipart::prepare(RGWRados *store, void *obj_ctx) int RGWPutObjProcessor_Multipart::do_complete(string& etag, time_t *mtime, time_t set_mtime, map<string, bufferlist>& attrs) { - complete_parts(); + complete_writing_data(); RGWRados::PutObjMetaExtraParams params; params.set_mtime = set_mtime; @@ -1835,37 +1940,6 @@ void RGWPutACLs::execute() } } -static int read_bucket_cors(RGWRados *store, struct req_state *s, RGWCORSConfiguration *bucket_cors, bool *exist) -{ - bufferlist bl; - - map<string, bufferlist>::iterator aiter = s->bucket_attrs.find(RGW_ATTR_CORS); - if (aiter == s->bucket_attrs.end()) { - ldout(s->cct, 20) << "no CORS configuration attr found" << dendl; - *exist = false; - return 0; /* no CORS configuration found */ - } - - *exist = true; - - bl = aiter->second; - - bufferlist::iterator iter = bl.begin(); - try { - bucket_cors->decode(iter); - } catch (buffer::error& err) { - ldout(s->cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl; - return -EIO; - } - if (s->cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15)) { - RGWCORSConfiguration_S3 *s3cors = static_cast<RGWCORSConfiguration_S3 *>(bucket_cors); - ldout(s->cct, 15) << "Read RGWCORSConfiguration"; - s3cors->to_xml(*_dout); - *_dout << dendl; - } - return 0; -} - int RGWGetCORS::verify_permission() { if (s->user.user_id.compare(s->bucket_owner.get_id()) != 0) @@ -1876,9 +1950,7 @@ int RGWGetCORS::verify_permission() void RGWGetCORS::execute() { - bool cors_exist; - - ret = read_bucket_cors(store, s, &bucket_cors, &cors_exist); + ret = read_bucket_cors(); if (ret < 0) return ; @@ -1922,9 +1994,7 @@ int RGWDeleteCORS::verify_permission() void RGWDeleteCORS::execute() { - bool cors_exist; - RGWCORSConfiguration bucket_cors; - ret = read_bucket_cors(store, s, &bucket_cors, &cors_exist); + ret = read_bucket_cors(); if (ret < 0) return; @@ -1961,52 +2031,34 @@ void RGWDeleteCORS::execute() } void RGWOptionsCORS::get_response_params(string& hdrs, string& exp_hdrs, unsigned *max_age) { - if (req_hdrs) { - list<string> hl; - get_str_list(req_hdrs, hl); - for(list<string>::iterator it = hl.begin(); it != hl.end(); ++it) { - if (!rule->is_header_allowed((*it).c_str(), (*it).length())) { - dout(5) << "Header " << (*it) << " is not registered in this rule" << dendl; - } else { - if (hdrs.length() > 0)hdrs.append(","); - hdrs.append((*it)); - } - } - } - rule->format_exp_headers(exp_hdrs); - *max_age = rule->get_max_age(); + get_cors_response_headers(rule, req_hdrs, hdrs, exp_hdrs, max_age); } -int RGWOptionsCORS::validate_cors_request() { - RGWCORSConfiguration *cc = s->bucket_cors; +int RGWOptionsCORS::validate_cors_request(RGWCORSConfiguration *cc) { rule = cc->host_name_rule(origin); if (!rule) { - dout(10) << "There is no corsrule present for " << origin << dendl; + dout(10) << "There is no cors rule present for " << origin << dendl; return -ENOENT; } - uint8_t flags = 0; - if (strcmp(req_meth, "GET") == 0) flags = RGW_CORS_GET; - else if (strcmp(req_meth, "POST") == 0) flags = RGW_CORS_POST; - else if (strcmp(req_meth, "PUT") == 0) flags = RGW_CORS_PUT; - else if (strcmp(req_meth, "DELETE") == 0) flags = RGW_CORS_DELETE; - else if (strcmp(req_meth, "HEAD") == 0) flags = RGW_CORS_HEAD; - - if ((rule->get_allowed_methods() & flags) == flags) { - dout(10) << "Method " << req_meth << " is supported" << dendl; - } else { - dout(5) << "Method " << req_meth << " is not supported" << dendl; - req_meth = NULL; - return -ENOTSUP; + if (!validate_cors_rule_method(rule, req_meth)) { + return -ENOENT; } return 0; } void RGWOptionsCORS::execute() { - if (!s->bucket_cors) { - dout(2) << "No CORS configuration set yet for this bucket" << dendl; - ret = -EACCES; + ret = read_bucket_cors(); + if (ret < 0) + return; + + origin = s->info.env->get("HTTP_ORIGIN"); + if (!origin) { + dout(0) << + "Preflight request without mandatory Origin header" + << dendl; + ret = -EINVAL; return; } req_meth = s->info.env->get("HTTP_ACCESS_CONTROL_REQUEST_METHOD"); @@ -2014,19 +2066,16 @@ void RGWOptionsCORS::execute() dout(0) << "Preflight request without mandatory Access-control-request-method header" << dendl; - ret = -EACCES; + ret = -EINVAL; return; } - origin = s->info.env->get("HTTP_ORIGIN"); - if (!origin) { - dout(0) << - "Preflight request without mandatory Origin header" - << dendl; - ret = -EACCES; + if (!cors_exist) { + dout(2) << "No CORS configuration set yet for this bucket" << dendl; + ret = -ENOENT; return; } req_hdrs = s->info.env->get("HTTP_ACCESS_CONTROL_ALLOW_HEADERS"); - ret = validate_cors_request(); + ret = validate_cors_request(&bucket_cors); if (!rule) { origin = req_meth = NULL; return; diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index d158f831cc7..948a11830c2 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -34,8 +34,10 @@ protected: struct req_state *s; RGWHandler *dialect_handler; RGWRados *store; + RGWCORSConfiguration bucket_cors; + bool cors_exist; public: - RGWOp() : s(NULL), dialect_handler(NULL), store(NULL) {} + RGWOp() : s(NULL), dialect_handler(NULL), store(NULL), cors_exist(false) {} virtual ~RGWOp() {} virtual void init(RGWRados *store, struct req_state *s, RGWHandler *dialect_handler) { @@ -43,6 +45,9 @@ public: this->s = s; this->dialect_handler = dialect_handler; } + int read_bucket_cors(); + bool generate_cors_headers(string& origin, string& method, string& headers, string& exp_headers, unsigned *max_age); + virtual int verify_params() { return 0; } virtual bool prefetch_data() { return false; } virtual int verify_permission() = 0; @@ -526,7 +531,6 @@ public: class RGWGetCORS : public RGWOp { protected: int ret; - RGWCORSConfiguration bucket_cors; public: RGWGetCORS() : ret(0) {} @@ -586,7 +590,7 @@ public: } int verify_permission() {return 0;} - int validate_cors_request(); + int validate_cors_request(RGWCORSConfiguration *cc); void execute(); void get_response_params(string& allowed_hdrs, string& exp_hdrs, unsigned *max_age); virtual void send_response() = 0; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 05db9bff782..0c2119ecf9d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -741,7 +741,7 @@ void RGWPutObjProcessor_Atomic::complete_parts() prepare_next_part(obj_len); } -int RGWPutObjProcessor_Atomic::do_complete(string& etag, time_t *mtime, time_t set_mtime, map<string, bufferlist>& attrs) +int RGWPutObjProcessor_Atomic::complete_writing_data() { if (!data_ofs && !immutable_head()) { first_chunk.claim(pending_data_bl); @@ -761,6 +761,13 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, time_t *mtime, time_t s } } complete_parts(); + return 0; +} + +int RGWPutObjProcessor_Atomic::do_complete(string& etag, time_t *mtime, time_t set_mtime, map<string, bufferlist>& attrs) { + int r = complete_writing_data(); + if (r < 0) + return r; store->set_atomic(obj_ctx, head_obj); @@ -772,9 +779,9 @@ int RGWPutObjProcessor_Atomic::do_complete(string& etag, time_t *mtime, time_t s extra_params.mtime = mtime; extra_params.set_mtime = set_mtime; - int r = store->put_obj_meta(obj_ctx, head_obj, obj_len, attrs, - RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE, - extra_params); + r = store->put_obj_meta(obj_ctx, head_obj, obj_len, attrs, + RGW_OBJ_CATEGORY_MAIN, PUT_OBJ_CREATE, + extra_params); return r; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 0da6f4669bf..ef98ec1f9fb 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -284,6 +284,7 @@ protected: void prepare_next_part(off_t ofs); void complete_parts(); + int complete_writing_data(); public: ~RGWPutObjProcessor_Atomic() {} diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 571e4869642..196bd29e99b 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -377,6 +377,20 @@ void dump_access_control(struct req_state *s, const char *origin, const char *me } } +void dump_access_control(req_state *s, RGWOp *op) +{ + string origin; + string method; + string header; + string exp_header; + unsigned max_age = CORS_MAX_AGE_INVALID; + + if (!op->generate_cors_headers(origin, method, header, exp_header, &max_age)) + return; + + dump_access_control(s, origin.c_str(), method.c_str(), header.c_str(), exp_header.c_str(), max_age); +} + void dump_start(struct req_state *s) { if (!s->content_started) { @@ -386,10 +400,14 @@ void dump_start(struct req_state *s) } } -void end_header(struct req_state *s, const char *content_type) +void end_header(struct req_state *s, RGWOp *op, const char *content_type) { string ctype; + if (op) { + dump_access_control(s, op); + } + if (!content_type || s->err.is_err()) { switch (s->format) { case RGW_FORMAT_XML: @@ -424,7 +442,7 @@ void end_header(struct req_state *s, const char *content_type) rgw_flush_formatter_and_reset(s, s->formatter); } -void abort_early(struct req_state *s, int err_no) +void abort_early(struct req_state *s, RGWOp *op, int err_no) { if (!s->formatter) { s->formatter = new JSONFormatter; @@ -432,7 +450,7 @@ void abort_early(struct req_state *s, int err_no) } set_req_state_err(s, err_no); dump_errno(s); - end_header(s); + end_header(s, op); rgw_flush_formatter_and_reset(s, s->formatter); perfcounter->inc(l_rgw_failed_req); } @@ -644,7 +662,7 @@ void RGWRESTFlusher::do_start(int ret) set_req_state_err(s, ret); /* no going back from here */ dump_errno(s); dump_start(s); - end_header(s); + end_header(s, op); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -927,7 +945,7 @@ void RGWRESTOp::send_response() if (!flusher.did_start()) { set_req_state_err(s, http_ret); dump_errno(s); - end_header(s); + end_header(s, this); } flusher.flush(); } @@ -1062,7 +1080,7 @@ int RGWHandler_ObjStore::read_permissions(RGWOp *op_obj) case OP_COPY: // op itself will read and verify the permissions return 0; case OP_OPTIONS: - only_bucket = false; + only_bucket = true; break; default: return -EINVAL; diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index b65efb3de3e..15ac863aa52 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -33,15 +33,17 @@ public: class RGWRESTFlusher : public RGWFormatterFlusher { struct req_state *s; + RGWOp *op; protected: virtual void do_flush(); virtual void do_start(int ret); public: - RGWRESTFlusher(struct req_state *_s) : RGWFormatterFlusher(_s->formatter), s(_s) {} - RGWRESTFlusher() : RGWFormatterFlusher(NULL), s(NULL) {} + RGWRESTFlusher(struct req_state *_s, RGWOp *_op) : RGWFormatterFlusher(_s->formatter), s(_s), op(_op) {} + RGWRESTFlusher() : RGWFormatterFlusher(NULL), s(NULL), op(NULL) {} - void init(struct req_state *_s) { + void init(struct req_state *_s, RGWOp *_op) { s = _s; + op = _op; set_formatter(s->formatter); } }; @@ -228,7 +230,7 @@ public: RGWRESTOp() : http_ret(0) {} virtual void init(RGWRados *store, struct req_state *s, RGWHandler *dialect_handler) { RGWOp::init(store, s, dialect_handler); - flusher.init(s); + flusher.init(s, this); } virtual void send_response(); virtual int check_caps(RGWUserCaps& caps) { return -EPERM; } /* should to be implemented! */ @@ -310,7 +312,7 @@ public: extern void set_req_state_err(struct req_state *s, int err_no); extern void dump_errno(struct req_state *s); extern void dump_errno(struct req_state *s, int ret); -extern void end_header(struct req_state *s, const char *content_type = NULL); +extern void end_header(struct req_state *s, RGWOp *op = NULL, const char *content_type = NULL); extern void dump_start(struct req_state *s); extern void list_all_buckets_start(struct req_state *s); extern void dump_owner(struct req_state *s, string& id, string& name, const char *section = NULL); @@ -318,7 +320,7 @@ extern void dump_content_length(struct req_state *s, uint64_t len); extern void dump_etag(struct req_state *s, const char *etag); extern void dump_epoch_header(struct req_state *s, const char *name, time_t t); extern void dump_last_modified(struct req_state *s, time_t t); -extern void abort_early(struct req_state *s, int err); +extern void abort_early(struct req_state *s, RGWOp *op, int err); extern void dump_range(struct req_state *s, uint64_t ofs, uint64_t end, uint64_t total_size); extern void dump_continue(struct req_state *s); extern void list_all_buckets_end(struct req_state *s); @@ -331,6 +333,7 @@ extern void dump_pair(struct req_state *s, const char *key, const char *value); extern bool is_valid_url(const char *url); extern void dump_access_control(struct req_state *s, const char *origin, const char *meth, const char *hdr, const char *exp_hdr, uint32_t max_age); +extern void dump_access_control(req_state *s, RGWOp *op); #endif diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 71bb418c53c..83874dd42c4 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -166,7 +166,8 @@ done: if (!content_type) content_type = "binary/octet-stream"; - end_header(s, content_type); + + end_header(s, this, content_type); if (metadata_bl.length()) { s->cio->write(metadata_bl.c_str(), metadata_bl.length()); @@ -189,7 +190,7 @@ void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets) set_req_state_err(s, ret); dump_errno(s); dump_start(s); - end_header(s, "application/xml"); + end_header(s, NULL, "application/xml"); if (!ret) { list_all_buckets_start(s); @@ -242,7 +243,7 @@ void RGWListBucket_ObjStore_S3::send_response() set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); dump_start(s); if (ret < 0) return; @@ -288,7 +289,7 @@ void RGWListBucket_ObjStore_S3::send_response() void RGWGetBucketLogging_ObjStore_S3::send_response() { dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); dump_start(s); s->formatter->open_object_section_in_ns("BucketLoggingStatus", @@ -315,7 +316,7 @@ void RGWStatBucket_ObjStore_S3::send_response() set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); dump_start(s); } @@ -467,7 +468,7 @@ void RGWDeleteBucket_ObjStore_S3::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, this); if (s->system_request) { JSONFormatter f; /* use json formatter for system requests output */ @@ -521,7 +522,7 @@ void RGWPutObj_ObjStore_S3::send_response() dump_epoch_header(s, "Rgwx-Mtime", mtime); } dump_errno(s); - end_header(s); + end_header(s, this); } /* @@ -893,6 +894,11 @@ int RGWPostObj_ObjStore_S3::get_params() rebuild_key(s->object_str); + if (s->object_str.empty()) { + err_msg = "Empty object name"; + return -EINVAL; + } + env.add_var("key", s->object_str); part_str("Content-Type", &content_type); @@ -1206,7 +1212,7 @@ done: set_req_state_err(s, ret); dump_errno(s); dump_content_length(s, s->formatter->get_len()); - end_header(s); + end_header(s, this); if (ret != STATUS_CREATED) return; @@ -1224,7 +1230,7 @@ void RGWDeleteObj_ObjStore_S3::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, this); } int RGWCopyObj_ObjStore_S3::init_dest_policy() @@ -1308,7 +1314,7 @@ void RGWCopyObj_ObjStore_S3::send_partial_response(off_t ofs) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "binary/octet-stream"); + end_header(s, this, "binary/octet-stream"); if (ret == 0) { s->formatter->open_object_section("CopyObjectResult"); } @@ -1347,7 +1353,7 @@ void RGWGetACLs_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); dump_start(s); s->cio->write(acls.c_str(), acls.size()); } @@ -1376,7 +1382,7 @@ void RGWPutACLs_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); dump_start(s); } @@ -1389,7 +1395,7 @@ void RGWGetCORS_ObjStore_S3::send_response() set_req_state_err(s, ret); } dump_errno(s); - end_header(s, "application/xml"); + end_header(s, NULL, "application/xml"); dump_start(s); if (!ret) { string cors; @@ -1464,7 +1470,7 @@ void RGWPutCORS_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, NULL, "application/xml"); dump_start(s); } @@ -1476,7 +1482,7 @@ void RGWDeleteCORS_ObjStore_S3::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, NULL); } void RGWOptionsCORS_ObjStore_S3::send_response() @@ -1485,22 +1491,20 @@ void RGWOptionsCORS_ObjStore_S3::send_response() uint32_t max_age = CORS_MAX_AGE_INVALID; /*EACCES means, there is no CORS registered yet for the bucket *ENOENT means, there is no match of the Origin in the list of CORSRule - *ENOTSUPP means, the HTTP_METHOD is not supported */ if (ret == -ENOENT) ret = -EACCES; - if (ret != -EACCES) { - get_response_params(hdrs, exp_hdrs, &max_age); - } else { + if (ret < 0) { set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, NULL); return; } + get_response_params(hdrs, exp_hdrs, &max_age); dump_errno(s); dump_access_control(s, origin, req_meth, hdrs.c_str(), exp_hdrs.c_str(), max_age); - end_header(s); + end_header(s, NULL); } int RGWInitMultipart_ObjStore_S3::get_params() @@ -1520,7 +1524,7 @@ void RGWInitMultipart_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); if (ret == 0) { dump_start(s); s->formatter->open_object_section_in_ns("InitiateMultipartUploadResult", @@ -1538,7 +1542,7 @@ void RGWCompleteMultipart_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); if (ret == 0) { dump_start(s); s->formatter->open_object_section_in_ns("CompleteMultipartUploadResult", @@ -1561,7 +1565,7 @@ void RGWAbortMultipart_ObjStore_S3::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, this); } void RGWListMultipart_ObjStore_S3::send_response() @@ -1569,7 +1573,7 @@ void RGWListMultipart_ObjStore_S3::send_response() if (ret) set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); if (ret == 0) { dump_start(s); @@ -1624,7 +1628,7 @@ void RGWListBucketMultiparts_ObjStore_S3::send_response() set_req_state_err(s, ret); dump_errno(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); dump_start(s); if (ret < 0) return; @@ -1695,7 +1699,7 @@ void RGWDeleteMultiObj_ObjStore_S3::begin_response() } dump_start(s); - end_header(s, "application/xml"); + end_header(s, this, "application/xml"); s->formatter->open_object_section_in_ns("DeleteResult", "http://s3.amazonaws.com/doc/2006-03-01/"); diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index b4f830830f9..651c4635d37 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -52,7 +52,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets) set_req_state_err(s, ret); } dump_errno(s); - end_header(s); + end_header(s, NULL); if (!ret) { dump_start(s); @@ -211,7 +211,7 @@ next: set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); if (ret < 0) { return; } @@ -266,7 +266,7 @@ void RGWStatAccount_ObjStore_SWIFT::send_response() set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, NULL); dump_start(s); } @@ -280,7 +280,7 @@ void RGWStatBucket_ObjStore_SWIFT::send_response() set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); dump_start(s); } @@ -301,7 +301,7 @@ void RGWCreateBucket_ObjStore_SWIFT::send_response() ret = STATUS_ACCEPTED; set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, NULL); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -313,7 +313,7 @@ void RGWDeleteBucket_ObjStore_SWIFT::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, this); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -361,7 +361,7 @@ void RGWPutObj_ObjStore_SWIFT::send_response() dump_etag(s, etag.c_str()); set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -421,7 +421,7 @@ void RGWPutMetadata_ObjStore_SWIFT::send_response() ret = STATUS_ACCEPTED; set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -433,7 +433,7 @@ void RGWDeleteObj_ObjStore_SWIFT::send_response() set_req_state_err(s, r); dump_errno(s); - end_header(s); + end_header(s, this); rgw_flush_formatter_and_reset(s, s->formatter); } @@ -484,7 +484,7 @@ void RGWCopyObj_ObjStore_SWIFT::send_partial_response(off_t ofs) ret = STATUS_CREATED; set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); /* Send progress information. Note that this diverge from the original swift * spec. We do this in order to keep connection alive. @@ -506,7 +506,7 @@ void RGWCopyObj_ObjStore_SWIFT::send_response() ret = STATUS_CREATED; set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, this); } else { s->formatter->close_section(); rgw_flush_formatter(s, s->formatter); @@ -570,7 +570,7 @@ int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs, o if (!content_type) content_type = "binary/octet-stream"; - end_header(s, content_type); + end_header(s, this, content_type); sent_header = true; @@ -600,12 +600,12 @@ void RGWOptionsCORS_ObjStore_SWIFT::send_response() } else { set_req_state_err(s, ret); dump_errno(s); - end_header(s); + end_header(s, NULL); return; } dump_errno(s); dump_access_control(s, origin, req_meth, hdrs.c_str(), exp_hdrs.c_str(), max_age); - end_header(s); + end_header(s, NULL); } RGWOp *RGWHandler_ObjStore_Service_SWIFT::op_get() diff --git a/src/test/Makefile.am b/src/test/Makefile.am new file mode 100644 index 00000000000..6a9e2cb5212 --- /dev/null +++ b/src/test/Makefile.am @@ -0,0 +1,838 @@ +## Unknown/other tests + +ceph_test_timers_SOURCES = test/TestTimers.cc +ceph_test_timers_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_timers + +ceph_test_signal_handlers_SOURCES = test/TestSignalHandlers.cc +ceph_test_signal_handlers_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_signal_handlers + +ceph_test_rados_SOURCES = \ + test/osd/TestRados.cc \ + test/osd/TestOpStat.cc \ + test/osd/Object.cc \ + test/osd/RadosModel.cc +ceph_test_rados_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_rados + +ceph_test_mutate_SOURCES = test/test_mutate.cc +ceph_test_mutate_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_mutate + +ceph_test_rewrite_latency_SOURCES = test/test_rewrite_latency.cc +ceph_test_rewrite_latency_LDADD = $(LIBCOMMON) $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) +bin_DEBUGPROGRAMS += ceph_test_rewrite_latency + +ceph_test_msgr_SOURCES = test/testmsgr.cc +ceph_test_msgr_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_msgr + +ceph_streamtest_SOURCES = test/streamtest.cc +ceph_streamtest_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_streamtest + +ceph_test_trans_SOURCES = test/test_trans.cc +ceph_test_trans_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_trans + +ceph_test_crypto_SOURCES = test/testcrypto.cc +ceph_test_crypto_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_crypto + +ceph_test_keys_SOURCES = test/testkeys.cc +ceph_test_keys_LDADD = $(LIBMON) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_keys + + +## Dencoder test + +ceph_dencoder_SOURCES = \ + test/encoding/ceph_dencoder.cc \ + $(DENCODER_SOURCES) +ceph_dencoder_LDADD = \ + $(LIBOSD) $(LIBMDS) $(LIBMON) \ + $(DENCODER_DEPS) $(CEPH_GLOBAL) + +# These should always use explicit _CFLAGS/_CXXFLAGS so avoid basename conflicts +ceph_dencoder_CFLAGS = ${AM_CFLAGS} +ceph_dencoder_CXXFLAGS = ${AM_CXXFLAGS} + +if COMPILER_HAS_VTA +ceph_dencoder_CFLAGS += -fno-var-tracking-assignments +ceph_dencoder_CXXFLAGS += -fno-var-tracking-assignments +endif + +bin_PROGRAMS += ceph-dencoder + + +## Build tests +# These should all use explicit _CXXFLAGS so avoid basename conflicts + +if WITH_BUILD_TESTS +test_build_libcommon_SOURCES = \ + test/buildtest_skeleton.cc \ + $(libcommon_la_SOURCES) +test_build_libcommon_LDADD = \ + $(LIBCOMMON_DEPS) \ + $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +test_build_libcommon_LDFLAGS = -static-libtool-libs +test_build_libcommon_CFLAGS = $(AM_CFLAGS) +test_build_libcommon_CXXFLAGS = $(AM_CXXFLAGS) +bin_DEBUGPROGRAMS += test_build_libcommon + +test_build_librados_SOURCES = \ + test/buildtest_skeleton.cc \ + $(librados_la_SOURCES) +test_build_librados_LDADD = \ + $(LIBRADOS_DEPS) \ + $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +test_build_librados_LDFLAGS = -static-libtool-libs +test_build_librados_CFLAGS = $(AM_CFLAGS) +test_build_librados_CXXFLAGS = $(AM_CXXFLAGS) +bin_DEBUGPROGRAMS += test_build_librados + +test_build_librgw_SOURCES = \ + test/buildtest_skeleton.cc \ + $(librgw_la_SOURCES) +test_build_librgw_LDADD = \ + $(LIBRGW_DEPS) \ + $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) \ + $(CEPH_GLOBAL) +test_build_librgw_LDFLAGS = -static-libtool-libs +test_build_librgw_CFLAGS = $(AM_CFLAGS) +test_build_librgw_CXXFLAGS = $(AM_CXXFLAGS) +bin_DEBUGPROGRAMS += test_build_librgw + +# I dont get this one... testing the osdc build but link in libcephfs? +test_build_libcephfs_SOURCES = \ + test/buildtest_skeleton.cc \ + $(libosdc_la_SOURCES) +test_build_libcephfs_LDADD = \ + $(LIBCEPHFS) -lexpat \ + $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +test_build_libcephfs_LDFLAGS = -static-libtool-libs +test_build_libcephfs_CFLAGS = $(AM_CFLAGS) +test_build_libcephfs_CXXFLAGS = $(AM_CXXFLAGS) +bin_DEBUGPROGRAMS += test_build_libcephfs + +if WITH_HADOOPCLIENT +test_build_libhadoopcephfs_SOURCES = \ + test/buildtest_skeleton.cc \ + $(libhadoopcephfs_la_SOURCES) +test_build_libhadoopcephfs_LDADD = \ + $(LIBCEPHFS) -lexpat \ + $(PTHREAD_LIBS) $(CRYPTO_LIBS) $(EXTRALIBS) +test_build_libhadoopcephfs_LDFLAGS = -static-libtool-libs +test_build_libhadoopcephfs_CFLAGS = $(AM_CFLAGS) +test_build_libhadoopcephfs_CXXFLAGS = $(AM_CXXFLAGS) +bin_DEBUGPROGRAMS += test_build_libhadoopcephfs +endif # WITH_HADOOPCLIENT + +endif # WITH_BUILD_TESTS + + +## Benchmarks + +ceph_smalliobench_SOURCES = \ + test/bench/small_io_bench.cc \ + test/bench/rados_backend.cc \ + test/bench/detailed_stat_collector.cc \ + test/bench/bencher.cc +ceph_smalliobench_LDADD = $(LIBRADOS) -lboost_program_options $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_smalliobench + +ceph_smalliobenchfs_SOURCES = \ + test/bench/small_io_bench_fs.cc \ + test/bench/testfilestore_backend.cc \ + test/bench/detailed_stat_collector.cc \ + test/bench/bencher.cc +ceph_smalliobenchfs_LDADD = $(LIBRADOS) -lboost_program_options $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_smalliobenchfs + +ceph_smalliobenchdumb_SOURCES = \ + test/bench/small_io_bench_dumb.cc \ + test/bench/dumb_backend.cc \ + test/bench/detailed_stat_collector.cc \ + test/bench/bencher.cc +ceph_smalliobenchdumb_LDADD = $(LIBRADOS) -lboost_program_options $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_smalliobenchdumb + +ceph_smalliobenchrbd_SOURCES = \ + test/bench/small_io_bench_rbd.cc \ + test/bench/rbd_backend.cc \ + test/bench/detailed_stat_collector.cc \ + test/bench/bencher.cc +ceph_smalliobenchrbd_LDADD = $(LIBRBD) $(LIBRADOS) -lboost_program_options $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_smalliobenchrbd + +ceph_tpbench_SOURCES = \ + test/bench/tp_bench.cc \ + test/bench/detailed_stat_collector.cc +ceph_tpbench_LDADD = $(LIBRADOS) -lboost_program_options $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_tpbench + +ceph_omapbench_SOURCES = test/omap_bench.cc +ceph_omapbench_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_omapbench + +ceph_kvstorebench_SOURCES = \ + test/kv_store_bench.cc \ + key_value_store/kv_flat_btree_async.cc +ceph_kvstorebench_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_kvstorebench + +ceph_multi_stress_watch_SOURCES = \ + test/multi_stress_watch.cc \ + test/librados/test.cc +ceph_multi_stress_watch_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_multi_stress_watch + + + + + + +## System tests + +libsystest_la_SOURCES = \ + test/system/cross_process_sem.cc \ + test/system/systest_runnable.cc \ + test/system/systest_settings.cc +libsystest_la_LIBADD = $(CEPH_GLOBAL) +noinst_LTLIBRARIES += libsystest.la + +ceph_test_rados_list_parallel_SOURCES = \ + test/system/rados_list_parallel.cc \ + test/system/st_rados_create_pool.cc \ + test/system/st_rados_list_objects.cc +ceph_test_rados_list_parallel_LDADD = $(LIBRADOS) libsystest.la $(PTHREAD_LIBS) +bin_DEBUGPROGRAMS += ceph_test_rados_list_parallel + +ceph_test_rados_open_pools_parallel_SOURCES = \ + test/system/rados_open_pools_parallel.cc \ + test/system/st_rados_create_pool.cc +ceph_test_rados_open_pools_parallel_LDADD = $(LIBRADOS) libsystest.la $(PTHREAD_LIBS) +bin_DEBUGPROGRAMS += ceph_test_rados_open_pools_parallel + +ceph_test_rados_delete_pools_parallel_SOURCES = \ + test/system/rados_delete_pools_parallel.cc \ + test/system/st_rados_create_pool.cc \ + test/system/st_rados_delete_pool.cc \ + test/system/st_rados_list_objects.cc +ceph_test_rados_delete_pools_parallel_LDADD = $(LIBRADOS) libsystest.la $(PTHREAD_LIBS) +bin_DEBUGPROGRAMS += ceph_test_rados_delete_pools_parallel + +ceph_test_rados_watch_notify_SOURCES = \ + test/system/rados_watch_notify.cc \ + test/system/st_rados_create_pool.cc \ + test/system/st_rados_delete_pool.cc \ + test/system/st_rados_delete_objs.cc \ + test/system/st_rados_watch.cc \ + test/system/st_rados_notify.cc +ceph_test_rados_watch_notify_LDADD = $(LIBRADOS) libsystest.la $(PTHREAD_LIBS) +bin_DEBUGPROGRAMS += ceph_test_rados_watch_notify + +ceph_bench_log_SOURCES = test/bench_log.cc +ceph_bench_log_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_bench_log + + + +## Unit tests + +# target to build but not run the unit tests +unittests:: $(check_PROGRAMS) + +UNITTEST_CXXFLAGS = \ + $(AM_CXXFLAGS) \ + -I$(top_srcdir)/src/gtest/include \ + -I$(top_builddir)/src/gtest/include +UNITTEST_LDADD = \ + $(top_builddir)/src/gtest/lib/libgtest.a \ + $(top_builddir)/src/gtest/lib/libgtest_main.a \ + $(PTHREAD_LIBS) + +unittest_encoding_SOURCES = test/encoding.cc +unittest_encoding_LDADD = $(LIBCEPHFS) $(LIBRADOS) -lm $(UNITTEST_LDADD) +unittest_encoding_CXXFLAGS = $(UNITTEST_CXXFLAGS) -fno-strict-aliasing +check_PROGRAMS += unittest_encoding + +unittest_addrs_SOURCES = test/test_addrs.cc +unittest_addrs_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_addrs_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_addrs + +unittest_sharedptr_registry_SOURCES = test/common/test_sharedptr_registry.cc +unittest_sharedptr_registry_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_sharedptr_registry_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_sharedptr_registry + +unittest_util_SOURCES = test/common/test_util.cc +unittest_util_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_util_LDADD = $(LIBCOMMON) -lm $(UNITTEST_LDADD) $(CRYPTO_LIBS) $(EXTRALIBS) +check_PROGRAMS += unittest_util + +unittest_workqueue_SOURCES = test/test_workqueue.cc +unittest_workqueue_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_workqueue_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_workqueue + +unittest_striper_SOURCES = test/test_striper.cc +unittest_striper_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_striper_LDADD = $(LIBOSDC) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_striper + +unittest_prebufferedstreambuf_SOURCES = test/test_prebufferedstreambuf.cc +unittest_prebufferedstreambuf_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_prebufferedstreambuf_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) $(EXTRALIBS) +check_PROGRAMS += unittest_prebufferedstreambuf + +unittest_str_list_SOURCES = test/test_str_list.cc +unittest_str_list_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_str_list_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_str_list + +unittest_log_SOURCES = log/test.cc +unittest_log_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) +unittest_log_CXXFLAGS = $(UNITTEST_CXXFLAGS) -O2 +check_PROGRAMS += unittest_log + +unittest_throttle_SOURCES = test/common/Throttle.cc +unittest_throttle_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_throttle_CXXFLAGS = $(UNITTEST_CXXFLAGS) -O2 +check_PROGRAMS += unittest_throttle + +unittest_base64_SOURCES = test/base64.cc +unittest_base64_LDADD = $(LIBCEPHFS) -lm $(UNITTEST_LDADD) +unittest_base64_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_base64 + +unittest_ceph_argparse_SOURCES = test/ceph_argparse.cc +unittest_ceph_argparse_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_ceph_argparse_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_ceph_argparse + +libec_example_la_SOURCES = test/osd/ErasureCodePluginExample.cc +libec_example_la_CFLAGS = ${AM_CFLAGS} +libec_example_la_CXXFLAGS= ${AM_CXXFLAGS} +libec_example_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS) +libec_example_la_LDFLAGS = ${AM_LDFLAGS} -export-symbols-regex '.*__erasure_code_.*' +erasure_codelib_LTLIBRARIES += libec_example.la + +unittest_erasure_code_plugin_SOURCES = test/osd/TestErasureCodePluginExample.cc +unittest_erasure_code_plugin_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_erasure_code_plugin_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +if LINUX +unittest_erasure_code_plugin_LDADD += -ldl +endif +check_PROGRAMS += unittest_erasure_code_plugin + + +unittest_erasure_code_example_SOURCES = test/osd/TestErasureCodeExample.cc +noinst_HEADERS += test/osd/ErasureCodeExample.h +unittest_erasure_code_example_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_erasure_code_example_LDADD = $(LIBOSD) $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_erasure_code_example + +unittest_osd_types_SOURCES = test/test_osd_types.cc +unittest_osd_types_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_osd_types_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_osd_types + +unittest_pglog_SOURCES = test/osd/TestPGLog.cc +unittest_pglog_CXXFLAGS = $(UNITTEST_CXXFLAGS) +unittest_pglog_LDADD = $(LIBOSD) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +check_PROGRAMS += unittest_pglog + +if LINUX +unittest_pglog_LDADD += -ldl +endif # LINUX + +unittest_gather_SOURCES = test/gather.cc +unittest_gather_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_gather_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_gather + +unittest_run_cmd_SOURCES = test/run_cmd.cc +unittest_run_cmd_LDADD = $(LIBCEPHFS) $(UNITTEST_LDADD) +unittest_run_cmd_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_run_cmd + +unittest_signals_SOURCES = test/signals.cc +unittest_signals_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_signals_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_signals + +unittest_simple_spin_SOURCES = test/simple_spin.cc +unittest_simple_spin_LDADD = $(LIBCEPHFS) $(UNITTEST_LDADD) +unittest_simple_spin_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_simple_spin + +unittest_librados_SOURCES = test/librados/librados.cc +unittest_librados_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +unittest_librados_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_librados + +unittest_bufferlist_SOURCES = test/bufferlist.cc +unittest_bufferlist_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_bufferlist_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_bufferlist + +unittest_crypto_SOURCES = test/crypto.cc +unittest_crypto_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_crypto_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_crypto + +unittest_perf_counters_SOURCES = test/perf_counters.cc +unittest_perf_counters_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_perf_counters_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_perf_counters + +unittest_admin_socket_SOURCES = test/admin_socket.cc +unittest_admin_socket_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_admin_socket_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_admin_socket + +unittest_ceph_crypto_SOURCES = test/ceph_crypto.cc +unittest_ceph_crypto_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_ceph_crypto_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_ceph_crypto + +unittest_utf8_SOURCES = test/utf8.cc +unittest_utf8_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_utf8_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_utf8 + +unittest_mime_SOURCES = test/mime.cc +unittest_mime_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_mime_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_mime + +unittest_escape_SOURCES = test/escape.cc +unittest_escape_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_escape_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_escape + +unittest_chain_xattr_SOURCES = test/filestore/chain_xattr.cc +unittest_chain_xattr_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_chain_xattr_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_chain_xattr + +unittest_flatindex_SOURCES = test/os/TestFlatIndex.cc +unittest_flatindex_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_flatindex_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_flatindex + +unittest_strtol_SOURCES = test/strtol.cc +unittest_strtol_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_strtol_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_strtol + +unittest_confutils_SOURCES = test/confutils.cc +unittest_confutils_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_confutils_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_confutils + +unittest_heartbeatmap_SOURCES = test/heartbeat_map.cc +unittest_heartbeatmap_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_heartbeatmap_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_heartbeatmap + +# why does this include rgw/rgw_formats.cc...? +unittest_formatter_SOURCES = \ + test/formatter.cc \ + rgw/rgw_formats.cc +unittest_formatter_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_formatter_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_formatter + +unittest_libcephfs_config_SOURCES = test/libcephfs_config.cc +unittest_libcephfs_config_LDADD = $(LIBCEPHFS) $(UNITTEST_LDADD) +unittest_libcephfs_config_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_libcephfs_config + +unittest_lfnindex_SOURCES = test/os/TestLFNIndex.cc +unittest_lfnindex_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_lfnindex_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_lfnindex + +unittest_librados_config_SOURCES = test/librados/librados_config.cc +unittest_librados_config_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +unittest_librados_config_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_librados_config + +#unittest_librgw_link_SOURCES = test/librgw_link.cc +#unittest_librgw_link_LDFLAGS = $(PTHREAD_CFLAGS) ${AM_LDFLAGS} +#unittest_librgw_link_LDADD = $(LIBRGW) ${UNITTEST_LDADD} +#unittest_librgw_link_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} +#check_PROGRAMS += unittest_librgw_link + +unittest_daemon_config_SOURCES = test/daemon_config.cc +unittest_daemon_config_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_daemon_config_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_daemon_config + +unittest_osd_osdcap_SOURCES = test/osd/osdcap.cc +unittest_osd_osdcap_LDADD = $(LIBOSD) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_osd_osdcap_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_osd_osdcap + +unittest_mon_moncap_SOURCES = test/mon/moncap.cc +unittest_mon_moncap_LDADD = $(LIBMON) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_mon_moncap_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_mon_moncap + +#if WITH_RADOSGW +#unittest_librgw_SOURCES = test/librgw.cc +#unittest_librgw_LDFLAGS = -lrt $(PTHREAD_CFLAGS) -lcurl ${AM_LDFLAGS} +#unittest_librgw_LDADD = librgw.la $(LIBRADOS) ${UNITTEST_LDADD} -lexpat $(CEPH_GLOBAL) +#unittest_librgw_CXXFLAGS = ${CRYPTO_CFLAGS} ${AM_CXXFLAGS} ${UNITTEST_CXXFLAGS} +#check_PROGRAMS += unittest_librgw +#endif # WITH_RADOSGW + +unittest_ipaddr_SOURCES = test/test_ipaddr.cc +unittest_ipaddr_LDADD = $(UNITTEST_LDADD) $(CEPH_GLOBAL) +unittest_ipaddr_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_ipaddr + +unittest_texttable_SOURCES = test/test_texttable.cc +unittest_texttable_LDADD = $(LIBCOMMON) $(UNITTEST_LDADD) +unittest_texttable_CXXFLAGS = $(UNITTEST_CXXFLAGS) +check_PROGRAMS += unittest_texttable + +if WITH_RADOSGW +ceph_test_cors_SOURCES = test/test_cors.cc +ceph_test_cors_LDADD = \ + $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ + $(UNITTEST_LDADD) \ + -lcurl -luuid -lexpat +ceph_test_cors_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cors + +ceph_test_cls_rgw_meta_SOURCES = test/test_rgw_admin_meta.cc +ceph_test_cls_rgw_meta_LDADD = \ + $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ + $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ + -lcurl -luuid -lexpat \ + libcls_version_client.a libcls_log_client.a \ + libcls_statelog_client.a libcls_refcount_client.la \ + libcls_rgw_client.la libcls_lock_client.la +ceph_test_cls_rgw_meta_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_rgw_meta + +ceph_test_cls_rgw_log_SOURCES = test/test_rgw_admin_log.cc +ceph_test_cls_rgw_log_LDADD = \ + $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ + $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ + -lcurl -luuid -lexpat \ + libcls_version_client.a libcls_log_client.a \ + libcls_statelog_client.a libcls_refcount_client.la \ + libcls_rgw_client.la libcls_lock_client.la +ceph_test_cls_rgw_log_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_rgw_log + +ceph_test_cls_rgw_opstate_SOURCES = test/test_rgw_admin_opstate.cc +ceph_test_cls_rgw_opstate_LDADD = \ + $(LIBRADOS) $(LIBRGW) $(CEPH_GLOBAL) \ + $(UNITTEST_LDADD) $(CRYPTO_LIBS) \ + -lcurl -luuid -lexpat \ + libcls_version_client.a libcls_log_client.a \ + libcls_statelog_client.a libcls_refcount_client.la \ + libcls_rgw_client.la libcls_lock_client.la +ceph_test_cls_rgw_opstate_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_rgw_opstate +endif # WITH_RADOSGW + +ceph_test_librbd_SOURCES = \ + test/librbd/test_librbd.cc \ + test/librados/test.cc +ceph_test_librbd_LDADD = $(LIBRBD) $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_librbd_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_librbd + +ceph_test_librbd_fsx_SOURCES = test/librbd/fsx.c +ceph_test_librbd_fsx_LDADD = $(LIBRBD) $(LIBRADOS) -lm +ceph_test_librbd_fsx_CFLAGS = ${AM_CFLAGS} -Wno-format +bin_DEBUGPROGRAMS += ceph_test_librbd_fsx + +ceph_test_cls_rbd_SOURCES = \ + test/cls_rbd/test_cls_rbd.cc \ + test/librados/test.cc +ceph_test_cls_rbd_LDADD = $(LIBRADOS) libcls_rbd_client.la libcls_lock_client.la $(UNITTEST_LDADD) +ceph_test_cls_rbd_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_rbd + +ceph_test_cls_refcount_SOURCES = \ + test/cls_refcount/test_cls_refcount.cc \ + test/librados/test.cc +ceph_test_cls_refcount_LDADD = $(LIBRADOS) libcls_refcount_client.la $(UNITTEST_LDADD) +ceph_test_cls_refcount_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_refcount + +ceph_test_cls_version_SOURCES = \ + test/cls_version/test_cls_version.cc \ + test/librados/test.cc +ceph_test_cls_version_LDADD = $(LIBRADOS) libcls_version_client.a $(UNITTEST_LDADD) +ceph_test_cls_version_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_version + +ceph_test_cls_log_SOURCES = \ + test/cls_log/test_cls_log.cc \ + test/librados/test.cc +ceph_test_cls_log_LDADD = $(LIBRADOS) libcls_log_client.a $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_cls_log_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_log + +ceph_test_cls_statelog_SOURCES = \ + test/cls_statelog/test_cls_statelog.cc \ + test/librados/test.cc +ceph_test_cls_statelog_LDADD = $(LIBRADOS) libcls_statelog_client.a $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_cls_statelog_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_statelog + +ceph_test_cls_replica_log_SOURCES = \ + test/cls_replica_log/test_cls_replica_log.cc \ + test/librados/test.cc +ceph_test_cls_replica_log_LDADD = \ + $(LIBRADOS) libcls_replica_log_client.a \ + $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_cls_replica_log_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_replica_log + +ceph_test_cls_lock_SOURCES = \ + test/cls_lock/test_cls_lock.cc \ + test/librados/test.cc +ceph_test_cls_lock_LDADD = $(LIBRADOS) libcls_lock_client.la $(UNITTEST_LDADD) +ceph_test_cls_lock_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_lock + +ceph_test_cls_hello_SOURCES = \ + test/cls_hello/test_cls_hello.cc \ + test/librados/test.cc +ceph_test_cls_hello_LDADD = \ + $(LIBRADOS) $(CRYPTO_LIBS) \ + $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_cls_hello_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_hello + +if WITH_RADOSGW +ceph_test_cls_rgw_SOURCES = \ + test/cls_rgw/test_cls_rgw.cc \ + test/librados/test.cc +ceph_test_cls_rgw_LDADD = $(LIBRADOS) libcls_rgw_client.la $(UNITTEST_LDADD) +ceph_test_cls_rgw_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_cls_rgw +endif # WITH_RADOSGW + +ceph_test_mon_workloadgen_SOURCES = test/mon/test_mon_workloadgen.cc +ceph_test_mon_workloadgen_LDADD = $(LIBOS) $(LIBOSDC) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_mon_workloadgen + +ceph_test_rados_api_cmd_SOURCES = \ + test/librados/cmd.cc \ + test/librados/test.cc +ceph_test_rados_api_cmd_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_cmd_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_cmd + +ceph_test_rados_api_io_SOURCES = \ + test/librados/io.cc \ + test/librados/test.cc +ceph_test_rados_api_io_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_io_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_io + +ceph_test_rados_api_aio_SOURCES = \ + test/librados/aio.cc \ + test/librados/test.cc +ceph_test_rados_api_aio_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_aio_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_aio + +ceph_test_rados_api_list_SOURCES = \ + test/librados/list.cc \ + test/librados/test.cc +ceph_test_rados_api_list_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_list_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_list + +ceph_test_rados_api_pool_SOURCES = \ + test/librados/pool.cc \ + test/librados/test.cc +ceph_test_rados_api_pool_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_pool_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_pool + +ceph_test_rados_api_stat_SOURCES = \ + test/librados/stat.cc \ + test/librados/test.cc +ceph_test_rados_api_stat_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_stat_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_stat + +ceph_test_rados_api_watch_notify_SOURCES = \ + test/librados/watch_notify.cc \ + test/librados/test.cc +ceph_test_rados_api_watch_notify_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_watch_notify_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_watch_notify + +ceph_test_rados_api_snapshots_SOURCES = \ + test/librados/snapshots.cc \ + test/librados/test.cc +ceph_test_rados_api_snapshots_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_snapshots_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_snapshots + +ceph_test_rados_api_cls_SOURCES = \ + test/librados/cls.cc \ + test/librados/test.cc +ceph_test_rados_api_cls_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_cls_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_cls + +ceph_test_rados_api_misc_SOURCES = \ + test/librados/misc.cc \ + test/librados/test.cc +ceph_test_rados_api_misc_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_rados_api_misc_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_misc + +ceph_test_rados_api_lock_SOURCES = \ + test/librados/lock.cc \ + test/librados/test.cc +ceph_test_rados_api_lock_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_rados_api_lock_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_rados_api_lock + +ceph_test_libcephfs_SOURCES = \ + test/libcephfs/test.cc \ + test/libcephfs/readdir_r_cb.cc \ + test/libcephfs/caps.cc \ + test/libcephfs/multiclient.cc +ceph_test_libcephfs_LDADD = $(LIBCEPHFS) $(UNITTEST_LDADD) +ceph_test_libcephfs_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_libcephfs + +ceph_test_filestore_SOURCES = test/filestore/store_test.cc +ceph_test_filestore_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_filestore_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_filestore + +ceph_test_filestore_workloadgen_SOURCES = \ + test/filestore/workload_generator.cc \ + test/filestore/TestFileStoreState.cc +ceph_test_filestore_workloadgen_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_filestore_workloadgen + +ceph_test_filestore_idempotent_SOURCES = \ + test/filestore/test_idempotent.cc \ + test/filestore/FileStoreTracker.cc \ + test/common/ObjectContents.cc +ceph_test_filestore_idempotent_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_filestore_idempotent + +ceph_test_filestore_idempotent_sequence_SOURCES = \ + test/filestore/test_idempotent_sequence.cc \ + test/filestore/DeterministicOpSequence.cc \ + test/filestore/TestFileStoreState.cc \ + test/filestore/FileStoreDiff.cc +ceph_test_filestore_idempotent_sequence_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_filestore_idempotent_sequence + +ceph_xattr_bench_SOURCES = test/xattr_bench.cc +ceph_xattr_bench_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_xattr_bench_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_xattr_bench + +ceph_test_filejournal_SOURCES = test/test_filejournal.cc +ceph_test_filejournal_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_filejournal_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_filejournal + +ceph_test_stress_watch_SOURCES = \ + test/test_stress_watch.cc \ + test/librados/test.cc +ceph_test_stress_watch_LDADD = $(LIBRADOS) $(UNITTEST_LDADD) +ceph_test_stress_watch_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_stress_watch + +ceph_test_objectcacher_stress_SOURCES = \ + test/osdc/object_cacher_stress.cc \ + test/osdc/FakeWriteback.cc +ceph_test_objectcacher_stress_LDADD = $(LIBOSDC) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_test_objectcacher_stress + +ceph_test_snap_mapper_SOURCES = test/test_snap_mapper.cc +ceph_test_snap_mapper_LDADD = $(LIBOSD) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_snap_mapper_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_snap_mapper + +ceph_test_object_map_SOURCES = \ + test/ObjectMap/test_object_map.cc \ + test/ObjectMap/KeyValueDBMemory.cc +ceph_test_object_map_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_object_map_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_object_map + +ceph_test_keyvaluedb_atomicity_SOURCES = test/ObjectMap/test_keyvaluedb_atomicity.cc +ceph_test_keyvaluedb_atomicity_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_keyvaluedb_atomicity_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_keyvaluedb_atomicity + +ceph_test_keyvaluedb_iterators_SOURCES = \ + test/ObjectMap/test_keyvaluedb_iterators.cc \ + test/ObjectMap/KeyValueDBMemory.cc +ceph_test_keyvaluedb_iterators_LDADD = $(LIBOS) $(UNITTEST_LDADD) $(CEPH_GLOBAL) +ceph_test_keyvaluedb_iterators_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_keyvaluedb_iterators + +ceph_test_store_tool_SOURCES = test/ObjectMap/test_store_tool/test_store_tool.cc +ceph_test_store_tool_LDADD = $(LIBOS) $(CEPH_GLOBAL) +ceph_test_store_tool_CXXFLAGS = $(UNITTEST_CXXFLAGS) +bin_DEBUGPROGRAMS += ceph_test_store_tool + +ceph_test_cfuse_cache_invalidate_SOURCES = test/test_cfuse_cache_invalidate.cc +bin_DEBUGPROGRAMS += ceph_test_cfuse_cache_invalidate + + +noinst_HEADERS += \ + test/osd/RadosModel.h \ + test/osd/Object.h \ + test/osd/TestOpStat.h \ + test/bench/distribution.h \ + test/bench/rados_backend.h \ + test/bench/rbd_backend.h \ + test/bench/bencher.h \ + test/bench/backend.h \ + test/bench/dumb_backend.h \ + test/bench/stat_collector.h \ + test/bench/detailed_stat_collector.h \ + test/bench/testfilestore_backend.h \ + test/common/ObjectContents.h \ + test/encoding/types.h \ + test/filestore/DeterministicOpSequence.h \ + test/filestore/FileStoreTracker.h \ + test/filestore/FileStoreDiff.h \ + test/filestore/TestFileStoreState.h \ + test/filestore/workload_generator.h \ + test/kv_store_bench.h \ + test/librados/test.h \ + test/ObjectMap/KeyValueDBMemory.h \ + test/omap_bench.h \ + test/osd/Object.h \ + test/osd/RadosModel.h \ + test/osd/TestOpStat.h \ + test/osdc/FakeWriteback.h \ + test/system/cross_process_sem.h \ + test/system/st_rados_create_pool.h \ + test/system/st_rados_list_objects.h \ + test/system/st_rados_delete_objs.h \ + test/system/st_rados_delete_pool.h \ + test/system/st_rados_notify.h \ + test/system/st_rados_watch.h \ + test/system/systest_runnable.h \ + test/system/systest_settings.h \ + test/unit.h + diff --git a/src/barclass.cc b/src/test/barclass.cc index f5354f1e0f3..f5354f1e0f3 100644 --- a/src/barclass.cc +++ b/src/test/barclass.cc diff --git a/src/test/test_libcommon_build.cc b/src/test/buildtest_skeleton.cc index 8215a05dbda..8215a05dbda 100644 --- a/src/test/test_libcommon_build.cc +++ b/src/test/buildtest_skeleton.cc diff --git a/src/test/common/test_crc32c.cc b/src/test/common/test_crc32c.cc new file mode 100644 index 00000000000..5cf88de0a80 --- /dev/null +++ b/src/test/common/test_crc32c.cc @@ -0,0 +1,84 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include <iostream> +#include <string.h> + +#include "include/types.h" +#include "include/crc32c.h" +#include "include/utime.h" +#include "common/Clock.h" + +#include "gtest/gtest.h" + +#include "common/sctp_crc32.h" +#include "common/crc32c_intel_baseline.h" + +TEST(Crc32c, Small) { + const char *a = "foo bar baz"; + const char *b = "whiz bang boom"; + ASSERT_EQ(4119623852u, ceph_crc32c(0, (unsigned char *)a, strlen(a))); + ASSERT_EQ(881700046u, ceph_crc32c(1234, (unsigned char *)a, strlen(a))); + ASSERT_EQ(2360230088u, ceph_crc32c(0, (unsigned char *)b, strlen(b))); + ASSERT_EQ(3743019208u, ceph_crc32c(5678, (unsigned char *)b, strlen(b))); +} + +TEST(Crc32c, PartialWord) { + const char *a = (const char *)malloc(5); + const char *b = (const char *)malloc(35); + memset((void *)a, 1, 5); + memset((void *)b, 1, 35); + ASSERT_EQ(2715569182u, ceph_crc32c(0, (unsigned char *)a, 5)); + ASSERT_EQ(440531800u, ceph_crc32c(0, (unsigned char *)b, 35)); +} + +TEST(Crc32c, Big) { + int len = 4096000; + char *a = (char *)malloc(len); + memset(a, 1, len); + ASSERT_EQ(31583199u, ceph_crc32c(0, (unsigned char *)a, len)); + ASSERT_EQ(1400919119u, ceph_crc32c(1234, (unsigned char *)a, len)); +} + +TEST(Crc32c, Performance) { + int len = 1000 * 1024 * 1024; + char *a = (char *)malloc(len); + std::cout << "populating large buffer" << std::endl; + for (int i=0; i<len; i++) + a[i] = i & 0xff; + std::cout << "calculating crc" << std::endl; + + { + utime_t start = ceph_clock_now(NULL); + unsigned val = ceph_crc32c(0, (unsigned char *)a, len); + utime_t end = ceph_clock_now(NULL); + float rate = (float)len / (float)(1024*1024) / (float)(end - start); + std::cout << "best choice = " << rate << " MB/sec" << std::endl; + ASSERT_EQ(261108528u, val); + } + { + utime_t start = ceph_clock_now(NULL); + unsigned val = ceph_crc32c(0xffffffff, (unsigned char *)a, len); + utime_t end = ceph_clock_now(NULL); + float rate = (float)len / (float)(1024*1024) / (float)(end - start); + std::cout << "best choice 0xffffffff = " << rate << " MB/sec" << std::endl; + ASSERT_EQ(3895876243u, val); + } + { + utime_t start = ceph_clock_now(NULL); + unsigned val = ceph_crc32c_sctp(0, (unsigned char *)a, len); + utime_t end = ceph_clock_now(NULL); + float rate = (float)len / (float)(1024*1024) / (float)(end - start); + std::cout << "sctp = " << rate << " MB/sec" << std::endl; + ASSERT_EQ(261108528u, val); + } + { + utime_t start = ceph_clock_now(NULL); + unsigned val = ceph_crc32c_intel_baseline(0, (unsigned char *)a, len); + utime_t end = ceph_clock_now(NULL); + float rate = (float)len / (float)(1024*1024) / (float)(end - start); + std::cout << "intel baseline = " << rate << " MB/sec" << std::endl; + ASSERT_EQ(261108528u, val); + } + +} diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index 44409ddbc52..fe17f077d8e 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -76,7 +76,7 @@ TYPE(ObjectStore::Transaction) #include "os/SequencerPosition.h" TYPE(SequencerPosition) -#include "os/hobject.h" +#include "common/hobject.h" TYPE(hobject_t) #include "mon/AuthMonitor.h" diff --git a/src/fooclass.cc b/src/test/fooclass.cc index 2db2d815bb0..2db2d815bb0 100644 --- a/src/fooclass.cc +++ b/src/test/fooclass.cc diff --git a/src/test/libcephfs/caps.cc b/src/test/libcephfs/caps.cc index 96f1a90024d..9fa92cf29dc 100644 --- a/src/test/libcephfs/caps.cc +++ b/src/test/libcephfs/caps.cc @@ -11,11 +11,11 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" #include "gtest/gtest.h" #include "include/cephfs/libcephfs.h" #include <linux/types.h> -#include <inttypes.h> #include "include/ceph_fs.h" #include <errno.h> #include <sys/fcntl.h> diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 562be6a6bcf..84bf3477aff 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -12,6 +12,7 @@ * */ +#include "include/int_types.h" #include "include/rados/librados.h" #include "include/rbd_types.h" #include "include/rbd/librbd.h" @@ -20,7 +21,6 @@ #include "gtest/gtest.h" #include <errno.h> -#include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> diff --git a/src/test/osd/ErasureCodeExample.h b/src/test/osd/ErasureCodeExample.h new file mode 100644 index 00000000000..896e614c6b5 --- /dev/null +++ b/src/test/osd/ErasureCodeExample.h @@ -0,0 +1,115 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#ifndef CEPH_ERASURE_CODE_EXAMPLE_H +#define CEPH_ERASURE_CODE_EXAMPLE_H + +#include <unistd.h> +#include <errno.h> +#include <sstream> +#include "osd/ErasureCodeInterface.h" + +#define DATA_CHUNKS 2u +#define CODING_CHUNKS 1u + +class ErasureCodeExample : public ErasureCodeInterface { +public: + useconds_t delay; + ErasureCodeExample(const map<std::string,std::string> ¶meters) : + delay(0) + { + if (parameters.find("usleep") != parameters.end()) { + std::istringstream ss(parameters.find("usleep")->second); + ss >> delay; + usleep(delay); + } + } + + virtual ~ErasureCodeExample() {} + + virtual int minimum_to_decode(const set<int> &want_to_read, + const set<int> &available_chunks, + set<int> *minimum) { + if (available_chunks.size() < DATA_CHUNKS) + return -EIO; + set<int>::iterator i; + unsigned j; + for (i = available_chunks.begin(), j = 0; j < DATA_CHUNKS; i++, j++) + minimum->insert(*i); + return 0; + } + + virtual int minimum_to_decode_with_cost(const set<int> &want_to_read, + const map<int, int> &available, + set<int> *minimum) { + set <int> available_chunks; + for (map<int, int>::const_iterator i = available.begin(); + i != available.end(); + i++) + available_chunks.insert(i->first); + return minimum_to_decode(want_to_read, available_chunks, minimum); + } + + virtual int encode(const set<int> &want_to_encode, + const bufferlist &in, + map<int, bufferlist> *encoded) { + unsigned chunk_length = ( in.length() / DATA_CHUNKS ) + 1; + unsigned length = chunk_length * ( DATA_CHUNKS + CODING_CHUNKS ); + bufferlist out(in); + bufferptr pad(length - in.length()); + pad.zero(0, DATA_CHUNKS); + out.push_back(pad); + char *p = out.c_str(); + for (unsigned i = 0; i < chunk_length * DATA_CHUNKS; i++) + p[i + 2 * chunk_length] = + p[i + 0 * chunk_length] ^ p[i + 1 * chunk_length]; + const bufferptr ptr = out.buffers().front(); + for (set<int>::iterator j = want_to_encode.begin(); + j != want_to_encode.end(); + j++) { + bufferptr chunk(ptr, (*j) * chunk_length, chunk_length); + (*encoded)[*j].push_front(chunk); + } + return 0; + } + + virtual int decode(const set<int> &want_to_read, + const map<int, bufferlist> &chunks, + map<int, bufferlist> *decoded) { + + unsigned chunk_length = (*chunks.begin()).second.length(); + for (set<int>::iterator i = want_to_read.begin(); + i != want_to_read.end(); + i++) { + if (chunks.find(*i) != chunks.end()) + (*decoded)[*i] = chunks.find(*i)->second; + else { + bufferptr chunk(chunk_length); + map<int, bufferlist>::const_iterator k = chunks.begin(); + const char *a = k->second.buffers().front().c_str(); + k++; + const char *b = k->second.buffers().front().c_str(); + for (unsigned j = 0; j < chunk_length; j++) { + chunk[j] = a[j] ^ b[j]; + } + (*decoded)[*i].push_front(chunk); + } + } + return 0; + } +}; + +#endif diff --git a/src/test/osd/ErasureCodePluginExample.cc b/src/test/osd/ErasureCodePluginExample.cc new file mode 100644 index 00000000000..1543b1cdaed --- /dev/null +++ b/src/test/osd/ErasureCodePluginExample.cc @@ -0,0 +1,34 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#include "osd/ErasureCodePlugin.h" +#include "ErasureCodeExample.h" + +class ErasureCodePluginExample : public ErasureCodePlugin { +public: + virtual int factory(const map<std::string,std::string> ¶meters, + ErasureCodeInterfaceRef *erasure_code) + { + *erasure_code = ErasureCodeInterfaceRef(new ErasureCodeExample(parameters)); + return 0; + } +}; + +int __erasure_code_init(char *plugin_name) +{ + ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); + return instance.add(plugin_name, new ErasureCodePluginExample()); +} diff --git a/src/test/osd/RadosModel.h b/src/test/osd/RadosModel.h index b9967d7af50..4f1aa4c3582 100644 --- a/src/test/osd/RadosModel.h +++ b/src/test/osd/RadosModel.h @@ -1,4 +1,6 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +#include "include/int_types.h" + #include "common/Mutex.h" #include "common/Cond.h" #include "include/rados/librados.hpp" @@ -15,7 +17,6 @@ #include <time.h> #include "Object.h" #include "TestOpStat.h" -#include "inttypes.h" #include "test/librados/test.h" #ifndef RADOSMODEL_H diff --git a/src/test/osd/TestErasureCodeExample.cc b/src/test/osd/TestErasureCodeExample.cc new file mode 100644 index 00000000000..66f521d7863 --- /dev/null +++ b/src/test/osd/TestErasureCodeExample.cc @@ -0,0 +1,146 @@ +// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#include "global/global_init.h" +#include "ErasureCodeExample.h" +#include "common/ceph_argparse.h" +#include "global/global_context.h" +#include "gtest/gtest.h" + +TEST(ErasureCodeExample, constructor) +{ + map<std::string,std::string> parameters; + { + ErasureCodeExample example(parameters); + EXPECT_EQ(0u, example.delay); + } + parameters["usleep"] = "10"; + { + ErasureCodeExample example(parameters); + EXPECT_EQ(10u, example.delay); + } +} + +TEST(ErasureCodeExample, minimum_to_decode) +{ + map<std::string,std::string> parameters; + ErasureCodeExample example(parameters); + set<int> available_chunks; + set<int> want_to_read; + want_to_read.insert(1); + { + set<int> minimum; + EXPECT_EQ(-EIO, example.minimum_to_decode(want_to_read, + available_chunks, + &minimum)); + } + available_chunks.insert(0); + available_chunks.insert(2); + { + set<int> minimum; + EXPECT_EQ(0, example.minimum_to_decode(want_to_read, + available_chunks, + &minimum)); + EXPECT_EQ(available_chunks, minimum); + EXPECT_EQ(2u, minimum.size()); + EXPECT_EQ(1u, minimum.count(0)); + EXPECT_EQ(1u, minimum.count(2)); + } + { + set<int> minimum; + available_chunks.insert(1); + EXPECT_EQ(0, example.minimum_to_decode(want_to_read, + available_chunks, + &minimum)); + EXPECT_EQ(2u, minimum.size()); + EXPECT_EQ(1u, minimum.count(0)); + EXPECT_EQ(1u, minimum.count(1)); + } +} + +TEST(ErasureCodeExample, encode_decode) +{ + map<std::string,std::string> parameters; + ErasureCodeExample example(parameters); + + bufferlist in; + in.append("ABCDE"); + int want_to_encode[] = { 0, 1, 2 }; + map<int, bufferlist> encoded; + EXPECT_EQ(0, example.encode(set<int>(want_to_encode, want_to_encode+3), + in, + &encoded)); + EXPECT_EQ(3u, encoded.size()); + EXPECT_EQ(3u, encoded[0].length()); + EXPECT_EQ('A', encoded[0][0]); + EXPECT_EQ('B', encoded[0][1]); + EXPECT_EQ('C', encoded[0][2]); + EXPECT_EQ('D', encoded[1][0]); + EXPECT_EQ('E', encoded[1][1]); + EXPECT_EQ('A'^'D', encoded[2][0]); + EXPECT_EQ('B'^'E', encoded[2][1]); + EXPECT_EQ('C'^0, encoded[2][2]); + + // all chunks are available + { + int want_to_decode[] = { 0, 1 }; + map<int, bufferlist> decoded; + EXPECT_EQ(0, example.decode(set<int>(want_to_decode, want_to_decode+2), + encoded, + &decoded)); + EXPECT_EQ(2u, decoded.size()); + EXPECT_EQ(3u, decoded[0].length()); + EXPECT_EQ('A', decoded[0][0]); + EXPECT_EQ('B', decoded[0][1]); + EXPECT_EQ('C', decoded[0][2]); + EXPECT_EQ('D', decoded[1][0]); + EXPECT_EQ('E', decoded[1][1]); + } + + // one chunk is missing + { + map<int, bufferlist> degraded = encoded; + degraded.erase(0); + EXPECT_EQ(2u, degraded.size()); + int want_to_decode[] = { 0, 1 }; + map<int, bufferlist> decoded; + EXPECT_EQ(0, example.decode(set<int>(want_to_decode, want_to_decode+2), + degraded, + &decoded)); + EXPECT_EQ(2u, decoded.size()); + EXPECT_EQ(3u, decoded[0].length()); + EXPECT_EQ('A', decoded[0][0]); + EXPECT_EQ('B', decoded[0][1]); + EXPECT_EQ('C', decoded[0][2]); + EXPECT_EQ('D', decoded[1][0]); + EXPECT_EQ('E', decoded[1][1]); + } +} + +int main(int argc, char **argv) { + vector<const char*> args; + argv_to_vec(argc, (const char **)argv, args); + + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + common_init_finish(g_ceph_context); + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + +// Local Variables: +// compile-command: "cd ../.. ; make -j4 && make unittest_erasure_code_example && ./unittest_erasure_code_example --gtest_filter=*.* --log-to-stderr=true --debug-osd=20" +// End: diff --git a/src/test/osd/TestErasureCodePluginExample.cc b/src/test/osd/TestErasureCodePluginExample.cc new file mode 100644 index 00000000000..67b41f2011a --- /dev/null +++ b/src/test/osd/TestErasureCodePluginExample.cc @@ -0,0 +1,51 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com> + * + * Author: Loic Dachary <loic@dachary.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + */ + +#include <errno.h> +#include "common/Thread.h" +#include "global/global_init.h" +#include "osd/ErasureCodePlugin.h" +#include "common/ceph_argparse.h" +#include "global/global_context.h" +#include "gtest/gtest.h" + +TEST(ErasureCodePluginRegistry, factory) +{ + map<std::string,std::string> parameters; + parameters["erasure-code-directory"] = ".libs"; + ErasureCodeInterfaceRef erasure_code; + ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance(); + EXPECT_FALSE(erasure_code); + EXPECT_EQ(0, instance.factory("example", parameters, &erasure_code)); + EXPECT_TRUE(erasure_code); + ErasureCodePlugin *plugin = 0; + EXPECT_EQ(-EEXIST, instance.load("example", parameters, &plugin)); +} + +int main(int argc, char **argv) { + vector<const char*> args; + argv_to_vec(argc, (const char **)argv, args); + + global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); + common_init_finish(g_ceph_context); + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + +// Local Variables: +// compile-command: "cd ../.. ; make -j4 && make unittest_erasure_code_plugin && ./unittest_erasure_code_plugin --gtest_filter=*.* --log-to-stderr=true --debug-osd=20" +// End: diff --git a/src/test/perf_counters.cc b/src/test/perf_counters.cc index d0b05f9f049..c44a15ef856 100644 --- a/src/test/perf_counters.cc +++ b/src/test/perf_counters.cc @@ -11,6 +11,10 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" +#include "include/types.h" // FIXME: ordering shouldn't be important, but right + // now, this include has to come before the others. + #include "common/perf_counters.h" #include "common/admin_socket_client.h" @@ -19,9 +23,6 @@ #include "common/errno.h" #include "common/safe_io.h" -#include "include/types.h" // FIXME: ordering shouldn't be important, but right - // now, this include has to come before the others. - #include "common/code_environment.h" #include "global/global_context.h" #include "global/global_init.h" @@ -30,7 +31,6 @@ #include <errno.h> #include <fcntl.h> -#include <inttypes.h> #include <map> #include <poll.h> #include <sstream> diff --git a/src/streamtest.cc b/src/test/streamtest.cc index 21693ac8713..21693ac8713 100644 --- a/src/streamtest.cc +++ b/src/test/streamtest.cc diff --git a/src/test/test_arch.c b/src/test/test_arch.c new file mode 100644 index 00000000000..549221e60f9 --- /dev/null +++ b/src/test/test_arch.c @@ -0,0 +1,19 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> + +#include "arch/probe.h" +#include "arch/intel.h" +#include "arch/neon.h" + +int main(int argc, char **argv) +{ + ceph_arch_probe(); + assert(ceph_arch_probed); + + printf("ceph_arch_intel_sse42 = %d\n", ceph_arch_intel_sse42); + printf("ceph_arch_neon = %d\n", ceph_arch_neon); + + return 0; +} diff --git a/src/test_trans.cc b/src/test/test_trans.cc index 43821c13aec..43821c13aec 100644 --- a/src/test_trans.cc +++ b/src/test/test_trans.cc diff --git a/src/testclass.cc b/src/test/testclass.cc index 22a97be6dcb..22a97be6dcb 100644 --- a/src/testclass.cc +++ b/src/test/testclass.cc diff --git a/src/testcrypto.cc b/src/test/testcrypto.cc index 0b7a9d54742..0b7a9d54742 100644 --- a/src/testcrypto.cc +++ b/src/test/testcrypto.cc diff --git a/src/testkeys.cc b/src/test/testkeys.cc index 27c38124ade..27c38124ade 100644 --- a/src/testkeys.cc +++ b/src/test/testkeys.cc diff --git a/src/testmsgr.cc b/src/test/testmsgr.cc index 4de779b5d7f..4de779b5d7f 100644 --- a/src/testmsgr.cc +++ b/src/test/testmsgr.cc diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am new file mode 100644 index 00000000000..4b8da77951a --- /dev/null +++ b/src/tools/Makefile.am @@ -0,0 +1,87 @@ +ceph_osdomap_tool_SOURCES = tools/ceph-osdomap-tool.cc +ceph_osdomap_tool_LDADD = $(LIBOS) $(CEPH_GLOBAL) -lboost_program_options +bin_DEBUGPROGRAMS += ceph-osdomap-tool + +ceph_monstore_tool_SOURCES = tools/ceph-monstore-tool.cc +ceph_monstore_tool_LDADD = $(LIBOS) $(CEPH_GLOBAL) -lboost_program_options +bin_DEBUGPROGRAMS += ceph-monstore-tool + +ceph_filestore_dump_SOURCES = tools/ceph-filestore-dump.cc +ceph_filestore_dump_LDADD = $(LIBOSD) $(LIBOS) $(CEPH_GLOBAL) -lboost_program_options +if LINUX +ceph_filestore_dump_LDADD += -ldl +endif # LINUX +bin_PROGRAMS += ceph_filestore_dump + +monmaptool_SOURCES = tools/monmaptool.cc +monmaptool_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += monmaptool + +crushtool_SOURCES = tools/crushtool.cc +crushtool_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += crushtool + +osdmaptool_SOURCES = tools/osdmaptool.cc +osdmaptool_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += osdmaptool + +ceph_scratchtool_SOURCES = tools/scratchtool.c +ceph_scratchtool_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_scratchtool + +ceph_scratchtoolpp_SOURCES = tools/scratchtoolpp.cc +ceph_scratchtoolpp_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_scratchtoolpp + +ceph_psim_SOURCES = tools/psim.cc +ceph_psim_LDADD = $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_psim + +ceph_dupstore_SOURCES = tools/dupstore.cc +ceph_dupstore_LDADD = $(LIBOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_dupstore + +ceph_radosacl_SOURCES = tools/radosacl.cc +ceph_radosacl_LDADD = $(LIBRADOS) $(CEPH_GLOBAL) +bin_DEBUGPROGRAMS += ceph_radosacl + +rados_SOURCES = \ + tools/rados/rados.cc \ + tools/rados/rados_import.cc \ + tools/rados/rados_export.cc \ + tools/rados/rados_sync.cc +rados_SOURCES += common/obj_bencher.cc # needs cleanup so it can go in libcommon.la +rados_LDADD = libcls_lock_client.la $(LIBRADOS) $(CEPH_GLOBAL) +bin_PROGRAMS += rados + +if WITH_REST_BENCH +rest_bench_SOURCES = tools/rest_bench.cc +rest_bench_SOURCES += common/obj_bencher.cc # needs cleanup so it can go in libcommon.la +rest_bench_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += rest-bench + +if WITH_SYSTEM_LIBS3 +rest_bench_LDADD += -ls3 +else +rest_bench_LDADD += libs3/build/lib/libs3.a -lcurl -lxml2 +rest_bench_CXXFLAGS = ${AM_CXXFLAGS} -I$(top_srcdir)/src/libs3/inc +SUBDIRS += libs3 +endif # WITH_SYSTEM_LIBS3 +endif # WITH_REST_BENCH + +ceph_conf_SOURCES = tools/ceph_conf.cc +ceph_conf_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += ceph-conf + +ceph_authtool_SOURCES = tools/ceph_authtool.cc +ceph_authtool_LDADD = $(CEPH_GLOBAL) +bin_PROGRAMS += ceph-authtool + +ceph_mon_store_converter_SOURCES = tools/mon_store_converter.cc +ceph_mon_store_converter_LDADD = $(LIBMON) $(LIBOS) $(CEPH_GLOBAL) +bin_PROGRAMS += ceph_mon_store_converter + +noinst_HEADERS += \ + tools/rados/rados_sync.h \ + tools/common.h + diff --git a/src/tools/ceph-filestore-dump.cc b/src/tools/ceph-filestore-dump.cc index 3badc2160b0..49b8d10bdba 100644 --- a/src/tools/ceph-filestore-dump.cc +++ b/src/tools/ceph-filestore-dump.cc @@ -1017,7 +1017,7 @@ int main(int argc, char **argv) ("pgid", po::value<string>(&pgidstr), "PG id, mandatory") ("type", po::value<string>(&type), - "Type which is 'info' or 'log', mandatory") + "Type one of info, log, export, or import, mandatory") ("file", po::value<string>(&file), "path of file to export or import") ("debug", "Enable diagnostic output to stderr") diff --git a/src/ceph_authtool.cc b/src/tools/ceph_authtool.cc index f66a3c66eee..f66a3c66eee 100644 --- a/src/ceph_authtool.cc +++ b/src/tools/ceph_authtool.cc diff --git a/src/ceph_conf.cc b/src/tools/ceph_conf.cc index b2286f4e094..b2286f4e094 100644 --- a/src/ceph_conf.cc +++ b/src/tools/ceph_conf.cc diff --git a/src/crushtool.cc b/src/tools/crushtool.cc index 75c26c098b6..03c83f24156 100644 --- a/src/crushtool.cc +++ b/src/tools/crushtool.cc @@ -569,7 +569,11 @@ int main(int argc, const char **argv) crush_bucket *b = crush_make_bucket(buckettype, CRUSH_HASH_DEFAULT, type, j, items, weights); assert(b); - int id = crush_add_bucket(crush.crush, 0, b); + int id; + int r = crush_add_bucket(crush.crush, 0, b, &id); + if (r < 0) { + dout(0) << "Couldn't add root bucket: " << strerror(-r) << dendl; + } rootid = id; char format[20]; diff --git a/src/dupstore.cc b/src/tools/dupstore.cc index e17eb2201a7..e17eb2201a7 100644 --- a/src/dupstore.cc +++ b/src/tools/dupstore.cc diff --git a/src/mon_store_converter.cc b/src/tools/mon_store_converter.cc index 1c0d3af98e2..1c0d3af98e2 100644 --- a/src/mon_store_converter.cc +++ b/src/tools/mon_store_converter.cc diff --git a/src/monmaptool.cc b/src/tools/monmaptool.cc index 57843aa350d..57843aa350d 100644 --- a/src/monmaptool.cc +++ b/src/tools/monmaptool.cc diff --git a/src/osdmaptool.cc b/src/tools/osdmaptool.cc index 2e55026076c..2e55026076c 100644 --- a/src/osdmaptool.cc +++ b/src/tools/osdmaptool.cc diff --git a/src/psim.cc b/src/tools/psim.cc index c1adc7580fb..c1adc7580fb 100644 --- a/src/psim.cc +++ b/src/tools/psim.cc diff --git a/src/rados.cc b/src/tools/rados/rados.cc index dd9b4de1794..e8386959349 100644 --- a/src/rados.cc +++ b/src/tools/rados/rados.cc @@ -879,7 +879,8 @@ protected: } public: - RadosBencher(librados::Rados& _r, librados::IoCtx& _i) : completions(NULL), rados(_r), io_ctx(_i), iterator_valid(false) {} + RadosBencher(CephContext *cct_, librados::Rados& _r, librados::IoCtx& _i) + : ObjBencher(cct_), completions(NULL), rados(_r), io_ctx(_i), iterator_valid(false) {} ~RadosBencher() { } }; @@ -1987,7 +1988,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, operation = OP_RAND_READ; else usage_exit(); - RadosBencher bencher(rados, io_ctx); + RadosBencher bencher(g_ceph_context, rados, io_ctx); bencher.set_show_time(show_time); ret = bencher.aio_bench(operation, seconds, num_objs, concurrent_ios, op_size, cleanup); @@ -1998,7 +1999,7 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts, if (!pool_name || nargs.size() < 2) usage_exit(); const char *prefix = nargs[1]; - RadosBencher bencher(rados, io_ctx); + RadosBencher bencher(g_ceph_context, rados, io_ctx); ret = bencher.clean_up(prefix, concurrent_ios); if (ret != 0) cerr << "error during cleanup: " << ret << std::endl; diff --git a/src/rados_export.cc b/src/tools/rados/rados_export.cc index 5b8a899d3b8..bf6654114c5 100644 --- a/src/rados_export.cc +++ b/src/tools/rados/rados_export.cc @@ -11,6 +11,7 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" #include "rados_sync.h" #include "common/errno.h" @@ -20,7 +21,6 @@ #include <dirent.h> #include <errno.h> #include <fstream> -#include <inttypes.h> #include <iostream> #include <sstream> #include <stdlib.h> diff --git a/src/rados_import.cc b/src/tools/rados/rados_import.cc index da968a7cc50..a6a398d767b 100644 --- a/src/rados_import.cc +++ b/src/tools/rados/rados_import.cc @@ -11,11 +11,11 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" #include <dirent.h> #include <errno.h> #include <fstream> -#include <inttypes.h> #include <iostream> #include <sstream> #include <stdlib.h> diff --git a/src/rados_sync.cc b/src/tools/rados/rados_sync.cc index d16894c6ea9..03293d3402a 100644 --- a/src/rados_sync.cc +++ b/src/tools/rados/rados_sync.cc @@ -11,6 +11,7 @@ * Foundation. See file COPYING. * */ +#include "include/int_types.h" #include "common/ceph_argparse.h" #include "common/config.h" @@ -27,7 +28,6 @@ #include <dirent.h> #include <errno.h> #include <fstream> -#include <inttypes.h> #include <iostream> #include <memory> #include <sstream> diff --git a/src/rados_sync.h b/src/tools/rados/rados_sync.h index 0f7226e0239..0f7226e0239 100644 --- a/src/rados_sync.h +++ b/src/tools/rados/rados_sync.h diff --git a/src/radosacl.cc b/src/tools/radosacl.cc index d2f7ca5c488..d2f7ca5c488 100644 --- a/src/radosacl.cc +++ b/src/tools/radosacl.cc diff --git a/src/tools/rest_bench.cc b/src/tools/rest_bench.cc index 99fd16b5a34..feea4de4932 100644 --- a/src/tools/rest_bench.cc +++ b/src/tools/rest_bench.cc @@ -261,10 +261,12 @@ class RESTDispatcher { } req_wq; public: - RESTDispatcher(CephContext *cct, int num_threads) - : m_tp(cct, "RESTDispatcher::m_tp", num_threads), - req_wq(this, g_conf->rgw_op_thread_timeout, - g_conf->rgw_op_thread_suicide_timeout, &m_tp) { + CephContext *cct; + RESTDispatcher(CephContext *cct_, int num_threads) + : m_tp(cct_, "RESTDispatcher::m_tp", num_threads), + req_wq(this, cct_->_conf->rgw_op_thread_timeout, + cct_->_conf->rgw_op_thread_suicide_timeout, &m_tp), + cct(cct_) { response_handler.propertiesCallback = properties_callback; @@ -588,6 +590,7 @@ protected: public: RESTBencher(RESTDispatcher *_dispatcher) : + ObjBencher(_dispatcher->cct), dispatcher(_dispatcher), completions(NULL), list_start(NULL), diff --git a/src/scratchtool.c b/src/tools/scratchtool.c index 22cf2bdf531..22cf2bdf531 100644 --- a/src/scratchtool.c +++ b/src/tools/scratchtool.c diff --git a/src/scratchtoolpp.cc b/src/tools/scratchtoolpp.cc index 62096920300..62096920300 100644 --- a/src/scratchtoolpp.cc +++ b/src/tools/scratchtoolpp.cc |