summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-24 21:46:47 -0700
committerSage Weil <sage@inktank.com>2013-09-24 21:46:47 -0700
commit952b39d4c4fcd1492234fcdba320895e4e520af5 (patch)
treefe614cb2ad6109c2034c3771a2d8ec3a32b07488
parentc9e7e2f750cc6919959f2fd7351fa047b4c85a94 (diff)
parent3de32562b55c6ece3a6ed783c36f8b9f21460339 (diff)
downloadceph-952b39d4c4fcd1492234fcdba320895e4e520af5.tar.gz
Merge remote-tracking branch 'gh/next'
Conflicts: src/osd/ReplicatedPG.cc
-rwxr-xr-xqa/workunits/mon/crush_ops.sh9
-rw-r--r--src/arch/intel.c7
-rw-r--r--src/common/config_opts.h2
-rw-r--r--src/common/crc32c_intel_fast.h2
-rw-r--r--src/mon/OSDMonitor.cc31
-rw-r--r--src/osd/ReplicatedPG.cc3
-rw-r--r--src/test/librados/misc.cc24
7 files changed, 54 insertions, 24 deletions
diff --git a/qa/workunits/mon/crush_ops.sh b/qa/workunits/mon/crush_ops.sh
index 09e49acfbf6..c2744fa279d 100755
--- a/qa/workunits/mon/crush_ops.sh
+++ b/qa/workunits/mon/crush_ops.sh
@@ -68,4 +68,13 @@ ceph osd crush add-bucket foo host
ceph osd crush move foo root=default rack=localrack
ceph osd crush rm foo
+# test reweight
+o3=`ceph osd create`
+ceph osd crush add $o3 123 root=foo
+ceph osd tree | grep osd.$o3 | grep 123
+ceph osd crush reweight osd.$o3 113
+ceph osd tree | grep osd.$o3 | grep 113
+ceph osd crush rm osd.$o3
+ceph osd rm osd.$o3
+
echo OK
diff --git a/src/arch/intel.c b/src/arch/intel.c
index 0513da53c23..8b2d2ccab12 100644
--- a/src/arch/intel.c
+++ b/src/arch/intel.c
@@ -4,8 +4,7 @@
int ceph_arch_intel_sse42 = 0;
-/* this probably isn't specific enough for x86_64? fix me someday */
-#ifdef __LP64__
+#ifdef __x86_64__
/* intel cpu? */
static void do_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx,
@@ -35,7 +34,7 @@ int ceph_arch_intel_probe(void)
return 0;
}
-#else // __LP64__
+#else // __x86_64__
int ceph_arch_intel_probe(void)
{
@@ -43,4 +42,4 @@ int ceph_arch_intel_probe(void)
return 0;
}
-#endif // __LP64__
+#endif // __x86_64__
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 1f616e2c970..1443fabdcd4 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -522,7 +522,7 @@ OPTION(osd_recovery_op_warn_multiple, OPT_U32, 16)
OPTION(osd_mon_shutdown_timeout, OPT_DOUBLE, 5)
OPTION(osd_max_object_size, OPT_U64, 100*1024L*1024L*1024L) // OSD's maximum object size
-OPTION(osd_max_attr_size, OPT_U64, 65536)
+OPTION(osd_max_attr_size, OPT_U64, 0)
OPTION(filestore, OPT_BOOL, false)
diff --git a/src/common/crc32c_intel_fast.h b/src/common/crc32c_intel_fast.h
index 7a394a0b82c..26a444f6061 100644
--- a/src/common/crc32c_intel_fast.h
+++ b/src/common/crc32c_intel_fast.h
@@ -8,7 +8,7 @@ extern "C" {
/* is the fast version compiled in */
extern int ceph_crc32c_intel_fast_exists(void);
-#ifdef __LP64__
+#ifdef __x86_64__
extern uint32_t ceph_crc32c_intel_fast(uint32_t crc, unsigned char const *buffer, unsigned len);
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index df614eedb92..f4fe49bf8de 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -179,32 +179,49 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
}
// walk through incrementals
- MonitorDBStore::Transaction t;
+ MonitorDBStore::Transaction *t = NULL;
+ size_t tx_size = 0;
while (version > osdmap.epoch) {
bufferlist inc_bl;
int err = get_version(osdmap.epoch+1, inc_bl);
assert(err == 0);
assert(inc_bl.length());
-
+
dout(7) << "update_from_paxos applying incremental " << osdmap.epoch+1 << dendl;
OSDMap::Incremental inc(inc_bl);
err = osdmap.apply_incremental(inc);
assert(err == 0);
+ if (t == NULL)
+ t = new MonitorDBStore::Transaction;
+
// write out the full map for all past epochs
bufferlist full_bl;
osdmap.encode(full_bl);
- put_version_full(&t, osdmap.epoch, full_bl);
+ tx_size += full_bl.length();
+
+ put_version_full(t, osdmap.epoch, full_bl);
+ put_version_latest_full(t, osdmap.epoch);
// share
dout(1) << osdmap << dendl;
if (osdmap.epoch == 1) {
- t.erase("mkfs", "osdmap");
+ t->erase("mkfs", "osdmap");
+ }
+
+ if (tx_size > g_conf->mon_sync_max_payload_size*2) {
+ mon->store->apply_transaction(*t);
+ delete t;
+ t = NULL;
+ tx_size = 0;
}
}
- if (!t.empty())
- mon->store->apply_transaction(t);
+
+ if (t != NULL) {
+ mon->store->apply_transaction(*t);
+ delete t;
+ }
for (int o = 0; o < osdmap.get_max_osd(); o++) {
if (osdmap.is_down(o)) {
@@ -3001,7 +3018,7 @@ bool OSDMonitor::prepare_command(MMonCommand *m)
cmd_getval(g_ceph_context, cmdmap, "weight", w);
err = newcrush.adjust_item_weightf(g_ceph_context, id, w);
- if (err == 0) {
+ if (err >= 0) {
pending_inc.crush.clear();
newcrush.encode(pending_inc.crush);
ss << "reweighted item id " << id << " name '" << name << "' to " << w
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 5cd5f538dbe..7d1738da572 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -2960,7 +2960,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
case CEPH_OSD_OP_SETXATTR:
++ctx->num_write;
{
- if (op.xattr.value_len > cct->_conf->osd_max_attr_size) {
+ if (cct->_conf->osd_max_attr_size > 0 &&
+ op.xattr.value_len > cct->_conf->osd_max_attr_size) {
result = -EFBIG;
break;
}
diff --git a/src/test/librados/misc.cc b/src/test/librados/misc.cc
index 803c8b1cc77..20847e7b8b9 100644
--- a/src/test/librados/misc.cc
+++ b/src/test/librados/misc.cc
@@ -538,21 +538,25 @@ TEST(LibRadosMisc, BigAttrPP) {
bufferlist got;
- bl.clear();
- got.clear();
- bl.append(buffer::create(g_conf->osd_max_attr_size));
- ASSERT_EQ(0, ioctx.setxattr("foo", "one", bl));
- ASSERT_EQ((int)bl.length(), ioctx.getxattr("foo", "one", got));
- ASSERT_TRUE(bl.contents_equal(got));
+ if (g_conf->osd_max_attr_size) {
+ bl.clear();
+ got.clear();
+ bl.append(buffer::create(g_conf->osd_max_attr_size));
+ ASSERT_EQ(0, ioctx.setxattr("foo", "one", bl));
+ ASSERT_EQ((int)bl.length(), ioctx.getxattr("foo", "one", got));
+ ASSERT_TRUE(bl.contents_equal(got));
- bl.clear();
- bl.append(buffer::create(g_conf->osd_max_attr_size+1));
- ASSERT_EQ(-EFBIG, ioctx.setxattr("foo", "one", bl));
+ bl.clear();
+ bl.append(buffer::create(g_conf->osd_max_attr_size+1));
+ ASSERT_EQ(-EFBIG, ioctx.setxattr("foo", "one", bl));
+ } else {
+ cout << "osd_max_attr_size == 0; skipping test" << std::endl;
+ }
for (int i=0; i<1000; i++) {
bl.clear();
got.clear();
- bl.append(buffer::create(g_conf->osd_max_attr_size));
+ bl.append(buffer::create(MIN(g_conf->osd_max_attr_size, 1024)));
char n[10];
snprintf(n, sizeof(n), "a%d", i);
ASSERT_EQ(0, ioctx.setxattr("foo", n, bl));