mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
Merge PR #51383 into main
* refs/pull/51383/head: client: clean up the queue_cap_snap() code to remove unnecessary check client: always add one new capsnap if Fb is used and Fw is not used Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
923e7bacc9
@ -3580,7 +3580,7 @@ void Client::put_cap_ref(Inode *in, int cap)
|
||||
int put_nref = 0;
|
||||
int drop = last & ~in->caps_issued();
|
||||
if (in->snapid == CEPH_NOSNAP) {
|
||||
if ((last & (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER)) &&
|
||||
if ((last & CEPH_CAP_FILE_WR) &&
|
||||
!in->cap_snaps.empty() &&
|
||||
in->cap_snaps.rbegin()->second.writing) {
|
||||
ldout(cct, 10) << __func__ << " finishing pending cap_snap on " << *in << dendl;
|
||||
@ -3594,6 +3594,10 @@ void Client::put_cap_ref(Inode *in, int cap)
|
||||
signal_cond_list(in->waitfor_commit);
|
||||
ldout(cct, 5) << __func__ << " dropped last FILE_BUFFER ref on " << *in << dendl;
|
||||
++put_nref;
|
||||
|
||||
if (!in->cap_snaps.empty()) {
|
||||
flush_snaps(in);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last & CEPH_CAP_FILE_CACHE) {
|
||||
@ -4054,15 +4058,13 @@ void Client::queue_cap_snap(Inode *in, SnapContext& old_snapc)
|
||||
in->cap_snaps.rbegin()->second.writing) {
|
||||
ldout(cct, 10) << __func__ << " already have pending cap_snap on " << *in << dendl;
|
||||
return;
|
||||
} else if (in->caps_dirty() ||
|
||||
(used & CEPH_CAP_FILE_WR) ||
|
||||
(dirty & CEPH_CAP_ANY_WR)) {
|
||||
} else if (dirty || (used & CEPH_CAP_FILE_WR)) {
|
||||
const auto &capsnapem = in->cap_snaps.emplace(std::piecewise_construct, std::make_tuple(old_snapc.seq), std::make_tuple(in));
|
||||
ceph_assert(capsnapem.second); /* element inserted */
|
||||
CapSnap &capsnap = capsnapem.first->second;
|
||||
capsnap.context = old_snapc;
|
||||
capsnap.issued = in->caps_issued();
|
||||
capsnap.dirty = in->caps_dirty();
|
||||
capsnap.dirty = dirty;
|
||||
|
||||
capsnap.dirty_data = (used & CEPH_CAP_FILE_BUFFER);
|
||||
|
||||
@ -4109,9 +4111,11 @@ void Client::finish_cap_snap(Inode *in, CapSnap &capsnap, int used)
|
||||
}
|
||||
|
||||
if (used & CEPH_CAP_FILE_BUFFER) {
|
||||
capsnap.writing = 1;
|
||||
ldout(cct, 10) << __func__ << " " << *in << " cap_snap " << &capsnap << " used " << used
|
||||
<< " WRBUFFER, delaying" << dendl;
|
||||
<< " WRBUFFER, trigger to flush dirty buffer" << dendl;
|
||||
|
||||
/* trigger to flush the buffer */
|
||||
_flush(in, new C_Client_FlushComplete(this, in));
|
||||
} else {
|
||||
capsnap.dirty_data = 0;
|
||||
flush_snaps(in);
|
||||
|
Loading…
Reference in New Issue
Block a user