All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: make the members in struct ceph_mds_request_args_ext an union
@ 2023-07-25  4:40 xiubli
  2023-08-31  6:34 ` Milind Changire
  0 siblings, 1 reply; 2+ messages in thread
From: xiubli @ 2023-07-25  4:40 UTC (permalink / raw)
  To: idryomov, ceph-devel; +Cc: jlayton, vshankar, mchangir, Xiubo Li

From: Xiubo Li <xiubli@redhat.com>

In ceph mainline it will allow to set the btime in the setattr request
and just add a 'btime' member in the union 'ceph_mds_request_args' and
then bump up the header version to 4. That means the total size of union
'ceph_mds_request_args' will increase sizeof(struct ceph_timespec) bytes,
but in kclient it will increase the sizeof(setattr_ext) bytes for each
request.

Since the MDS will always depend on the header's vesion and front_len
members to decode the 'ceph_mds_request_head' struct, at the same time
kclient hasn't supported the 'btime' feature yet in setattr request,
so it's safe to do this change here.

This will save 48 bytes memories for each request.

Fixes: 4f1ddb1ea874 ("ceph: implement updated ceph_mds_request_head structure")
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 include/linux/ceph/ceph_fs.h | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index ce6064b3e28f..04f769368605 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -462,17 +462,19 @@ union ceph_mds_request_args {
 } __attribute__ ((packed));
 
 union ceph_mds_request_args_ext {
-	union ceph_mds_request_args old;
-	struct {
-		__le32 mode;
-		__le32 uid;
-		__le32 gid;
-		struct ceph_timespec mtime;
-		struct ceph_timespec atime;
-		__le64 size, old_size;       /* old_size needed by truncate */
-		__le32 mask;                 /* CEPH_SETATTR_* */
-		struct ceph_timespec btime;
-	} __attribute__ ((packed)) setattr_ext;
+	union {
+		union ceph_mds_request_args old;
+		struct {
+			__le32 mode;
+			__le32 uid;
+			__le32 gid;
+			struct ceph_timespec mtime;
+			struct ceph_timespec atime;
+			__le64 size, old_size;       /* old_size needed by truncate */
+			__le32 mask;                 /* CEPH_SETATTR_* */
+			struct ceph_timespec btime;
+		} __attribute__ ((packed)) setattr_ext;
+	};
 };
 
 #define CEPH_MDS_FLAG_REPLAY		1 /* this is a replayed op */
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ceph: make the members in struct ceph_mds_request_args_ext an union
  2023-07-25  4:40 [PATCH] ceph: make the members in struct ceph_mds_request_args_ext an union xiubli
@ 2023-08-31  6:34 ` Milind Changire
  0 siblings, 0 replies; 2+ messages in thread
From: Milind Changire @ 2023-08-31  6:34 UTC (permalink / raw)
  To: xiubli; +Cc: idryomov, ceph-devel, jlayton, vshankar

Approved. Looks good to me.

Reviewed-by: Milind Changire <mchangir@redhat,com>

On Tue, Jul 25, 2023 at 10:13 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> In ceph mainline it will allow to set the btime in the setattr request
> and just add a 'btime' member in the union 'ceph_mds_request_args' and
> then bump up the header version to 4. That means the total size of union
> 'ceph_mds_request_args' will increase sizeof(struct ceph_timespec) bytes,
> but in kclient it will increase the sizeof(setattr_ext) bytes for each
> request.
>
> Since the MDS will always depend on the header's vesion and front_len
> members to decode the 'ceph_mds_request_head' struct, at the same time
> kclient hasn't supported the 'btime' feature yet in setattr request,
> so it's safe to do this change here.
>
> This will save 48 bytes memories for each request.
>
> Fixes: 4f1ddb1ea874 ("ceph: implement updated ceph_mds_request_head structure")
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  include/linux/ceph/ceph_fs.h | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> index ce6064b3e28f..04f769368605 100644
> --- a/include/linux/ceph/ceph_fs.h
> +++ b/include/linux/ceph/ceph_fs.h
> @@ -462,17 +462,19 @@ union ceph_mds_request_args {
>  } __attribute__ ((packed));
>
>  union ceph_mds_request_args_ext {
> -       union ceph_mds_request_args old;
> -       struct {
> -               __le32 mode;
> -               __le32 uid;
> -               __le32 gid;
> -               struct ceph_timespec mtime;
> -               struct ceph_timespec atime;
> -               __le64 size, old_size;       /* old_size needed by truncate */
> -               __le32 mask;                 /* CEPH_SETATTR_* */
> -               struct ceph_timespec btime;
> -       } __attribute__ ((packed)) setattr_ext;
> +       union {
> +               union ceph_mds_request_args old;
> +               struct {
> +                       __le32 mode;
> +                       __le32 uid;
> +                       __le32 gid;
> +                       struct ceph_timespec mtime;
> +                       struct ceph_timespec atime;
> +                       __le64 size, old_size;       /* old_size needed by truncate */
> +                       __le32 mask;                 /* CEPH_SETATTR_* */
> +                       struct ceph_timespec btime;
> +               } __attribute__ ((packed)) setattr_ext;
> +       };
>  };
>
>  #define CEPH_MDS_FLAG_REPLAY           1 /* this is a replayed op */
> --
> 2.40.1
>


-- 
Milind


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-31  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25  4:40 [PATCH] ceph: make the members in struct ceph_mds_request_args_ext an union xiubli
2023-08-31  6:34 ` Milind Changire

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.