From f785f55b68ac121fcaddc93471432197a1a0dd3d Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 9 Nov 2016 09:36:06 -0500 Subject: [PATCH] client: change "is_delay" parameter in check_caps to "no_delay" Currently, when "is_delay" is true, we send the caps immediately. When it's false, we delay them. This seems backward to me and is highly confusing. Sage says: "It's definitely confusing. the call site that motivated the naming is the one from tick(), that passes true ... for the delayed flush that forces them to be sent but lots of other callers set it to true to avoid delaying. It could use a rename/cleanup." Let's change the name to "no_delay" to indicate that the caller wants to send caps immediately instead of delaying them. Signed-off-by: Jeff Layton --- src/client/Client.cc | 19 ++++++++++++++----- src/client/Client.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 8d900d15cfc..aa9a12d4210 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -3283,7 +3283,16 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap, } -void Client::check_caps(Inode *in, bool is_delayed) +/** + * check_caps + * + * Examine currently used and wanted versus held caps. Release, flush or ack + * revoked caps to the MDS as appropriate. + * + * @param in the inode to check + * @param no_delay whether we should delay sending caps + */ +void Client::check_caps(Inode *in, bool no_delay) { unsigned wanted = in->caps_wanted(); unsigned used = get_caps_used(in); @@ -3313,7 +3322,7 @@ void Client::check_caps(Inode *in, bool is_delayed) << " used " << ccap_string(used) << " issued " << ccap_string(issued) << " revoking " << ccap_string(revoking) - << " is_delayed=" << is_delayed + << " no_delay=" << no_delay << dendl; if (in->snapid != CEPH_NOSNAP) @@ -3329,10 +3338,10 @@ void Client::check_caps(Inode *in, bool is_delayed) if (!in->cap_snaps.empty()) flush_snaps(in); - if (!is_delayed) - cap_delay_requeue(in); - else + if (no_delay) in->hold_caps_until = utime_t(); + else + cap_delay_requeue(in); utime_t now = ceph_clock_now(cct); diff --git a/src/client/Client.h b/src/client/Client.h index 70f764251bf..736c9fc9b70 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -651,7 +651,7 @@ protected: void send_cap(Inode *in, MetaSession *session, Cap *cap, int used, int want, int retain, int flush, ceph_tid_t flush_tid); - void check_caps(Inode *in, bool is_delayed); + void check_caps(Inode *in, bool immediate); void get_cap_ref(Inode *in, int cap); void put_cap_ref(Inode *in, int cap); void flush_snaps(Inode *in, bool all_again=false); -- 2.39.5