* [RFC PATCH] ceph: acquire Fs caps when getting dir stats
@ 2020-11-03 19:10 Jeff Layton
2020-11-03 19:49 ` Patrick Donnelly
2020-11-10 4:28 ` Xiubo Li
0 siblings, 2 replies; 3+ messages in thread
From: Jeff Layton @ 2020-11-03 19:10 UTC (permalink / raw)
To: ceph-devel; +Cc: pdonnell
We only update the inode's dirstats when we have Fs caps from the MDS.
Declare a new VXATTR_FLAG_DIRSTAT that we set on all dirstats, and have
the vxattr handling code acquire Fs caps when it's set.
URL: https://tracker.ceph.com/issues/48104
Reported-by: Patrick Donnelly <pdonnell@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/xattr.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 197cb1234341..0fd05d3d4399 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -42,6 +42,7 @@ struct ceph_vxattr {
#define VXATTR_FLAG_READONLY (1<<0)
#define VXATTR_FLAG_HIDDEN (1<<1)
#define VXATTR_FLAG_RSTAT (1<<2)
+#define VXATTR_FLAG_DIRSTAT (1<<3)
/* layouts */
@@ -347,9 +348,9 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
XATTR_LAYOUT_FIELD(dir, layout, object_size),
XATTR_LAYOUT_FIELD(dir, layout, pool),
XATTR_LAYOUT_FIELD(dir, layout, pool_namespace),
- XATTR_NAME_CEPH(dir, entries, 0),
- XATTR_NAME_CEPH(dir, files, 0),
- XATTR_NAME_CEPH(dir, subdirs, 0),
+ XATTR_NAME_CEPH(dir, entries, VXATTR_FLAG_DIRSTAT),
+ XATTR_NAME_CEPH(dir, files, VXATTR_FLAG_DIRSTAT),
+ XATTR_NAME_CEPH(dir, subdirs, VXATTR_FLAG_DIRSTAT),
XATTR_RSTAT_FIELD(dir, rentries),
XATTR_RSTAT_FIELD(dir, rfiles),
XATTR_RSTAT_FIELD(dir, rsubdirs),
@@ -837,6 +838,8 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
int mask = 0;
if (vxattr->flags & VXATTR_FLAG_RSTAT)
mask |= CEPH_STAT_RSTAT;
+ if (vxattr->flags & VXATTR_FLAG_DIRSTAT)
+ mask |= CEPH_CAP_FILE_SHARED;
err = ceph_do_getattr(inode, mask, true);
if (err)
return err;
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] ceph: acquire Fs caps when getting dir stats
2020-11-03 19:10 [RFC PATCH] ceph: acquire Fs caps when getting dir stats Jeff Layton
@ 2020-11-03 19:49 ` Patrick Donnelly
2020-11-10 4:28 ` Xiubo Li
1 sibling, 0 replies; 3+ messages in thread
From: Patrick Donnelly @ 2020-11-03 19:49 UTC (permalink / raw)
To: Jeff Layton; +Cc: Ceph Development
On Tue, Nov 3, 2020 at 11:11 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> We only update the inode's dirstats when we have Fs caps from the MDS.
>
> Declare a new VXATTR_FLAG_DIRSTAT that we set on all dirstats, and have
> the vxattr handling code acquire Fs caps when it's set.
>
> URL: https://tracker.ceph.com/issues/48104
> Reported-by: Patrick Donnelly <pdonnell@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/ceph/xattr.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index 197cb1234341..0fd05d3d4399 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -42,6 +42,7 @@ struct ceph_vxattr {
> #define VXATTR_FLAG_READONLY (1<<0)
> #define VXATTR_FLAG_HIDDEN (1<<1)
> #define VXATTR_FLAG_RSTAT (1<<2)
> +#define VXATTR_FLAG_DIRSTAT (1<<3)
>
> /* layouts */
>
> @@ -347,9 +348,9 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
> XATTR_LAYOUT_FIELD(dir, layout, object_size),
> XATTR_LAYOUT_FIELD(dir, layout, pool),
> XATTR_LAYOUT_FIELD(dir, layout, pool_namespace),
> - XATTR_NAME_CEPH(dir, entries, 0),
> - XATTR_NAME_CEPH(dir, files, 0),
> - XATTR_NAME_CEPH(dir, subdirs, 0),
> + XATTR_NAME_CEPH(dir, entries, VXATTR_FLAG_DIRSTAT),
> + XATTR_NAME_CEPH(dir, files, VXATTR_FLAG_DIRSTAT),
> + XATTR_NAME_CEPH(dir, subdirs, VXATTR_FLAG_DIRSTAT),
> XATTR_RSTAT_FIELD(dir, rentries),
> XATTR_RSTAT_FIELD(dir, rfiles),
> XATTR_RSTAT_FIELD(dir, rsubdirs),
> @@ -837,6 +838,8 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
> int mask = 0;
> if (vxattr->flags & VXATTR_FLAG_RSTAT)
> mask |= CEPH_STAT_RSTAT;
> + if (vxattr->flags & VXATTR_FLAG_DIRSTAT)
> + mask |= CEPH_CAP_FILE_SHARED;
> err = ceph_do_getattr(inode, mask, true);
> if (err)
> return err;
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
--
Patrick Donnelly, Ph.D.
He / Him / His
Principal Software Engineer
Red Hat Sunnyvale, CA
GPG: 19F28A586F808C2402351B93C3301A3E258DD79D
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH] ceph: acquire Fs caps when getting dir stats
2020-11-03 19:10 [RFC PATCH] ceph: acquire Fs caps when getting dir stats Jeff Layton
2020-11-03 19:49 ` Patrick Donnelly
@ 2020-11-10 4:28 ` Xiubo Li
1 sibling, 0 replies; 3+ messages in thread
From: Xiubo Li @ 2020-11-10 4:28 UTC (permalink / raw)
To: Jeff Layton, ceph-devel; +Cc: pdonnell
On 2020/11/4 3:10, Jeff Layton wrote:
> We only update the inode's dirstats when we have Fs caps from the MDS.
>
> Declare a new VXATTR_FLAG_DIRSTAT that we set on all dirstats, and have
> the vxattr handling code acquire Fs caps when it's set.
>
> URL: https://tracker.ceph.com/issues/48104
> Reported-by: Patrick Donnelly <pdonnell@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/ceph/xattr.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index 197cb1234341..0fd05d3d4399 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -42,6 +42,7 @@ struct ceph_vxattr {
> #define VXATTR_FLAG_READONLY (1<<0)
> #define VXATTR_FLAG_HIDDEN (1<<1)
> #define VXATTR_FLAG_RSTAT (1<<2)
> +#define VXATTR_FLAG_DIRSTAT (1<<3)
>
> /* layouts */
>
> @@ -347,9 +348,9 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
> XATTR_LAYOUT_FIELD(dir, layout, object_size),
> XATTR_LAYOUT_FIELD(dir, layout, pool),
> XATTR_LAYOUT_FIELD(dir, layout, pool_namespace),
> - XATTR_NAME_CEPH(dir, entries, 0),
> - XATTR_NAME_CEPH(dir, files, 0),
> - XATTR_NAME_CEPH(dir, subdirs, 0),
> + XATTR_NAME_CEPH(dir, entries, VXATTR_FLAG_DIRSTAT),
> + XATTR_NAME_CEPH(dir, files, VXATTR_FLAG_DIRSTAT),
> + XATTR_NAME_CEPH(dir, subdirs, VXATTR_FLAG_DIRSTAT),
> XATTR_RSTAT_FIELD(dir, rentries),
> XATTR_RSTAT_FIELD(dir, rfiles),
> XATTR_RSTAT_FIELD(dir, rsubdirs),
> @@ -837,6 +838,8 @@ ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
> int mask = 0;
> if (vxattr->flags & VXATTR_FLAG_RSTAT)
> mask |= CEPH_STAT_RSTAT;
> + if (vxattr->flags & VXATTR_FLAG_DIRSTAT)
> + mask |= CEPH_CAP_FILE_SHARED;
> err = ceph_do_getattr(inode, mask, true);
> if (err)
> return err;
Reviewed-by: Xiubo Li <xiubli@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-10 4:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 19:10 [RFC PATCH] ceph: acquire Fs caps when getting dir stats Jeff Layton
2020-11-03 19:49 ` Patrick Donnelly
2020-11-10 4:28 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).