diff mbox series

[v4,5/6] ceph: add ceph_inode_to_client() helper support

Message ID 20230619071438.7000-6-xiubli@redhat.com
State New
Headers show
Series ceph: print the client global id for debug logs | expand

Commit Message

Xiubo Li June 19, 2023, 7:14 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

This will covert the inode to ceph_client.

URL: https://tracker.ceph.com/issues/61590
Cc: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/snap.c  | 8 +++++---
 fs/ceph/super.h | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

Comments

Milind Changire Sept. 4, 2023, 9:30 a.m. UTC | #1
Looks good to me.

Tested-by: Milind Changire <mchangir@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>

On Mon, Jun 19, 2023 at 12:47 PM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> This will covert the inode to ceph_client.
>
> URL: https://tracker.ceph.com/issues/61590
> Cc: Patrick Donnelly <pdonnell@redhat.com>
> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/snap.c  | 8 +++++---
>  fs/ceph/super.h | 6 ++++++
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> index 09939ec0d1ee..9dde4b5f513d 100644
> --- a/fs/ceph/snap.c
> +++ b/fs/ceph/snap.c
> @@ -329,7 +329,8 @@ static int cmpu64_rev(const void *a, const void *b)
>  /*
>   * build the snap context for a given realm.
>   */
> -static int build_snap_context(struct ceph_snap_realm *realm,
> +static int build_snap_context(struct ceph_mds_client *mdsc,
> +                             struct ceph_snap_realm *realm,
>                               struct list_head *realm_queue,
>                               struct list_head *dirty_realms)
>  {
> @@ -425,7 +426,8 @@ static int build_snap_context(struct ceph_snap_realm *realm,
>  /*
>   * rebuild snap context for the given realm and all of its children.
>   */
> -static void rebuild_snap_realms(struct ceph_snap_realm *realm,
> +static void rebuild_snap_realms(struct ceph_mds_client *mdsc,
> +                               struct ceph_snap_realm *realm,
>                                 struct list_head *dirty_realms)
>  {
>         LIST_HEAD(realm_queue);
> @@ -858,7 +860,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
>
>         /* rebuild_snapcs when we reach the _end_ (root) of the trace */
>         if (realm_to_rebuild && p >= e)
> -               rebuild_snap_realms(realm_to_rebuild, &dirty_realms);
> +               rebuild_snap_realms(mdsc, realm_to_rebuild, &dirty_realms);
>
>         if (!first_realm)
>                 first_realm = realm;
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 9655ea46e6ca..4e78de1be23e 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -507,6 +507,12 @@ ceph_sb_to_mdsc(const struct super_block *sb)
>         return (struct ceph_mds_client *)ceph_sb_to_fs_client(sb)->mdsc;
>  }
>
> +static inline struct ceph_client *
> +ceph_inode_to_client(const struct inode *inode)
> +{
> +       return (struct ceph_client *)ceph_inode_to_fs_client(inode)->client;
> +}
> +
>  static inline struct ceph_vino
>  ceph_vino(const struct inode *inode)
>  {
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 09939ec0d1ee..9dde4b5f513d 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -329,7 +329,8 @@  static int cmpu64_rev(const void *a, const void *b)
 /*
  * build the snap context for a given realm.
  */
-static int build_snap_context(struct ceph_snap_realm *realm,
+static int build_snap_context(struct ceph_mds_client *mdsc,
+			      struct ceph_snap_realm *realm,
 			      struct list_head *realm_queue,
 			      struct list_head *dirty_realms)
 {
@@ -425,7 +426,8 @@  static int build_snap_context(struct ceph_snap_realm *realm,
 /*
  * rebuild snap context for the given realm and all of its children.
  */
-static void rebuild_snap_realms(struct ceph_snap_realm *realm,
+static void rebuild_snap_realms(struct ceph_mds_client *mdsc,
+				struct ceph_snap_realm *realm,
 				struct list_head *dirty_realms)
 {
 	LIST_HEAD(realm_queue);
@@ -858,7 +860,7 @@  int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
 
 	/* rebuild_snapcs when we reach the _end_ (root) of the trace */
 	if (realm_to_rebuild && p >= e)
-		rebuild_snap_realms(realm_to_rebuild, &dirty_realms);
+		rebuild_snap_realms(mdsc, realm_to_rebuild, &dirty_realms);
 
 	if (!first_realm)
 		first_realm = realm;
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 9655ea46e6ca..4e78de1be23e 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -507,6 +507,12 @@  ceph_sb_to_mdsc(const struct super_block *sb)
 	return (struct ceph_mds_client *)ceph_sb_to_fs_client(sb)->mdsc;
 }
 
+static inline struct ceph_client *
+ceph_inode_to_client(const struct inode *inode)
+{
+	return (struct ceph_client *)ceph_inode_to_fs_client(inode)->client;
+}
+
 static inline struct ceph_vino
 ceph_vino(const struct inode *inode)
 {