New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cephfs-journal-tool: enable purge_queue journal's event commands #23467
cephfs-journal-tool: enable purge_queue journal's event commands #23467
Conversation
8dca3e9
to
300f2f5
Compare
src/mds/PurgeQueue.cc
Outdated
decode(stamp, p); | ||
decode(pad_size, p); | ||
p.advance(pad_size); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
encoding action/ino/size after padding. does this work for JournalTool::erase_region
enoop = ENoOp(padding); | ||
enoop.encode_with_header(entry, CEPH_FEATURES_SUPPORTED_DEFAULT); | ||
} else if (type == "purge_queue") { | ||
pi.pad_size = padding; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ukernel yes, when calculating pad_size, all the space occupied by other fields are excluded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENoOp has not action/ino/size, why the ways to calculate padding are the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the way to calculate padding is to exclude the length of a purgeitem/logevent whose pad_size is 0 which include action/ino/size if the purgeitem/logevent has such fields
src/mds/PurgeQueue.h
Outdated
@@ -45,11 +50,35 @@ class PurgeItem | |||
fragtree_t fragtree; | |||
|
|||
PurgeItem() | |||
: action(NONE), ino(0), size(0) | |||
: stamp(ceph_clock_now()), pad_size(0), action(NONE), ino(0), size(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stamp(ceph_clock_now()) wastes cpu cycle when reading purge queue item from journal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok:-) I'll correct that:-).
BTW, I see you removed the last comment, is there anything wrong?
300f2f5
to
031670a
Compare
@ukernel Hi, I've just modified the code as you suggested, please take a look:-) |
src/mds/PurgeQueue.cc
Outdated
uint8_t static const pad = 0xff; | ||
for (unsigned int i = 0; i<pad_size; i++) { | ||
encode(pad, bl); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void PurgeItem::encode(bufferlist &bl) const
{
ENCODE_START(2, 1, bl);
encode((uint8_t)action, bl);
encode(ino, bl);
encode(size, bl);
encode(layout, bl, CEPH_FEATURE_FS_FILE_LAYOUT_V2);
encode(old_pools, bl);
encode(snapc, bl);
encode(fragtree, bl);
encode(stamp, bl);
uint8_t static const pad = 0xff;
for (unsigned int i = 0; i<pad_size; i++) {
encode(pad, bl);
}
ENCODE_FINISH(bl);
}
We can keep backward compatibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes:-)
031670a
to
3179374
Compare
src/mds/PurgeQueue.cc
Outdated
void PurgeItem::encode(bufferlist &bl) const | ||
{ | ||
ENCODE_START(1, 1, bl); | ||
ENCODE_START(2, 2, bl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2, 1
Resolves: http://tracker.ceph.com/issues/24604 Signed-off-by: Xuehan Xu <xuxuehan@360.cn>
3179374
to
5582fae
Compare
@ukernel Hi, thanks for the review. Required changes are done:-) Please take a look:-) |
retest this please |
* refs/pull/23467/head: cephfs-journal-tool: enable purge_queue journal's event commands Reviewed-by: Zheng Yan <zyan@redhat.com>
A new PR with increased struct version of PurgeItem for PR #22850
Resolves: http://tracker.ceph.com/issues/24604
Signed-off-by: Xuehan Xu xuxuehan@360.cn