CEPH filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: xiubli@redhat.com, idryomov@gmail.com
Cc: sage@redhat.com, zyan@redhat.com, pdonnell@redhat.com,
	ceph-devel@vger.kernel.org
Subject: Re: [PATCH v9 2/5] ceph: add caps perf metric for each session
Date: Mon, 09 Mar 2020 08:05:57 -0400	[thread overview]
Message-ID: <215d32cb86ead14dea44e74f5ac75f569349a794.camel@kernel.org> (raw)
In-Reply-To: <16b9a2a5bfbd8802ce2f2c435aba7331cd1adb35.camel@kernel.org>

On Mon, 2020-03-09 at 07:51 -0400, Jeff Layton wrote:
> On Mon, 2020-03-09 at 03:37 -0400, xiubli@redhat.com wrote:
> > From: Xiubo Li <xiubli@redhat.com>
> > 
> > This will fulfill the cap hit/mis metric stuff per-superblock,
> > it will count the hit/mis counters based each inode, and if one
> > inode's 'issued & ~revoking == mask' will mean a hit, or a miss.
> > 
> > item          total           miss            hit
> > -------------------------------------------------
> > caps          295             107             4119
> > 
> > URL: https://tracker.ceph.com/issues/43215
> > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> > ---
> >  fs/ceph/acl.c        |  2 +-
> >  fs/ceph/caps.c       | 19 +++++++++++++++++++
> >  fs/ceph/debugfs.c    | 16 ++++++++++++++++
> >  fs/ceph/dir.c        |  5 +++--
> >  fs/ceph/inode.c      |  4 ++--
> >  fs/ceph/mds_client.c | 26 ++++++++++++++++++++++----
> >  fs/ceph/metric.h     | 13 +++++++++++++
> >  fs/ceph/super.h      |  8 +++++---
> >  fs/ceph/xattr.c      |  4 ++--
> >  9 files changed, 83 insertions(+), 14 deletions(-)
> > 
> > diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
> > index 26be652..e046574 100644
> > --- a/fs/ceph/acl.c
> > +++ b/fs/ceph/acl.c
> > @@ -22,7 +22,7 @@ static inline void ceph_set_cached_acl(struct inode *inode,
> >  	struct ceph_inode_info *ci = ceph_inode(inode);
> >  
> >  	spin_lock(&ci->i_ceph_lock);
> > -	if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 0))
> > +	if (__ceph_caps_issued_mask_metric(ci, CEPH_CAP_XATTR_SHARED, 0))
> >  		set_cached_acl(inode, type, acl);
> >  	else
> >  		forget_cached_acl(inode, type);
> > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> > index 342a32c..efaeb67 100644
> > --- a/fs/ceph/caps.c
> > +++ b/fs/ceph/caps.c
> > @@ -912,6 +912,20 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
> >  	return 0;
> >  }
> >  
> > +int __ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, int mask,
> > +				   int touch)
> > +{
> > +	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->vfs_inode.i_sb);
> > +	int r;
> > +
> > +	r = __ceph_caps_issued_mask(ci, mask, touch);
> > +	if (r)
> > +		ceph_update_cap_hit(&fsc->mdsc->metric);
> > +	else
> > +		ceph_update_cap_mis(&fsc->mdsc->metric);
> > +	return r;
> > +}
> > +
> >  /*
> >   * Return true if mask caps are currently being revoked by an MDS.
> >   */
> > @@ -2680,6 +2694,11 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
> >  	if (snap_rwsem_locked)
> >  		up_read(&mdsc->snap_rwsem);
> >  
> > +	if (!ret)
> > +		ceph_update_cap_mis(&mdsc->metric);
> 
> Should a negative error code here also mean a miss?
> 
> > +	else if (ret == 1)
> > +		ceph_update_cap_hit(&mdsc->metric);
> > +
> >  	dout("get_cap_refs %p ret %d got %s\n", inode,
> >  	     ret, ceph_cap_string(*got));
> >  	return ret;

Here's what I'd propose on top. If this looks ok, then I can just fold
this patch into yours before merging. No need to resend just for this.

----------------8<----------------

[PATCH] SQUASH: count negative error code as miss in try_get_cap_refs

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/caps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index efaeb67d584c..3be928782b45 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2694,9 +2694,9 @@ static int try_get_cap_refs(struct inode *inode,
int need, int want,
 	if (snap_rwsem_locked)
 		up_read(&mdsc->snap_rwsem);
 
-	if (!ret)
+	if (ret <= 0)
 		ceph_update_cap_mis(&mdsc->metric);
-	else if (ret == 1)
+	else
 		ceph_update_cap_hit(&mdsc->metric);
 
 	dout("get_cap_refs %p ret %d got %s\n", inode,
-- 
2.24.1

  reply	other threads:[~2020-03-09 12:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09  7:37 [PATCH v9 0/5] ceph: add perf metrics support xiubli
2020-03-09  7:37 ` [PATCH v9 1/5] ceph: add global dentry lease metric support xiubli
2020-03-09  7:37 ` [PATCH v9 2/5] ceph: add caps perf metric for each session xiubli
2020-03-09 11:51   ` Jeff Layton
2020-03-09 12:05     ` Jeff Layton [this message]
2020-03-09 12:36       ` Xiubo Li
2020-03-09 18:22         ` Jeff Layton
2020-03-10  0:25           ` Xiubo Li
2020-03-09 12:26     ` Xiubo Li
2020-03-09  7:37 ` [PATCH v9 3/5] ceph: add global read latency metric support xiubli
2020-03-09  7:37 ` [PATCH v9 4/5] ceph: add global write " xiubli
2020-03-09  7:37 ` [PATCH v9 5/5] ceph: add global metadata perf " xiubli
2020-03-09 12:09 ` [PATCH v9 0/5] ceph: add perf metrics support Jeff Layton
2020-03-09 12:35   ` Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=215d32cb86ead14dea44e74f5ac75f569349a794.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=pdonnell@redhat.com \
    --cc=sage@redhat.com \
    --cc=xiubli@redhat.com \
    --cc=zyan@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox