Merge remote-tracking branch 'origin/jewel'

This commit is contained in:
Josh Durgin 2015-12-21 16:59:51 -08:00
commit 09a3f69e6f
11 changed files with 74 additions and 67 deletions

View File

@ -30,8 +30,8 @@ function rebuild()
clear_all
echo Starting test $testno
((testno++))
rbd create $gen --size 100 --order $1 --stripe-unit $2 --stripe-count $3 --image-format $4
rbd create $out --size 1 --order 19
rbd create $gen --size 100 --object-size $1 --stripe-unit $2 --stripe-count $3 --image-format $4
rbd create $out --size 1 --object-size 524288
mkdir -p mnt diffs
# lttng has atexit handlers that need to be fork/clone aware
LD_PRELOAD=liblttng-ust-fork.so.0 rbd-fuse -p $pool mnt
@ -89,7 +89,7 @@ function check()
}
#test f/t header
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
snap a
write 1 1
@ -98,7 +98,7 @@ export_diff a head
merge_diff null a head
check null head
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
snap a
write 1 1
@ -110,7 +110,7 @@ export_diff b head
merge_diff null a b
check null b
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
snap a
write 1 1
@ -123,7 +123,7 @@ merge_diff a b head
check null a
check a head
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
snap a
write 1 1
@ -136,7 +136,7 @@ rbd merge-diff diffs/null.a diffs/a.b - | rbd merge-diff - diffs/b.head - > diff
check null head
#data test
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 4 2
snap s101
write 0 3
@ -147,7 +147,7 @@ export_diff s101 s102
merge_diff null s101 s102
check null s102
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 3
write 2 5
write 8 2
@ -160,7 +160,7 @@ export_diff s201 s202
merge_diff null s201 s202
check null s202
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 4
write 12 6
snap s301
@ -173,7 +173,7 @@ export_diff s301 s302
merge_diff null s301 s302
check null s302
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 12
write 14 2
write 18 2
@ -188,7 +188,7 @@ export_diff s401 s402
merge_diff null s401 s402
check null s402
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 2 4
write 10 12
write 27 6
@ -203,7 +203,7 @@ export_diff s501 s502
merge_diff null s501 s502
check null s502
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 8
resize 5
snap r1
@ -220,7 +220,7 @@ merge_diff null r1 r2
merge_diff null r2 r3
check null r3
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 8
resize 5
snap r1
@ -242,7 +242,7 @@ merge_diff null r3 r4
check null r4
# merge diff doesn't yet support fancy striping
# rebuild 22 65536 8 2
# rebuild 4194304 65536 8 2
# write 0 32
# snap r1
# write 16 32
@ -251,7 +251,7 @@ check null r4
# export_diff r1 r2
# expect_false merge_diff null r1 r2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
write 2 1
write 4 1
@ -266,7 +266,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 1 1
write 3 1
write 5 1
@ -281,7 +281,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 3
write 6 3
write 12 3
@ -295,7 +295,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 3
write 6 3
write 12 3
@ -309,7 +309,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 3
write 6 3
write 12 3
@ -323,7 +323,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 1 1
write 7 1
write 13 1
@ -337,7 +337,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 1
write 6 1
write 12 1
@ -351,7 +351,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 2 1
write 8 1
write 14 1
@ -365,7 +365,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 3
write 6 3
write 12 3
@ -379,7 +379,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 2 4
write 8 4
write 14 4
@ -393,7 +393,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 4
write 6 4
write 12 4
@ -407,7 +407,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 6
write 6 6
write 12 6
@ -421,7 +421,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 3 6
write 9 6
write 15 6
@ -435,7 +435,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 8
snap s1
resize 2
@ -446,7 +446,7 @@ export_diff s1 s2
merge_diff null s1 s2
check null s2
rebuild 22 4194304 1 2
rebuild 4194304 4194304 1 2
write 0 8
snap s1
resize 2

View File

@ -248,23 +248,28 @@ void AbstractAioImageWrite::send_request() {
!m_image_ctx.journal->is_journal_replaying());
}
if (!object_extents.empty()) {
m_aio_comp->set_request_count(
cct, object_extents.size() + get_cache_request_count(journaling));
m_aio_comp->set_request_count(
m_image_ctx.cct, object_extents.size() +
get_cache_request_count(journaling));
AioObjectRequests requests;
send_object_requests(object_extents, snapc,
(journaling ? &requests : nullptr));
AioObjectRequests requests;
send_object_requests(object_extents, snapc, (journaling ? &requests : NULL));
if (journaling) {
// in-flight ops are flushed prior to closing the journal
assert(m_image_ctx.journal != NULL);
journal_tid = append_journal_event(requests, m_synchronous);
}
if (journaling) {
// in-flight ops are flushed prior to closing the journal
assert(m_image_ctx.journal != NULL);
journal_tid = append_journal_event(requests, m_synchronous);
if (m_image_ctx.object_cacher != NULL) {
send_cache_requests(object_extents, journal_tid);
}
} else {
// no IO to perform -- fire completion
m_aio_comp->unblock(cct);
}
if (m_image_ctx.object_cacher != NULL) {
send_cache_requests(object_extents, journal_tid);
}
update_stats(clip_len);
m_aio_comp->put();
}
@ -375,7 +380,7 @@ uint64_t AioImageDiscard::append_journal_event(
uint32_t AioImageDiscard::get_cache_request_count(bool journaling) const {
// extra completion request is required for tracking journal commit
return (journaling ? 1 : 0);
return (m_image_ctx.object_cacher != nullptr && journaling ? 1 : 0);
}
void AioImageDiscard::send_cache_requests(const ObjectExtents &object_extents,

View File

@ -6,6 +6,7 @@
#include "common/errno.h"
#include "common/Mutex.h"
#include "common/RWLock.h"
#include "common/WorkQueue.h"
#include "librbd/AioObjectRequest.h"
#include "librbd/AioCompletion.h"
@ -205,16 +206,16 @@ namespace librbd {
ldout(m_ictx->cct, 20) << "send " << this << " " << m_oid << " "
<< m_object_off << "~" << m_object_len << dendl;
// send read request to parent if the object doesn't exist locally
bool non_existent = false;
{
RWLock::RLocker snap_locker(m_ictx->snap_lock);
non_existent = (m_ictx->object_map != nullptr &&
!m_ictx->object_map->object_may_exist(m_object_no));
}
if (non_existent) {
complete(-ENOENT);
return;
// send read request to parent if the object doesn't exist locally
if (m_ictx->object_map != nullptr &&
!m_ictx->object_map->object_may_exist(m_object_no)) {
m_ictx->op_work_queue->queue(util::create_context_callback<
AioObjectRequest>(this), -ENOENT);
return;
}
}
librados::ObjectReadOperation op;

View File

@ -434,6 +434,7 @@ template <typename I>
void ExclusiveLock<I>::send_shutdown() {
assert(m_lock.is_locked());
if (m_state == STATE_UNLOCKED) {
m_state = STATE_SHUTTING_DOWN;
m_image_ctx.aio_work_queue->unblock_writes();
m_image_ctx.op_work_queue->queue(util::create_context_callback<
ExclusiveLock<I>, &ExclusiveLock<I>::complete_shutdown>(this), 0);

View File

@ -869,6 +869,7 @@ struct C_InvalidateCache : public Context {
}
void ImageCtx::flush_copyup(Context *on_finish) {
on_finish = util::create_async_context_callback(*this, on_finish);
if (copyup_finisher == nullptr) {
on_finish->complete(0);
return;

View File

@ -5,8 +5,8 @@
#include "common/ceph_context.h"
#include "common/dout.h"
#include "common/Finisher.h"
#include "common/Mutex.h"
#include "common/WorkQueue.h"
#include "include/Context.h"
#include "include/rados/librados.hpp"
#include "include/rbd/librbd.hpp"
@ -168,14 +168,7 @@ namespace librbd {
};
LibrbdWriteback::LibrbdWriteback(ImageCtx *ictx, Mutex& lock)
: m_finisher(new Finisher(ictx->cct)), m_tid(0), m_lock(lock), m_ictx(ictx)
{
m_finisher->start();
}
LibrbdWriteback::~LibrbdWriteback() {
m_finisher->stop();
delete m_finisher;
: m_tid(0), m_lock(lock), m_ictx(ictx) {
}
void LibrbdWriteback::read(const object_t& oid, uint64_t object_no,
@ -192,7 +185,7 @@ namespace librbd {
RWLock::RLocker snap_locker(m_ictx->snap_lock);
if (m_ictx->object_map != nullptr &&
!m_ictx->object_map->object_may_exist(object_no)) {
m_finisher->queue(req, -ENOENT);
m_ictx->op_work_queue->queue(req, -ENOENT);
return;
}
}

View File

@ -11,7 +11,6 @@
#include "osd/osd_types.h"
#include "osdc/WritebackHandler.h"
class Finisher;
class Mutex;
namespace librbd {
@ -21,7 +20,6 @@ namespace librbd {
class LibrbdWriteback : public WritebackHandler {
public:
LibrbdWriteback(ImageCtx *ictx, Mutex& lock);
virtual ~LibrbdWriteback();
// Note that oloc, trunc_size, and trunc_seq are ignored
virtual void read(const object_t& oid, uint64_t object_no,
@ -63,7 +61,6 @@ namespace librbd {
private:
void complete_writes(const std::string& oid);
Finisher *m_finisher;
ceph_tid_t m_tid;
Mutex& m_lock;
librbd::ImageCtx *m_ictx;

View File

@ -185,6 +185,11 @@ void CloseRequest<I>::handle_shut_down_cache(int r) {
template <typename I>
void CloseRequest<I>::send_flush_copyup() {
if (m_image_ctx->copyup_finisher == nullptr) {
send_flush_op_work_queue();
return;
}
CephContext *cct = m_image_ctx->cct;
ldout(cct, 10) << this << " " << __func__ << dendl;
@ -196,6 +201,8 @@ template <typename I>
void CloseRequest<I>::handle_flush_copyup(int r) {
CephContext *cct = m_image_ctx->cct;
ldout(cct, 10) << this << " " << __func__ << ": r=" << r << dendl;
m_image_ctx->copyup_finisher->stop();
send_flush_op_work_queue();
}

View File

@ -49,8 +49,8 @@ private:
* SHUTDOWN_CACHE
* |
* v
* FLUSH_COPYUP
* |
* FLUSH_COPYUP (skip if copyup
* | disabled)
* v
* FLUSH_OP_WORK_QUEUE . . . . .
* | .

View File

@ -256,7 +256,7 @@ void Log::_flush(EntryQueue *t, EntryQueue *requeue, bool crash)
}
if (do_syslog) {
syslog(LOG_USER, "%s", buf);
syslog(LOG_USER|LOG_DEBUG, "%s", buf);
}
if (do_stderr) {
@ -284,7 +284,7 @@ void Log::_log_message(const char *s, bool crash)
cerr << "problem writing to " << m_log_file << ": " << cpp_strerror(r) << std::endl;
}
if ((crash ? m_syslog_crash : m_syslog_log) >= 0) {
syslog(LOG_USER, "%s", s);
syslog(LOG_USER|LOG_DEBUG, "%s", s);
}
if ((crash ? m_stderr_crash : m_stderr_log) >= 0) {

View File

@ -12,6 +12,7 @@
#include "test/librbd/mock/MockObjectMap.h"
#include "test/librbd/mock/MockReadahead.h"
#include "common/RWLock.h"
#include "common/WorkQueue.h"
#include "librbd/ImageCtx.h"
#include "gmock/gmock.h"
@ -56,6 +57,7 @@ struct MockImageCtx {
~MockImageCtx() {
wait_for_async_requests();
image_ctx->op_work_queue->drain();
delete image_watcher;
delete op_work_queue;
delete aio_work_queue;