Skip to contentSkip to conversation

ceph: print the client global id for debug logs

PATCH In review [email protected] 2 participants 12 messages Jun 19, 2023 – Sep 4, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover ceph: print the client global id for debug logs

From: Xiubo Li <[email protected]>

V4:
- s/dout_client()/doutc()/
- Fixed the building errors reported by ceph: print the client global id for debug logs. Thanks.

Xiubo Li (6):
ceph: add the *_client debug macros support
ceph: pass the mdsc to several helpers
ceph: rename _to_client() to _to_fs_client()
ceph: move mdsmap.h to fs/ceph/
ceph: add ceph_inode_to_client() helper support
ceph: print the client global_id in all the debug logs

 fs/ceph/acl.c                       |   6 +-
 fs/ceph/addr.c                      | 298 ++++++-----
 fs/ceph/cache.c                     |   2 +-
 fs/ceph/caps.c                      | 774 ++++++++++++++++------------
 fs/ceph/crypto.c                    |  41 +-
 fs/ceph/debugfs.c                   |  10 +-
 fs/ceph/dir.c                       | 237 +++++----
 fs/ceph/export.c                    |  49 +-
 fs/ceph/file.c                      | 270 +++++-----
 fs/ceph/inode.c                     | 521 ++++++++++---------
 fs/ceph/ioctl.c                     |  21 +-
 fs/ceph/locks.c                     |  57 +-
 fs/ceph/mds_client.c                | 624 ++++++++++++----------
 fs/ceph/mds_client.h                |   5 +-
 fs/ceph/mdsmap.c                    |  29 +-
 {include/linux => fs}/ceph/mdsmap.h |   5 +-
 fs/ceph/metric.c                    |   5 +-
 fs/ceph/quota.c                     |  29 +-
 fs/ceph/snap.c                      | 192 +++----
 fs/ceph/super.c                     |  92 ++--
 fs/ceph/super.h                     |  19 +-
 fs/ceph/xattr.c                     | 108 ++--
 include/linux/ceph/ceph_debug.h     |  48 +-
 23 files changed, 1976 insertions(+), 1466 deletions(-)
 rename {include/linux => fs}/ceph/mdsmap.h (92%)
Signature · 1 line
2.40.1
#1 lore raw

PATCH v4 1/6 ceph: add the *_client debug macros support

From: Xiubo Li <[email protected]>

This will help print the fsid and client's global_id in debug logs, and also print the function names.

URL: https://tracker.ceph.com/issues/61590

---
 include/linux/ceph/ceph_debug.h | 48 ++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
include/linux/ceph/ceph_debug.h +47 -1
index d5a5da838caf..0b5f210ca977 100644
@@ -19,12 +19,26 @@
 	pr_debug("%.*s %12.12s:%-4d : " fmt,				\
 		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
 		 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
+#  define doutc(client, fmt, ...)					\
+	pr_debug("%.*s %12.12s:%-4d : [%pU %lld] " fmt,			\
+		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
+		 kbasename(__FILE__), __LINE__,				\
+		 &client->fsid, client->monc.auth->global_id,		\
+		 ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
 #  define dout(fmt, ...)	do {				\
 		if (0)						\
 			printk(KERN_DEBUG fmt, ##__VA_ARGS__);	\
 	} while (0)
+#  define doutc(client, fmt, ...)	do {			\
+		if (0)						\
+			printk(KERN_DEBUG "[%pU %lld] " fmt,	\
+			&client->fsid,				\
+			client->monc.auth->global_id,		\
+			##__VA_ARGS__);				\
+		} while (0)
+
 # endif
 
 #else
@@ -33,7 +47,39 @@
  * or, just wrap pr_debug
  */
 # define dout(fmt, ...)	pr_debug(" " fmt, ##__VA_ARGS__)
-
+# define doutc(client, fmt, ...)					\
+	pr_debug("[%pU %lld] %s: " fmt, &client->fsid,			\
+		 client->monc.auth->global_id, __func__,		\
+		 ##__VA_ARGS__)
 #endif
 
+# define pr_notice_client(client, fmt, ...)				\
+	pr_notice("[%pU %lld] %s: " fmt, &client->fsid,			\
+		  client->monc.auth->global_id, __func__,		\
+		  ##__VA_ARGS__)
+# define pr_info_client(client, fmt, ...)				\
+	pr_info("[%pU %lld] %s: " fmt, &client->fsid,			\
+		client->monc.auth->global_id, __func__,			\
+		##__VA_ARGS__)
+# define pr_warn_client(client, fmt, ...)				\
+	pr_warn("[%pU %lld] %s: " fmt, &client->fsid,			\
+		client->monc.auth->global_id, __func__,			\
+		##__VA_ARGS__)
+# define pr_warn_once_client(client, fmt, ...)				\
+	pr_warn_once("[%pU %lld] %s: " fmt, &client->fsid,		\
+		     client->monc.auth->global_id, __func__,		\
+		     ##__VA_ARGS__)
+# define pr_err_client(client, fmt, ...)				\
+	pr_err("[%pU %lld] %s: " fmt, &client->fsid,			\
+	       client->monc.auth->global_id, __func__,			\
+	       ##__VA_ARGS__)
+# define pr_warn_ratelimited_client(client, fmt, ...)			\
+	pr_warn_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,	\
+			    client->monc.auth->global_id, __func__,	\
+			    ##__VA_ARGS__)
+# define pr_err_ratelimited_client(client, fmt, ...)			\
+	pr_err_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,	\
+			   client->monc.auth->global_id, __func__,	\
+			   ##__VA_ARGS__)
+
 #endif
Signature · 1 line
2.40.1
Tested-by Tested-by Venky Shankar Reviewed-by Reviewed-by Venky Shankar on v4 1/6
#2 lore raw

Re: [PATCH v4 1/6] ceph: add the *_client debug macros support

Looks good to me.

Quoted 89 lines · On Mon, Jun 19, 2023 at 12:47 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

This will help print the fsid and client's global_id in debug logs, and also print the function names.

URL: https://tracker.ceph.com/issues/61590

---
 include/linux/ceph/ceph_debug.h | 48 ++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
include/linux/ceph/ceph_debug.h +47 -2
index d5a5da838caf..0b5f210ca977 100644
@@ -19,12 +19,26 @@
        pr_debug("%.*s %12.12s:%-4d : " fmt,                            \
                 8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
                 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
+#  define doutc(client, fmt, ...)                                      \
+       pr_debug("%.*s %12.12s:%-4d : [%pU %lld] " fmt,                 \
+                8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
+                kbasename(__FILE__), __LINE__,                         \
+                &client->fsid, client->monc.auth->global_id,           \
+                ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
 #  define dout(fmt, ...)       do {                            \
                if (0)                                          \
                        printk(KERN_DEBUG fmt, ##__VA_ARGS__);  \
        } while (0)
+#  define doutc(client, fmt, ...)      do {                    \
+               if (0)                                          \
+                       printk(KERN_DEBUG "[%pU %lld] " fmt,    \
+                       &client->fsid,                          \
+                       client->monc.auth->global_id,           \
+                       ##__VA_ARGS__);                         \
+               } while (0)
+
 # endif
 
 #else
@@ -33,7 +47,39 @@
  * or, just wrap pr_debug
  */
 # define dout(fmt, ...)        pr_debug(" " fmt, ##__VA_ARGS__)
-
+# define doutc(client, fmt, ...)                                       \
+       pr_debug("[%pU %lld] %s: " fmt, &client->fsid,                  \
+                client->monc.auth->global_id, __func__,                \
+                ##__VA_ARGS__)
 #endif
 
+# define pr_notice_client(client, fmt, ...)                            \
+       pr_notice("[%pU %lld] %s: " fmt, &client->fsid,                 \
+                 client->monc.auth->global_id, __func__,               \
+                 ##__VA_ARGS__)
+# define pr_info_client(client, fmt, ...)                              \
+       pr_info("[%pU %lld] %s: " fmt, &client->fsid,                   \
+               client->monc.auth->global_id, __func__,                 \
+               ##__VA_ARGS__)
+# define pr_warn_client(client, fmt, ...)                              \
+       pr_warn("[%pU %lld] %s: " fmt, &client->fsid,                   \
+               client->monc.auth->global_id, __func__,                 \
+               ##__VA_ARGS__)
+# define pr_warn_once_client(client, fmt, ...)                         \
+       pr_warn_once("[%pU %lld] %s: " fmt, &client->fsid,              \
+                    client->monc.auth->global_id, __func__,            \
+                    ##__VA_ARGS__)
+# define pr_err_client(client, fmt, ...)                               \
+       pr_err("[%pU %lld] %s: " fmt, &client->fsid,                    \
+              client->monc.auth->global_id, __func__,                  \
+              ##__VA_ARGS__)
+# define pr_warn_ratelimited_client(client, fmt, ...)                  \
+       pr_warn_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,       \
+                           client->monc.auth->global_id, __func__,     \
+                           ##__VA_ARGS__)
+# define pr_err_ratelimited_client(client, fmt, ...)                   \
+       pr_err_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,        \
+                          client->monc.auth->global_id, __func__,      \
+                          ##__VA_ARGS__)
+
 #endif
--

2.40.1

Signature · 1 line
Milind
#3 lore raw

PATCH v4 2/6 ceph: pass the mdsc to several helpers

In reply to [email protected]

From: Xiubo Li <[email protected]>

We will use the 'mdsc' to get the global_id in the following commits.

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/caps.c              | 15 +++++++++------
 fs/ceph/debugfs.c           |  4 ++--
 fs/ceph/dir.c               |  2 +-
 fs/ceph/file.c              |  2 +-
 fs/ceph/mds_client.c        | 37 +++++++++++++++++++++----------------
 fs/ceph/mds_client.h        |  3 ++-
 fs/ceph/mdsmap.c            |  3 ++-
 fs/ceph/snap.c              |  8 +++++---
 fs/ceph/super.h             |  3 ++-
 include/linux/ceph/mdsmap.h |  5 ++++-
 10 files changed, 49 insertions(+), 33 deletions(-)
fs/ceph/caps.c +9 -6
index 59ab5d905ac4..99e805144935 100644
@@ -1178,7 +1178,8 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 	}
 }
 
-void ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
+void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
+		     bool queue_release)
 {
 	struct ceph_inode_info *ci = cap->ci;
 	struct ceph_fs_client *fsc;
@@ -1341,6 +1342,8 @@ static void encode_cap_msg(struct ceph_msg *msg, struct cap_msg_args *arg)
  */
 void __ceph_remove_caps(struct ceph_inode_info *ci)
 {
+	struct inode *inode = &ci->netfs.inode;
+	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
 	struct rb_node *p;
 
 	/* lock i_ceph_lock, because ceph_d_revalidate(..., LOOKUP_RCU)
@@ -1350,7 +1353,7 @@ void __ceph_remove_caps(struct ceph_inode_info *ci)
 	while (p) {
 		struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node);
 		p = rb_next(p);
-		ceph_remove_cap(cap, true);
+		ceph_remove_cap(mdsc, cap, true);
 	}
 	spin_unlock(&ci->i_ceph_lock);
 }
@@ -3991,7 +3994,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 		goto out_unlock;
 
 	if (target < 0) {
-		ceph_remove_cap(cap, false);
+		ceph_remove_cap(mdsc, cap, false);
 		goto out_unlock;
 	}
 
@@ -4026,7 +4029,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 				change_auth_cap_ses(ci, tcap->session);
 			}
 		}
-		ceph_remove_cap(cap, false);
+		ceph_remove_cap(mdsc, cap, false);
 		goto out_unlock;
 	} else if (tsession) {
 		/* add placeholder for the export tagert */
@@ -4043,7 +4046,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 			spin_unlock(&mdsc->cap_dirty_lock);
 		}
 
-		ceph_remove_cap(cap, false);
+		ceph_remove_cap(mdsc, cap, false);
 		goto out_unlock;
 	}
 
@@ -4156,7 +4159,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
 					ocap->mseq, mds, le32_to_cpu(ph->seq),
 					le32_to_cpu(ph->mseq));
 		}
-		ceph_remove_cap(ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
+		ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
 	}
 
 	*old_issued = issued;
fs/ceph/debugfs.c +2 -2
index 3904333fa6c3..2f1e7498cd74 100644
@@ -81,7 +81,7 @@ static int mdsc_show(struct seq_file *s, void *p)
 		if (req->r_inode) {
 			seq_printf(s, " #%llx", ceph_ino(req->r_inode));
 		} else if (req->r_dentry) {
-			path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
+			path = ceph_mdsc_build_path(mdsc, req->r_dentry, &pathlen,
 						    &pathbase, 0);
 			if (IS_ERR(path))
 				path = NULL;
@@ -100,7 +100,7 @@ static int mdsc_show(struct seq_file *s, void *p)
 		}
 
 		if (req->r_old_dentry) {
-			path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen,
+			path = ceph_mdsc_build_path(mdsc, req->r_old_dentry, &pathlen,
 						    &pathbase, 0);
 			if (IS_ERR(path))
 				path = NULL;
fs/ceph/dir.c +1 -1
index 1b46f2b998c3..5fbcd0d5e5ec 100644
@@ -1219,7 +1219,7 @@ static void ceph_async_unlink_cb(struct ceph_mds_client *mdsc,
 	if (result) {
 		int pathlen = 0;
 		u64 base = 0;
-		char *path = ceph_mdsc_build_path(dentry, &pathlen,
+		char *path = ceph_mdsc_build_path(mdsc, dentry, &pathlen,
 						  &base, 0);
 
 		/* mark error on parent + clear complete */
fs/ceph/file.c +1 -1
index e878a462c7c3..04bc4cc8ad9b 100644
@@ -574,7 +574,7 @@ static void ceph_async_create_cb(struct ceph_mds_client *mdsc,
 	if (result) {
 		int pathlen = 0;
 		u64 base = 0;
-		char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
+		char *path = ceph_mdsc_build_path(mdsc, req->r_dentry, &pathlen,
 						  &base, 0);
 
 		pr_warn("async create failure path=(%llx)%s result=%d!\n",
fs/ceph/mds_client.c +21 -16
index 0a70a2438cb2..b9c7b6c60357 100644
@@ -2125,6 +2125,7 @@ static bool drop_negative_children(struct dentry *dentry)
  */
 static int trim_caps_cb(struct inode *inode, int mds, void *arg)
 {
+	struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
 	int *remaining = arg;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	int used, wanted, oissued, mine;
@@ -2172,7 +2173,7 @@ static int trim_caps_cb(struct inode *inode, int mds, void *arg)
 
 	if (oissued) {
 		/* we aren't the only cap.. just remove us */
-		ceph_remove_cap(cap, true);
+		ceph_remove_cap(mdsc, cap, true);
 		(*remaining)--;
 	} else {
 		struct dentry *dentry;
@@ -2633,7 +2634,8 @@ static u8 *get_fscrypt_altname(const struct ceph_mds_request *req, u32 *plen)
  * Encode hidden .snap dirs as a double /, i.e.
  *   foo/.snap/bar -> foo//bar
  */
-char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for_wire)
+char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc, struct dentry *dentry,
+			   int *plen, u64 *pbase, int for_wire)
 {
 	struct dentry *cur;
 	struct inode *inode;
@@ -2748,9 +2750,9 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
 	return path + pos;
 }
 
-static int build_dentry_path(struct dentry *dentry, struct inode *dir,
-			     const char **ppath, int *ppathlen, u64 *pino,
-			     bool *pfreepath, bool parent_locked)
+static int build_dentry_path(struct ceph_mds_client *mdsc, struct dentry *dentry,
+			     struct inode *dir, const char **ppath, int *ppathlen,
+			     u64 *pino, bool *pfreepath, bool parent_locked)
 {
 	char *path;
 
@@ -2765,7 +2767,7 @@ static int build_dentry_path(struct dentry *dentry, struct inode *dir,
 		return 0;
 	}
 	rcu_read_unlock();
-	path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
+	path = ceph_mdsc_build_path(mdsc, dentry, ppathlen, pino, 1);
 	if (IS_ERR(path))
 		return PTR_ERR(path);
 	*ppath = path;
@@ -2777,6 +2779,7 @@ static int build_inode_path(struct inode *inode,
 			    const char **ppath, int *ppathlen, u64 *pino,
 			    bool *pfreepath)
 {
+	struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
 	struct dentry *dentry;
 	char *path;
 
@@ -2786,7 +2789,7 @@ static int build_inode_path(struct inode *inode,
 		return 0;
 	}
 	dentry = d_find_alias(inode);
-	path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
+	path = ceph_mdsc_build_path(mdsc, dentry, ppathlen, pino, 1);
 	dput(dentry);
 	if (IS_ERR(path))
 		return PTR_ERR(path);
@@ -2799,10 +2802,11 @@ static int build_inode_path(struct inode *inode,
  * request arguments may be specified via an inode *, a dentry *, or
  * an explicit ino+path.
  */
-static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry,
-				  struct inode *rdiri, const char *rpath,
-				  u64 rino, const char **ppath, int *pathlen,
-				  u64 *ino, bool *freepath, bool parent_locked)
+static int set_request_path_attr(struct ceph_mds_client *mdsc, struct inode *rinode,
+				 struct dentry *rdentry, struct inode *rdiri,
+				 const char *rpath, u64 rino, const char **ppath,
+				 int *pathlen, u64 *ino, bool *freepath,
+				 bool parent_locked)
 {
 	int r = 0;
 
@@ -2811,7 +2815,7 @@ static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry,
 		dout(" inode %p %llx.%llx\n", rinode, ceph_ino(rinode),
 		     ceph_snap(rinode));
 	} else if (rdentry) {
-		r = build_dentry_path(rdentry, rdiri, ppath, pathlen, ino,
+		r = build_dentry_path(mdsc, rdentry, rdiri, ppath, pathlen, ino,
 					freepath, parent_locked);
 		dout(" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen,
 		     *ppath);
@@ -2883,7 +2887,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
 	int ret;
 	bool legacy = !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME);
 
-	ret = set_request_path_attr(req->r_inode, req->r_dentry,
+	ret = set_request_path_attr(mdsc, req->r_inode, req->r_dentry,
 			      req->r_parent, req->r_path1, req->r_ino1.ino,
 			      &path1, &pathlen1, &ino1, &freepath1,
 			      test_bit(CEPH_MDS_R_PARENT_LOCKED,
@@ -2897,7 +2901,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
 	if (req->r_old_dentry &&
 	    !(req->r_old_dentry->d_flags & DCACHE_DISCONNECTED))
 		old_dentry = req->r_old_dentry;
-	ret = set_request_path_attr(NULL, old_dentry,
+	ret = set_request_path_attr(mdsc, NULL, old_dentry,
 			      req->r_old_dentry_dir,
 			      req->r_path2, req->r_ino2.ino,
 			      &path2, &pathlen2, &ino2, &freepath2, true);
@@ -4288,6 +4292,7 @@ static struct dentry* d_find_primary(struct inode *inode)
  */
 static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
 {
+	struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
 	union {
 		struct ceph_mds_cap_reconnect v2;
 		struct ceph_mds_cap_reconnect_v1 v1;
@@ -4305,7 +4310,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
 	dentry = d_find_primary(inode);
 	if (dentry) {
 		/* set pathbase to parent dir when msg_version >= 2 */
-		path = ceph_mdsc_build_path(dentry, &pathlen, &pathbase,
+		path = ceph_mdsc_build_path(mdsc, dentry, &pathlen, &pathbase,
 					    recon_state->msg_version >= 2);
 		dput(dentry);
 		if (IS_ERR(path)) {
@@ -5660,7 +5665,7 @@ void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
 		return;
 	}
 
-	newmap = ceph_mdsmap_decode(&p, end, ceph_msgr2(mdsc->fsc->client));
+	newmap = ceph_mdsmap_decode(mdsc, &p, end, ceph_msgr2(mdsc->fsc->client));
 	if (IS_ERR(newmap)) {
 		err = PTR_ERR(newmap);
 		goto bad_unlock;
fs/ceph/mds_client.h +2 -1
index 351d92f7fc4f..20bcf8d5322e 100644
@@ -578,7 +578,8 @@ static inline void ceph_mdsc_free_path(char *path, int len)
 		__putname(path - (PATH_MAX - 1 - len));
 }
 
-extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
+extern char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc,
+				  struct dentry *dentry, int *plen, u64 *base,
 				  int stop_on_nosnap);
 
 extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry);
fs/ceph/mdsmap.c +2 -1
index 7dac21ee6ce7..6cbec7aed5a0 100644
@@ -114,7 +114,8 @@ static int __decode_and_drop_compat_set(void **p, void* end)
  * Ignore any fields we don't care about (there are quite a few of
  * them).
  */
-struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
+struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
+				       void *end, bool msgr2)
 {
 	struct ceph_mdsmap *m;
 	const void *start = *p;
fs/ceph/snap.c +5 -3
index abd52f5b3b0a..5bd47829a005 100644
@@ -451,7 +451,8 @@ static void rebuild_snap_realms(struct ceph_snap_realm *realm,
 			continue;
 		}
 
-		last = build_snap_context(_realm, &realm_queue, dirty_realms);
+		last = build_snap_context(mdsc, _realm, &realm_queue,
+					  dirty_realms);
 		dout("%s %llx %p, %s\n", __func__, _realm->ino, _realm,
 		     last > 0 ? "is deferred" : !last ? "succeeded" : "failed");
 
@@ -709,7 +710,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
  * Queue cap_snaps for snap writeback for this realm and its children.
  * Called under snap_rwsem, so realm topology won't change.
  */
-static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
+static void queue_realm_cap_snaps(struct ceph_mds_client *mdsc,
+				  struct ceph_snap_realm *realm)
 {
 	struct ceph_inode_info *ci;
 	struct inode *lastinode = NULL;
@@ -874,7 +876,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
 		realm = list_first_entry(&dirty_realms, struct ceph_snap_realm,
 					 dirty_item);
 		list_del_init(&realm->dirty_item);
-		queue_realm_cap_snaps(realm);
+		queue_realm_cap_snaps(mdsc, realm);
 	}
 
 	if (realm_ret)
fs/ceph/super.h +2 -1
index 107a9d16a4e8..ab5c0c703eae 100644
@@ -1223,7 +1223,8 @@ extern void ceph_add_cap(struct inode *inode,
 			 unsigned cap, unsigned seq, u64 realmino, int flags,
 			 struct ceph_cap **new_cap);
 extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
-extern void ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
+extern void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
+			    bool queue_release);
 extern void __ceph_remove_caps(struct ceph_inode_info *ci);
 extern void ceph_put_cap(struct ceph_mds_client *mdsc,
 			 struct ceph_cap *cap);
include/linux/ceph/mdsmap.h +4 -1
index 4c3e0648dc27..89f1931f1ba6 100644
@@ -5,6 +5,8 @@
 #include <linux/bug.h>
 #include <linux/ceph/types.h>
 
+struct ceph_mds_client;
+
 /*
  * mds map - describe servers in the mds cluster.
  *
@@ -65,7 +67,8 @@ static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
 }
 
 extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
-struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2);
+struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
+				       void *end, bool msgr2);
 extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
 extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);
 
Signature · 1 line
2.40.1
Tested-by Tested-by Venky Shankar Reviewed-by Reviewed-by Venky Shankar on v4 2/6
#4 lore raw

Re: [PATCH v4 2/6] ceph: pass the mdsc to several helpers

Looks good to me.

Quoted 378 lines · On Mon, Jun 19, 2023 at 12:47 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

We will use the 'mdsc' to get the global_id in the following commits.

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/caps.c              | 15 +++++++++------
 fs/ceph/debugfs.c           |  4 ++--
 fs/ceph/dir.c               |  2 +-
 fs/ceph/file.c              |  2 +-
 fs/ceph/mds_client.c        | 37 +++++++++++++++++++++----------------
 fs/ceph/mds_client.h        |  3 ++-
 fs/ceph/mdsmap.c            |  3 ++-
 fs/ceph/snap.c              |  8 +++++---
 fs/ceph/super.h             |  3 ++-
 include/linux/ceph/mdsmap.h |  5 ++++-
 10 files changed, 49 insertions(+), 33 deletions(-)
fs/ceph/caps.c +9 -6
index 59ab5d905ac4..99e805144935 100644
@@ -1178,7 +1178,8 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
        }
 }
 
-void ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
+void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
+                    bool queue_release)
 {
        struct ceph_inode_info *ci = cap->ci;
        struct ceph_fs_client *fsc;
@@ -1341,6 +1342,8 @@ static void encode_cap_msg(struct ceph_msg *msg, struct cap_msg_args *arg)
  */
 void __ceph_remove_caps(struct ceph_inode_info *ci)
 {
+       struct inode *inode = &ci->netfs.inode;
+       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
        struct rb_node *p;
 
        /* lock i_ceph_lock, because ceph_d_revalidate(..., LOOKUP_RCU)
@@ -1350,7 +1353,7 @@ void __ceph_remove_caps(struct ceph_inode_info *ci)
        while (p) {
                struct ceph_cap *cap = rb_entry(p, struct ceph_cap, ci_node);
                p = rb_next(p);
-               ceph_remove_cap(cap, true);
+               ceph_remove_cap(mdsc, cap, true);
        }
        spin_unlock(&ci->i_ceph_lock);
 }
@@ -3991,7 +3994,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
                goto out_unlock;
 
        if (target < 0) {
-               ceph_remove_cap(cap, false);
+               ceph_remove_cap(mdsc, cap, false);
                goto out_unlock;
        }
 
@@ -4026,7 +4029,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
                                change_auth_cap_ses(ci, tcap->session);
                        }
                }
-               ceph_remove_cap(cap, false);
+               ceph_remove_cap(mdsc, cap, false);
                goto out_unlock;
        } else if (tsession) {
                /* add placeholder for the export tagert */
@@ -4043,7 +4046,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
                        spin_unlock(&mdsc->cap_dirty_lock);
                }
 
-               ceph_remove_cap(cap, false);
+               ceph_remove_cap(mdsc, cap, false);
                goto out_unlock;
        }
 
@@ -4156,7 +4159,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc,
                                        ocap->mseq, mds, le32_to_cpu(ph->seq),
                                        le32_to_cpu(ph->mseq));
                }
-               ceph_remove_cap(ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
+               ceph_remove_cap(mdsc, ocap, (ph->flags & CEPH_CAP_FLAG_RELEASE));
        }
 
        *old_issued = issued;
fs/ceph/debugfs.c +2 -2
index 3904333fa6c3..2f1e7498cd74 100644
@@ -81,7 +81,7 @@ static int mdsc_show(struct seq_file *s, void *p)
                if (req->r_inode) {
                        seq_printf(s, " #%llx", ceph_ino(req->r_inode));
                } else if (req->r_dentry) {
-                       path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
+                       path = ceph_mdsc_build_path(mdsc, req->r_dentry, &pathlen,
                                                    &pathbase, 0);
                        if (IS_ERR(path))
                                path = NULL;
@@ -100,7 +100,7 @@ static int mdsc_show(struct seq_file *s, void *p)
                }
 
                if (req->r_old_dentry) {
-                       path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen,
+                       path = ceph_mdsc_build_path(mdsc, req->r_old_dentry, &pathlen,
                                                    &pathbase, 0);
                        if (IS_ERR(path))
                                path = NULL;
fs/ceph/dir.c +1 -1
index 1b46f2b998c3..5fbcd0d5e5ec 100644
@@ -1219,7 +1219,7 @@ static void ceph_async_unlink_cb(struct ceph_mds_client *mdsc,
        if (result) {
                int pathlen = 0;
                u64 base = 0;
-               char *path = ceph_mdsc_build_path(dentry, &pathlen,
+               char *path = ceph_mdsc_build_path(mdsc, dentry, &pathlen,
                                                  &base, 0);
 
                /* mark error on parent + clear complete */
fs/ceph/file.c +1 -1
index e878a462c7c3..04bc4cc8ad9b 100644
@@ -574,7 +574,7 @@ static void ceph_async_create_cb(struct ceph_mds_client *mdsc,
        if (result) {
                int pathlen = 0;
                u64 base = 0;
-               char *path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
+               char *path = ceph_mdsc_build_path(mdsc, req->r_dentry, &pathlen,
                                                  &base, 0);
 
                pr_warn("async create failure path=(%llx)%s result=%d!\n",
fs/ceph/mds_client.c +21 -16
index 0a70a2438cb2..b9c7b6c60357 100644
@@ -2125,6 +2125,7 @@ static bool drop_negative_children(struct dentry *dentry)
  */
 static int trim_caps_cb(struct inode *inode, int mds, void *arg)
 {
+       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
        int *remaining = arg;
        struct ceph_inode_info *ci = ceph_inode(inode);
        int used, wanted, oissued, mine;
@@ -2172,7 +2173,7 @@ static int trim_caps_cb(struct inode *inode, int mds, void *arg)
 
        if (oissued) {
                /* we aren't the only cap.. just remove us */
-               ceph_remove_cap(cap, true);
+               ceph_remove_cap(mdsc, cap, true);
                (*remaining)--;
        } else {
                struct dentry *dentry;
@@ -2633,7 +2634,8 @@ static u8 *get_fscrypt_altname(const struct ceph_mds_request *req, u32 *plen)
  * Encode hidden .snap dirs as a double /, i.e.
  *   foo/.snap/bar -> foo//bar
  */
-char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for_wire)
+char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc, struct dentry *dentry,
+                          int *plen, u64 *pbase, int for_wire)
 {
        struct dentry *cur;
        struct inode *inode;
@@ -2748,9 +2750,9 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, int for
        return path + pos;
 }
 
-static int build_dentry_path(struct dentry *dentry, struct inode *dir,
-                            const char **ppath, int *ppathlen, u64 *pino,
-                            bool *pfreepath, bool parent_locked)
+static int build_dentry_path(struct ceph_mds_client *mdsc, struct dentry *dentry,
+                            struct inode *dir, const char **ppath, int *ppathlen,
+                            u64 *pino, bool *pfreepath, bool parent_locked)
 {
        char *path;
 
@@ -2765,7 +2767,7 @@ static int build_dentry_path(struct dentry *dentry, struct inode *dir,
                return 0;
        }
        rcu_read_unlock();
-       path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
+       path = ceph_mdsc_build_path(mdsc, dentry, ppathlen, pino, 1);
        if (IS_ERR(path))
                return PTR_ERR(path);
        *ppath = path;
@@ -2777,6 +2779,7 @@ static int build_inode_path(struct inode *inode,
                            const char **ppath, int *ppathlen, u64 *pino,
                            bool *pfreepath)
 {
+       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
        struct dentry *dentry;
        char *path;
 
@@ -2786,7 +2789,7 @@ static int build_inode_path(struct inode *inode,
                return 0;
        }
        dentry = d_find_alias(inode);
-       path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
+       path = ceph_mdsc_build_path(mdsc, dentry, ppathlen, pino, 1);
        dput(dentry);
        if (IS_ERR(path))
                return PTR_ERR(path);
@@ -2799,10 +2802,11 @@ static int build_inode_path(struct inode *inode,
  * request arguments may be specified via an inode *, a dentry *, or
  * an explicit ino+path.
  */
-static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry,
-                                 struct inode *rdiri, const char *rpath,
-                                 u64 rino, const char **ppath, int *pathlen,
-                                 u64 *ino, bool *freepath, bool parent_locked)
+static int set_request_path_attr(struct ceph_mds_client *mdsc, struct inode *rinode,
+                                struct dentry *rdentry, struct inode *rdiri,
+                                const char *rpath, u64 rino, const char **ppath,
+                                int *pathlen, u64 *ino, bool *freepath,
+                                bool parent_locked)
 {
        int r = 0;
 
@@ -2811,7 +2815,7 @@ static int set_request_path_attr(struct inode *rinode, struct dentry *rdentry,
                dout(" inode %p %llx.%llx\n", rinode, ceph_ino(rinode),
                     ceph_snap(rinode));
        } else if (rdentry) {
-               r = build_dentry_path(rdentry, rdiri, ppath, pathlen, ino,
+               r = build_dentry_path(mdsc, rdentry, rdiri, ppath, pathlen, ino,
                                        freepath, parent_locked);
                dout(" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen,
                     *ppath);
@@ -2883,7 +2887,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
        int ret;
        bool legacy = !(session->s_con.peer_features & CEPH_FEATURE_FS_BTIME);
 
-       ret = set_request_path_attr(req->r_inode, req->r_dentry,
+       ret = set_request_path_attr(mdsc, req->r_inode, req->r_dentry,
                              req->r_parent, req->r_path1, req->r_ino1.ino,
                              &path1, &pathlen1, &ino1, &freepath1,
                              test_bit(CEPH_MDS_R_PARENT_LOCKED,
@@ -2897,7 +2901,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_session *session,
        if (req->r_old_dentry &&
            !(req->r_old_dentry->d_flags & DCACHE_DISCONNECTED))
                old_dentry = req->r_old_dentry;
-       ret = set_request_path_attr(NULL, old_dentry,
+       ret = set_request_path_attr(mdsc, NULL, old_dentry,
                              req->r_old_dentry_dir,
                              req->r_path2, req->r_ino2.ino,
                              &path2, &pathlen2, &ino2, &freepath2, true);
@@ -4288,6 +4292,7 @@ static struct dentry* d_find_primary(struct inode *inode)
  */
 static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
 {
+       struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
        union {
                struct ceph_mds_cap_reconnect v2;
                struct ceph_mds_cap_reconnect_v1 v1;
@@ -4305,7 +4310,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
        dentry = d_find_primary(inode);
        if (dentry) {
                /* set pathbase to parent dir when msg_version >= 2 */
-               path = ceph_mdsc_build_path(dentry, &pathlen, &pathbase,
+               path = ceph_mdsc_build_path(mdsc, dentry, &pathlen, &pathbase,
                                            recon_state->msg_version >= 2);
                dput(dentry);
                if (IS_ERR(path)) {
@@ -5660,7 +5665,7 @@ void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
                return;
        }
 
-       newmap = ceph_mdsmap_decode(&p, end, ceph_msgr2(mdsc->fsc->client));
+       newmap = ceph_mdsmap_decode(mdsc, &p, end, ceph_msgr2(mdsc->fsc->client));
        if (IS_ERR(newmap)) {
                err = PTR_ERR(newmap);
                goto bad_unlock;
fs/ceph/mds_client.h +2 -1
index 351d92f7fc4f..20bcf8d5322e 100644
@@ -578,7 +578,8 @@ static inline void ceph_mdsc_free_path(char *path, int len)
                __putname(path - (PATH_MAX - 1 - len));
 }
 
-extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
+extern char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc,
+                                 struct dentry *dentry, int *plen, u64 *base,
                                  int stop_on_nosnap);
 
 extern void __ceph_mdsc_drop_dentry_lease(struct dentry *dentry);
fs/ceph/mdsmap.c +2 -1
index 7dac21ee6ce7..6cbec7aed5a0 100644
@@ -114,7 +114,8 @@ static int __decode_and_drop_compat_set(void **p, void* end)
  * Ignore any fields we don't care about (there are quite a few of
  * them).
  */
-struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
+struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
+                                      void *end, bool msgr2)
 {
        struct ceph_mdsmap *m;
        const void *start = *p;
fs/ceph/snap.c +5 -3
index abd52f5b3b0a..5bd47829a005 100644
@@ -451,7 +451,8 @@ static void rebuild_snap_realms(struct ceph_snap_realm *realm,
                        continue;
                }
 
-               last = build_snap_context(_realm, &realm_queue, dirty_realms);
+               last = build_snap_context(mdsc, _realm, &realm_queue,
+                                         dirty_realms);
                dout("%s %llx %p, %s\n", __func__, _realm->ino, _realm,
                     last > 0 ? "is deferred" : !last ? "succeeded" : "failed");
 
@@ -709,7 +710,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
  * Queue cap_snaps for snap writeback for this realm and its children.
  * Called under snap_rwsem, so realm topology won't change.
  */
-static void queue_realm_cap_snaps(struct ceph_snap_realm *realm)
+static void queue_realm_cap_snaps(struct ceph_mds_client *mdsc,
+                                 struct ceph_snap_realm *realm)
 {
        struct ceph_inode_info *ci;
        struct inode *lastinode = NULL;
@@ -874,7 +876,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,
                realm = list_first_entry(&dirty_realms, struct ceph_snap_realm,
                                         dirty_item);
                list_del_init(&realm->dirty_item);
-               queue_realm_cap_snaps(realm);
+               queue_realm_cap_snaps(mdsc, realm);
        }
 
        if (realm_ret)
fs/ceph/super.h +2 -1
index 107a9d16a4e8..ab5c0c703eae 100644
@@ -1223,7 +1223,8 @@ extern void ceph_add_cap(struct inode *inode,
                         unsigned cap, unsigned seq, u64 realmino, int flags,
                         struct ceph_cap **new_cap);
 extern void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
-extern void ceph_remove_cap(struct ceph_cap *cap, bool queue_release);
+extern void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
+                           bool queue_release);
 extern void __ceph_remove_caps(struct ceph_inode_info *ci);
 extern void ceph_put_cap(struct ceph_mds_client *mdsc,
                         struct ceph_cap *cap);
include/linux/ceph/mdsmap.h +4 -2
index 4c3e0648dc27..89f1931f1ba6 100644
@@ -5,6 +5,8 @@
 #include <linux/bug.h>
 #include <linux/ceph/types.h>
 
+struct ceph_mds_client;
+
 /*
  * mds map - describe servers in the mds cluster.
  *
@@ -65,7 +67,8 @@ static inline bool ceph_mdsmap_is_laggy(struct ceph_mdsmap *m, int w)
 }
 
 extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
-struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2);
+struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,
+                                      void *end, bool msgr2);
 extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
 extern bool ceph_mdsmap_is_cluster_available(struct ceph_mdsmap *m);
 
--

2.40.1

Signature · 1 line
Milind
#5 lore raw

PATCH v4 3/6 ceph: rename _to_client() to _to_fs_client()

In reply to [email protected]

From: Xiubo Li <[email protected]>

We need to covert the inode to ceph_client in the following commit, and will add one new helper for that, here we rename the old helper to _fs_client().

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/addr.c       | 20 ++++++++++----------
 fs/ceph/cache.c      |  2 +-
 fs/ceph/caps.c       | 40 ++++++++++++++++++++--------------------
 fs/ceph/crypto.c     |  2 +-
 fs/ceph/dir.c        | 22 +++++++++++-----------
 fs/ceph/export.c     | 10 +++++-----
 fs/ceph/file.c       | 24 ++++++++++++------------
 fs/ceph/inode.c      | 14 +++++++-------
 fs/ceph/ioctl.c      |  8 ++++----
 fs/ceph/mds_client.c |  2 +-
 fs/ceph/snap.c       |  2 +-
 fs/ceph/super.c      | 22 +++++++++++-----------
 fs/ceph/super.h      | 10 +++++-----
 fs/ceph/xattr.c      | 12 ++++++------
 14 files changed, 95 insertions(+), 95 deletions(-)
fs/ceph/addr.c +10 -10
index de9b82905f18..e62318b3e13d 100644
@@ -229,7 +229,7 @@ static void ceph_netfs_expand_readahead(struct netfs_io_request *rreq)
 static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
 {
 	struct inode *inode = subreq->rreq->inode;
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	u64 objno, objoff;
 	u32 xlen;
@@ -244,7 +244,7 @@ static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
 static void finish_netfs_read(struct ceph_osd_request *req)
 {
 	struct inode *inode = req->r_inode;
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0);
 	struct netfs_io_subrequest *subreq = req->r_priv;
 	struct ceph_osd_req_op *op = &req->r_ops[0];
@@ -347,7 +347,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
 	struct netfs_io_request *rreq = subreq->rreq;
 	struct inode *inode = rreq->inode;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_request *req = NULL;
 	struct ceph_vino vino = ceph_vino(inode);
 	struct iov_iter iter;
@@ -655,7 +655,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
 	struct folio *folio = page_folio(page);
 	struct inode *inode = page->mapping->host;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_snap_context *snapc, *oldest;
 	loff_t page_off = page_offset(page);
 	int err;
@@ -799,7 +799,7 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
 	ihold(inode);
 
 	if (wbc->sync_mode == WB_SYNC_NONE &&
-	    ceph_inode_to_client(inode)->write_congested)
+	    ceph_inode_to_fs_client(inode)->write_congested)
 		return AOP_WRITEPAGE_ACTIVATE;
 
 	wait_on_page_fscache(page);
@@ -832,7 +832,7 @@ static void writepages_finish(struct ceph_osd_request *req)
 	int rc = req->r_result;
 	struct ceph_snap_context *snapc = req->r_snapc;
 	struct address_space *mapping = inode->i_mapping;
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	unsigned int len = 0;
 	bool remove_page;
 
@@ -922,7 +922,7 @@ static int ceph_writepages_start(struct address_space *mapping,
 {
 	struct inode *inode = mapping->host;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_vino vino = ceph_vino(inode);
 	pgoff_t index, start_index, end = -1;
 	struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc;
@@ -1819,7 +1819,7 @@ int ceph_uninline_data(struct file *file)
 {
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_request *req = NULL;
 	struct ceph_cap_flush *prealloc_cf = NULL;
 	struct folio *folio = NULL;
@@ -1973,7 +1973,7 @@ enum {
 static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
 				s64 pool, struct ceph_string *pool_ns)
 {
-	struct ceph_fs_client *fsc = ceph_inode_to_client(&ci->netfs.inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(&ci->netfs.inode);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_osd_request *rd_req = NULL, *wr_req = NULL;
 	struct rb_node **p, *parent;
@@ -2164,7 +2164,7 @@ int ceph_pool_perm_check(struct inode *inode, int need)
 		return 0;
 	}
 
-	if (ceph_test_mount_opt(ceph_inode_to_client(inode),
+	if (ceph_test_mount_opt(ceph_inode_to_fs_client(inode),
 				NOPOOLPERM))
 		return 0;
 
fs/ceph/cache.c +1 -1
index 177d8e8d73fe..fedb8108c9f5 100644
@@ -15,7 +15,7 @@
 void ceph_fscache_register_inode_cookie(struct inode *inode)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 
 	/* No caching for filesystem? */
 	if (!fsc->fscache)
fs/ceph/caps.c +20 -20
index 99e805144935..4538c8280c70 100644
@@ -635,7 +635,7 @@ void ceph_add_cap(struct inode *inode,
 		  unsigned seq, unsigned mseq, u64 realmino, int flags,
 		  struct ceph_cap **new_cap)
 {
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_cap *cap;
 	int mds = session->s_mds;
@@ -922,7 +922,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
 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->netfs.inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 	int r;
 
 	r = __ceph_caps_issued_mask(ci, mask, touch);
@@ -996,7 +996,7 @@ int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
 	const int WR_SHIFT = ffs(CEPH_FILE_MODE_WR);
 	const int LAZY_SHIFT = ffs(CEPH_FILE_MODE_LAZY);
 	struct ceph_mount_options *opt =
-		ceph_inode_to_client(&ci->netfs.inode)->mount_options;
+		ceph_inode_to_fs_client(&ci->netfs.inode)->mount_options;
 	unsigned long used_cutoff = jiffies - opt->caps_wanted_delay_max * HZ;
 	unsigned long idle_cutoff = jiffies - opt->caps_wanted_delay_min * HZ;
 
@@ -1121,7 +1121,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 
 	dout("__ceph_remove_cap %p from %p\n", cap, &ci->netfs.inode);
 
-	mdsc = ceph_inode_to_client(&ci->netfs.inode)->mdsc;
+	mdsc = ceph_inode_to_fs_client(&ci->netfs.inode)->mdsc;
 
 	/* remove from inode's cap rbtree, and clear auth cap */
 	rb_erase(&cap->ci_node, &ci->i_caps);
@@ -1192,7 +1192,7 @@ void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
 
 	lockdep_assert_held(&ci->i_ceph_lock);
 
-	fsc = ceph_inode_to_client(&ci->netfs.inode);
+	fsc = ceph_inode_to_fs_client(&ci->netfs.inode);
 	WARN_ON_ONCE(ci->i_auth_cap == cap &&
 		     !list_empty(&ci->i_dirty_item) &&
 		     !fsc->blocklisted &&
@@ -1343,7 +1343,7 @@ static void encode_cap_msg(struct ceph_msg *msg, struct cap_msg_args *arg)
 void __ceph_remove_caps(struct ceph_inode_info *ci)
 {
 	struct inode *inode = &ci->netfs.inode;
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	struct rb_node *p;
 
 	/* lock i_ceph_lock, because ceph_d_revalidate(..., LOOKUP_RCU)
@@ -1685,7 +1685,7 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
 		      struct ceph_mds_session **psession)
 {
 	struct inode *inode = &ci->netfs.inode;
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	struct ceph_mds_session *session = NULL;
 	bool need_put = false;
 	int mds;
@@ -1750,7 +1750,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
 			   struct ceph_cap_flush **pcf)
 {
 	struct ceph_mds_client *mdsc =
-		ceph_sb_to_client(ci->netfs.inode.i_sb)->mdsc;
+		ceph_sb_to_fs_client(ci->netfs.inode.i_sb)->mdsc;
 	struct inode *inode = &ci->netfs.inode;
 	int was = ci->i_dirty_caps;
 	int dirty = 0;
@@ -1873,7 +1873,7 @@ static u64 __mark_caps_flushing(struct inode *inode,
 				struct ceph_mds_session *session, bool wake,
 				u64 *oldest_flush_tid)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_cap_flush *cf = NULL;
 	int flushing;
@@ -2233,7 +2233,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
  */
 static int try_flush_caps(struct inode *inode, u64 *ptid)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	int flushing = 0;
 	u64 flush_tid = 0, oldest_flush_tid = 0;
@@ -2311,7 +2311,7 @@ static int caps_are_flushed(struct inode *inode, u64 flush_tid)
  */
 static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mds_request *req1 = NULL, *req2 = NULL;
 	int ret, err = 0;
@@ -2494,7 +2494,7 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
 				       caps_are_flushed(inode, flush_tid));
 	} else {
 		struct ceph_mds_client *mdsc =
-			ceph_sb_to_client(inode->i_sb)->mdsc;
+			ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 
 		spin_lock(&ci->i_ceph_lock);
 		if (__ceph_caps_dirty(ci))
@@ -2747,7 +2747,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
 			    loff_t endoff, int flags, int *got)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	int ret = 0;
 	int have, implemented;
 	bool snap_rwsem_locked = false;
@@ -2965,7 +2965,7 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
 		    int want, loff_t endoff, int *got)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	int ret, _got, flags;
 
 	ret = ceph_pool_perm_check(inode, need);
@@ -3717,7 +3717,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
 	__releases(ci->i_ceph_lock)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_cap_flush *cf, *tmp_cf;
 	LIST_HEAD(to_remove);
 	unsigned seq = le32_to_cpu(m->seq);
@@ -3827,7 +3827,7 @@ void __ceph_remove_capsnap(struct inode *inode, struct ceph_cap_snap *capsnap,
 			   bool *wake_ci, bool *wake_mdsc)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	bool ret;
 
 	lockdep_assert_held(&ci->i_ceph_lock);
@@ -3871,7 +3871,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,
 				     struct ceph_mds_session *session)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	u64 follows = le64_to_cpu(m->snap_follows);
 	struct ceph_cap_snap *capsnap = NULL, *iter;
 	bool wake_ci = false;
@@ -3964,7 +3964,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
 			      struct ceph_mds_cap_peer *ph,
 			      struct ceph_mds_session *session)
 {
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	struct ceph_mds_session *tsession = NULL;
 	struct ceph_cap *cap, *tcap, *new_cap = NULL;
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -4672,7 +4672,7 @@ int ceph_drop_caps_for_unlink(struct inode *inode)
 
 		if (__ceph_caps_dirty(ci)) {
 			struct ceph_mds_client *mdsc =
-				ceph_inode_to_client(inode)->mdsc;
+				ceph_inode_to_fs_client(inode)->mdsc;
 			__cap_delay_requeue_front(mdsc, ci);
 		}
 	}
@@ -4855,7 +4855,7 @@ static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode)
 
 int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invalidate)
 {
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	bool is_auth;
fs/ceph/crypto.c +1 -1
index e72bab29d5e1..4b0e9c3a53c8 100644
@@ -128,7 +128,7 @@ static bool ceph_crypt_empty_dir(struct inode *inode)
 
 static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
 {
-	return ceph_sb_to_client(sb)->fsc_dummy_enc_policy.policy;
+	return ceph_sb_to_fs_client(sb)->fsc_dummy_enc_policy.policy;
 }
 
 static struct fscrypt_operations ceph_fscrypt_ops = {
fs/ceph/dir.c +11 -11
index 5fbcd0d5e5ec..69906b721992 100644
@@ -310,7 +310,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
 	struct ceph_dir_file_info *dfi = file->private_data;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	int i;
 	int err;
@@ -702,7 +702,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
 struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,
 				   struct dentry *dentry)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
 	struct inode *parent = d_inode(dentry->d_parent); /* we hold i_rwsem */
 
 	/* .snap dir? */
@@ -770,7 +770,7 @@ static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
 static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
 				  unsigned int flags)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
 	struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
 	struct ceph_mds_request *req;
 	int op;
@@ -1192,7 +1192,7 @@ static void ceph_async_unlink_cb(struct ceph_mds_client *mdsc,
 				 struct ceph_mds_request *req)
 {
 	struct dentry *dentry = req->r_dentry;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
 	struct ceph_dentry_info *di = ceph_dentry(dentry);
 	int result = req->r_err ? req->r_err :
 			le32_to_cpu(req->r_reply_info.head->result);
@@ -1283,7 +1283,7 @@ static int get_caps_for_async_unlink(struct inode *dir, struct dentry *dentry)
  */
 static int ceph_unlink(struct inode *dir, struct dentry *dentry)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct inode *inode = d_inode(dentry);
 	struct ceph_mds_request *req;
@@ -1461,7 +1461,7 @@ void __ceph_dentry_lease_touch(struct ceph_dentry_info *di)
 		return;
 	}
 
-	mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
+	mdsc = ceph_sb_to_fs_client(dn->d_sb)->mdsc;
 	spin_lock(&mdsc->dentry_list_lock);
 	list_move_tail(&di->lease_list, &mdsc->dentry_leases);
 	spin_unlock(&mdsc->dentry_list_lock);
@@ -1508,7 +1508,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
 		return;
 	}
 
-	mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
+	mdsc = ceph_sb_to_fs_client(dn->d_sb)->mdsc;
 	spin_lock(&mdsc->dentry_list_lock);
 	__dentry_dir_lease_touch(mdsc, di),
 	spin_unlock(&mdsc->dentry_list_lock);
@@ -1522,7 +1522,7 @@ static void __dentry_lease_unlist(struct ceph_dentry_info *di)
 	if (list_empty(&di->lease_list))
 		return;
 
-	mdsc = ceph_sb_to_client(di->dentry->d_sb)->mdsc;
+	mdsc = ceph_sb_to_fs_client(di->dentry->d_sb)->mdsc;
 	spin_lock(&mdsc->dentry_list_lock);
 	list_del_init(&di->lease_list);
 	spin_unlock(&mdsc->dentry_list_lock);
@@ -1879,7 +1879,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
 	dout("d_revalidate %p '%pd' inode %p offset 0x%llx nokey %d\n", dentry,
 	     dentry, inode, ceph_dentry(dentry)->offset, !!(dentry->d_flags & DCACHE_NOKEY_NAME));
 
-	mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
+	mdsc = ceph_sb_to_fs_client(dir->i_sb)->mdsc;
 
 	/* always trust cached snapped dentries, snapdir dentry */
 	if (ceph_snap(dir) != CEPH_NOSNAP) {
@@ -1986,7 +1986,7 @@ static int ceph_d_delete(const struct dentry *dentry)
 static void ceph_d_release(struct dentry *dentry)
 {
 	struct ceph_dentry_info *di = ceph_dentry(dentry);
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
 
 	dout("d_release %p\n", dentry);
 
@@ -2055,7 +2055,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
 	int left;
 	const int bufsize = 1024;
 
-	if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
+	if (!ceph_test_mount_opt(ceph_sb_to_fs_client(inode->i_sb), DIRSTAT))
 		return -EISDIR;
 
 	if (!dfi->dir_info) {
fs/ceph/export.c +5 -5
index 8559990a59a5..52c4daf2447d 100644
@@ -123,7 +123,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
 
 static struct inode *__lookup_inode(struct super_block *sb, u64 ino)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
 	struct inode *inode;
 	struct ceph_vino vino;
 	int err;
@@ -205,7 +205,7 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
 					  struct ceph_nfs_snapfh *sfh,
 					  bool want_parent)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
 	struct ceph_mds_request *req;
 	struct inode *inode;
 	struct ceph_vino vino;
@@ -317,7 +317,7 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb,
 static struct dentry *__get_parent(struct super_block *sb,
 				   struct dentry *child, u64 ino)
 {
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
 	struct ceph_mds_request *req;
 	struct inode *inode;
 	int mask;
@@ -439,7 +439,7 @@ static int __get_snap_name(struct dentry *parent, char *name,
 {
 	struct inode *inode = d_inode(child);
 	struct inode *dir = d_inode(parent);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_mds_request *req = NULL;
 	char *last_name = NULL;
 	unsigned next_offset = 2;
@@ -544,7 +544,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
 	if (ceph_snap(inode) != CEPH_NOSNAP)
 		return __get_snap_name(parent, name, child);
 
-	mdsc = ceph_inode_to_client(inode)->mdsc;
+	mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME,
 				       USE_ANY_MDS);
 	if (IS_ERR(req))
fs/ceph/file.c +12 -12
index 04bc4cc8ad9b..344f0b6260bd 100644
@@ -200,7 +200,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mount_options *opt =
-		ceph_inode_to_client(&ci->netfs.inode)->mount_options;
+		ceph_inode_to_fs_client(&ci->netfs.inode)->mount_options;
 	struct ceph_file_info *fi;
 	int ret;
 
@@ -234,7 +234,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
 
 	spin_lock_init(&fi->rw_contexts_lock);
 	INIT_LIST_HEAD(&fi->rw_contexts);
-	fi->filp_gen = READ_ONCE(ceph_inode_to_client(inode)->filp_gen);
+	fi->filp_gen = READ_ONCE(ceph_inode_to_fs_client(inode)->filp_gen);
 
 	if ((file->f_mode & FMODE_WRITE) && ceph_has_inline_data(ci)) {
 		ret = ceph_uninline_data(file);
@@ -352,7 +352,7 @@ int ceph_renew_caps(struct inode *inode, int fmode)
 int ceph_open(struct inode *inode, struct file *file)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_file_info *fi = file->private_data;
@@ -730,7 +730,7 @@ static int ceph_finish_async_create(struct inode *dir, struct inode *inode,
 int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
 		     struct file *file, unsigned flags, umode_t mode)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	struct inode *new_inode = NULL;
@@ -959,7 +959,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
 			 u64 *last_objver)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	ssize_t ret;
 	u64 off = *ki_pos;
@@ -1252,7 +1252,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
 		if (aio_work) {
 			INIT_WORK(&aio_work->work, ceph_aio_retry_work);
 			aio_work->req = req;
-			queue_work(ceph_inode_to_client(inode)->inode_wq,
+			queue_work(ceph_inode_to_fs_client(inode)->inode_wq,
 				   &aio_work->work);
 			return;
 		}
@@ -1382,7 +1382,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_client_metric *metric = &fsc->mdsc->metric;
 	struct ceph_vino vino;
 	struct ceph_osd_request *req;
@@ -1606,7 +1606,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	struct ceph_osd_request *req;
 	struct page **pages;
@@ -2159,7 +2159,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	struct ceph_file_info *fi = file->private_data;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	struct ceph_cap_flush *prealloc_cf;
 	ssize_t count, written = 0;
@@ -2399,7 +2399,7 @@ static int ceph_zero_partial_object(struct inode *inode,
 				    loff_t offset, loff_t *length)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_osd_request *req;
 	int ret = 0;
 	loff_t zero = 0;
@@ -2782,7 +2782,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
 	struct ceph_inode_info *src_ci = ceph_inode(src_inode);
 	struct ceph_inode_info *dst_ci = ceph_inode(dst_inode);
 	struct ceph_cap_flush *prealloc_cf;
-	struct ceph_fs_client *src_fsc = ceph_inode_to_client(src_inode);
+	struct ceph_fs_client *src_fsc = ceph_inode_to_fs_client(src_inode);
 	loff_t size;
 	ssize_t ret = -EIO, bytes;
 	u64 src_objnum, dst_objnum, src_objoff, dst_objoff;
@@ -2790,7 +2790,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
 	int src_got = 0, dst_got = 0, err, dirty;
 
 	if (src_inode->i_sb != dst_inode->i_sb) {
-		struct ceph_fs_client *dst_fsc = ceph_inode_to_client(dst_inode);
+		struct ceph_fs_client *dst_fsc = ceph_inode_to_fs_client(dst_inode);
 
 		if (ceph_fsid_compare(&src_fsc->client->fsid,
 				      &dst_fsc->client->fsid)) {
fs/ceph/inode.c +7 -7
index fe8adb9d67a6..c283ea632c51 100644
@@ -1497,7 +1497,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
 	struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
 	struct inode *in = NULL;
 	struct ceph_vino tvino, dvino;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 	int err = 0;
 
 	dout("fill_trace %p is_dentry %d is_target %d\n", req,
@@ -2087,7 +2087,7 @@ bool ceph_inode_set_size(struct inode *inode, loff_t size)
 
 void ceph_queue_inode_work(struct inode *inode, int work_bit)
 {
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	set_bit(work_bit, &ci->i_work_mask);
 
@@ -2429,7 +2429,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	unsigned int ia_valid = attr->ia_valid;
 	struct ceph_mds_request *req;
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_cap_flush *prealloc_cf;
 	loff_t isize = i_size_read(inode);
 	int issued;
@@ -2741,7 +2741,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 		 struct iattr *attr)
 {
 	struct inode *inode = d_inode(dentry);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	int err;
 
 	if (ceph_snap(inode) != CEPH_NOSNAP)
@@ -2811,7 +2811,7 @@ int ceph_try_to_choose_auth_mds(struct inode *inode, int mask)
 int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
 		      int mask, bool force)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int mode;
@@ -2857,7 +2857,7 @@ int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
 int ceph_do_getvxattr(struct inode *inode, const char *name, void *value,
 		      size_t size)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	struct ceph_mds_request *req;
 	int mode = USE_AUTH_MDS;
@@ -3002,7 +3002,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path,
 		stat->dev = ci->i_snapid_map ? ci->i_snapid_map->dev : 0;
 
 	if (S_ISDIR(inode->i_mode)) {
-		if (ceph_test_mount_opt(ceph_sb_to_client(sb), RBYTES)) {
+		if (ceph_test_mount_opt(ceph_sb_to_fs_client(sb), RBYTES)) {
 			stat->size = ci->i_rbytes;
 		} else if (ceph_snap(inode) == CEPH_SNAPDIR) {
 			struct ceph_inode_info *pci;
fs/ceph/ioctl.c +4 -4
index 679402bd80ba..64d8e34d9f7e 100644
@@ -65,7 +65,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
 static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
 {
 	struct inode *inode = file_inode(file);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_mds_request *req;
 	struct ceph_ioctl_layout l;
 	struct ceph_inode_info *ci = ceph_inode(file_inode(file));
@@ -140,7 +140,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
 	struct ceph_mds_request *req;
 	struct ceph_ioctl_layout l;
 	int err;
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 
 	/* copy and validate */
 	if (copy_from_user(&l, arg, sizeof(l)))
@@ -183,7 +183,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_osd_client *osdc =
-		&ceph_sb_to_client(inode->i_sb)->client->osdc;
+		&ceph_sb_to_fs_client(inode->i_sb)->client->osdc;
 	struct ceph_object_locator oloc;
 	CEPH_DEFINE_OID_ONSTACK(oid);
 	u32 xlen;
@@ -244,7 +244,7 @@ static long ceph_ioctl_lazyio(struct file *file)
 	struct ceph_file_info *fi = file->private_data;
 	struct inode *inode = file_inode(file);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 
 	if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
 		spin_lock(&ci->i_ceph_lock);
fs/ceph/mds_client.c +1 -1
index b9c7b6c60357..a730bd98a4d2 100644
@@ -829,7 +829,7 @@ static void destroy_reply_info(struct ceph_mds_reply_info_parsed *info)
  */
 int ceph_wait_on_conflict_unlink(struct dentry *dentry)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
 	struct dentry *pdentry = dentry->d_parent;
 	struct dentry *udentry, *found = NULL;
 	struct ceph_dentry_info *di;
fs/ceph/snap.c +1 -1
index 5bd47829a005..09939ec0d1ee 100644
@@ -963,7 +963,7 @@ static void flush_snaps(struct ceph_mds_client *mdsc)
 void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm)
 {
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 	struct ceph_snap_realm *oldrealm = ci->i_snap_realm;
 
 	lockdep_assert_held(&ci->i_ceph_lock);
fs/ceph/super.c +11 -11
index 070b3150d267..e0c9ed100767 100644
@@ -44,7 +44,7 @@ static LIST_HEAD(ceph_fsc_list);
  */
 static void ceph_put_super(struct super_block *s)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(s);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(s);
 
 	dout("put_super\n");
 	ceph_fscrypt_free_dummy_policy(fsc);
@@ -53,7 +53,7 @@ static void ceph_put_super(struct super_block *s)
 
 static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-	struct ceph_fs_client *fsc = ceph_inode_to_client(d_inode(dentry));
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(d_inode(dentry));
 	struct ceph_mon_client *monc = &fsc->client->monc;
 	struct ceph_statfs st;
 	int i, err;
@@ -118,7 +118,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 static int ceph_sync_fs(struct super_block *sb, int wait)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
 	if (!wait) {
 		dout("sync_fs (non-blocking)\n");
@@ -695,7 +695,7 @@ static int compare_mount_options(struct ceph_mount_options *new_fsopt,
  */
 static int ceph_show_options(struct seq_file *m, struct dentry *root)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(root->d_sb);
 	struct ceph_mount_options *fsopt = fsc->mount_options;
 	size_t pos;
 	int ret;
@@ -1026,7 +1026,7 @@ static void __ceph_umount_begin(struct ceph_fs_client *fsc)
  */
 void ceph_umount_begin(struct super_block *sb)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
 	dout("ceph_umount_begin - starting forced umount\n");
 	if (!fsc)
@@ -1236,7 +1236,7 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
 	struct ceph_fs_client *new = fc->s_fs_info;
 	struct ceph_mount_options *fsopt = new->mount_options;
 	struct ceph_options *opt = new->client->options;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
 	dout("ceph_compare_super %p\n", sb);
 
@@ -1332,9 +1332,9 @@ static int ceph_get_tree(struct fs_context *fc)
 		goto out;
 	}
 
-	if (ceph_sb_to_client(sb) != fsc) {
+	if (ceph_sb_to_fs_client(sb) != fsc) {
 		destroy_fs_client(fsc);
-		fsc = ceph_sb_to_client(sb);
+		fsc = ceph_sb_to_fs_client(sb);
 		dout("get_sb got existing client %p\n", fsc);
 	} else {
 		dout("get_sb using new client %p\n", fsc);
@@ -1387,7 +1387,7 @@ static int ceph_reconfigure_fc(struct fs_context *fc)
 	struct ceph_parse_opts_ctx *pctx = fc->fs_private;
 	struct ceph_mount_options *fsopt = pctx->opts;
 	struct super_block *sb = fc->root->d_sb;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
 	err = ceph_apply_test_dummy_encryption(sb, fc, fsopt);
 	if (err)
@@ -1526,7 +1526,7 @@ void ceph_dec_osd_stopping_blocker(struct ceph_mds_client *mdsc)
 
 static void ceph_kill_sb(struct super_block *s)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(s);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(s);
 	struct ceph_mds_client *mdsc = fsc->mdsc;
 	bool wait;
 
@@ -1587,7 +1587,7 @@ MODULE_ALIAS_FS("ceph");
 
 int ceph_force_reconnect(struct super_block *sb)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 	int err = 0;
 
 	fsc->mount_state = CEPH_MOUNT_RECOVER;
fs/ceph/super.h +5 -5
index ab5c0c703eae..9655ea46e6ca 100644
@@ -490,13 +490,13 @@ ceph_inode(const struct inode *inode)
 }
 
 static inline struct ceph_fs_client *
-ceph_inode_to_client(const struct inode *inode)
+ceph_inode_to_fs_client(const struct inode *inode)
 {
 	return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
 }
 
 static inline struct ceph_fs_client *
-ceph_sb_to_client(const struct super_block *sb)
+ceph_sb_to_fs_client(const struct super_block *sb)
 {
 	return (struct ceph_fs_client *)sb->s_fs_info;
 }
@@ -504,7 +504,7 @@ ceph_sb_to_client(const struct super_block *sb)
 static inline struct ceph_mds_client *
 ceph_sb_to_mdsc(const struct super_block *sb)
 {
-	return (struct ceph_mds_client *)ceph_sb_to_client(sb)->mdsc;
+	return (struct ceph_mds_client *)ceph_sb_to_fs_client(sb)->mdsc;
 }
 
 static inline struct ceph_vino
@@ -560,7 +560,7 @@ static inline u64 ceph_snap(struct inode *inode)
  */
 static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
 {
-	if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)))
+	if (unlikely(ceph_test_mount_opt(ceph_sb_to_fs_client(sb), INO32)))
 		return ceph_ino_to_ino32(ino);
 	return ino;
 }
@@ -1106,7 +1106,7 @@ void ceph_inode_shutdown(struct inode *inode);
 static inline bool ceph_inode_is_shutdown(struct inode *inode)
 {
 	unsigned long flags = READ_ONCE(ceph_inode(inode)->i_ceph_flags);
-	struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+	struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 	int state = READ_ONCE(fsc->mount_state);
 
 	return (flags & CEPH_I_SHUTDOWN) || state >= CEPH_MOUNT_SHUTDOWN;
fs/ceph/xattr.c +6 -6
index 76680e5c2f82..e30ae1032e13 100644
@@ -57,7 +57,7 @@ static bool ceph_vxattrcb_layout_exists(struct ceph_inode_info *ci)
 static ssize_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
 				    size_t size)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	struct ceph_string *pool_ns;
 	s64 pool = ci->i_layout.pool_id;
@@ -161,7 +161,7 @@ static ssize_t ceph_vxattrcb_layout_pool(struct ceph_inode_info *ci,
 					 char *val, size_t size)
 {
 	ssize_t ret;
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 	struct ceph_osd_client *osdc = &fsc->client->osdc;
 	s64 pool = ci->i_layout.pool_id;
 	const char *pool_name;
@@ -313,7 +313,7 @@ static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
 static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
 					  char *val, size_t size)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 
 	return ceph_fmt_xattr(val, size, "%pU", &fsc->client->fsid);
 }
@@ -321,7 +321,7 @@ static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
 static ssize_t ceph_vxattrcb_client_id(struct ceph_inode_info *ci,
 				       char *val, size_t size)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 
 	return ceph_fmt_xattr(val, size, "client%lld",
 			      ceph_client_gid(fsc->client));
@@ -1093,7 +1093,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 static int ceph_sync_setxattr(struct inode *inode, const char *name,
 			      const char *value, size_t size, int flags)
 {
-	struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+	struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
 	struct ceph_inode_info *ci = ceph_inode(inode);
 	struct ceph_mds_request *req;
 	struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -1163,7 +1163,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
 {
 	struct ceph_vxattr *vxattr;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+	struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 	struct ceph_cap_flush *prealloc_cf = NULL;
 	struct ceph_buffer *old_blob = NULL;
 	int issued;
Signature · 1 line
2.40.1
Tested-by Tested-by Venky Shankar Reviewed-by Reviewed-by Venky Shankar on v4 3/6
#6 lore raw

Re: [PATCH v4 3/6] ceph: rename _to_client() to _to_fs_client()

Looks good to me.

Quoted 934 lines · On Mon, Jun 19, 2023 at 12:47 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

We need to covert the inode to ceph_client in the following commit, and will add one new helper for that, here we rename the old helper to _fs_client().

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/addr.c       | 20 ++++++++++----------
 fs/ceph/cache.c      |  2 +-
 fs/ceph/caps.c       | 40 ++++++++++++++++++++--------------------
 fs/ceph/crypto.c     |  2 +-
 fs/ceph/dir.c        | 22 +++++++++++-----------
 fs/ceph/export.c     | 10 +++++-----
 fs/ceph/file.c       | 24 ++++++++++++------------
 fs/ceph/inode.c      | 14 +++++++-------
 fs/ceph/ioctl.c      |  8 ++++----
 fs/ceph/mds_client.c |  2 +-
 fs/ceph/snap.c       |  2 +-
 fs/ceph/super.c      | 22 +++++++++++-----------
 fs/ceph/super.h      | 10 +++++-----
 fs/ceph/xattr.c      | 12 ++++++------
 14 files changed, 95 insertions(+), 95 deletions(-)
fs/ceph/addr.c +10 -10
index de9b82905f18..e62318b3e13d 100644
@@ -229,7 +229,7 @@ static void ceph_netfs_expand_readahead(struct netfs_io_request *rreq)
 static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
 {
        struct inode *inode = subreq->rreq->inode;
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_inode_info *ci = ceph_inode(inode);
        u64 objno, objoff;
        u32 xlen;
@@ -244,7 +244,7 @@ static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
 static void finish_netfs_read(struct ceph_osd_request *req)
 {
        struct inode *inode = req->r_inode;
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0);
        struct netfs_io_subrequest *subreq = req->r_priv;
        struct ceph_osd_req_op *op = &req->r_ops[0];
@@ -347,7 +347,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
        struct netfs_io_request *rreq = subreq->rreq;
        struct inode *inode = rreq->inode;
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_request *req = NULL;
        struct ceph_vino vino = ceph_vino(inode);
        struct iov_iter iter;
@@ -655,7 +655,7 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
        struct folio *folio = page_folio(page);
        struct inode *inode = page->mapping->host;
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_snap_context *snapc, *oldest;
        loff_t page_off = page_offset(page);
        int err;
@@ -799,7 +799,7 @@ static int ceph_writepage(struct page *page, struct writeback_control *wbc)
        ihold(inode);
 
        if (wbc->sync_mode == WB_SYNC_NONE &&
-           ceph_inode_to_client(inode)->write_congested)
+           ceph_inode_to_fs_client(inode)->write_congested)
                return AOP_WRITEPAGE_ACTIVATE;
 
        wait_on_page_fscache(page);
@@ -832,7 +832,7 @@ static void writepages_finish(struct ceph_osd_request *req)
        int rc = req->r_result;
        struct ceph_snap_context *snapc = req->r_snapc;
        struct address_space *mapping = inode->i_mapping;
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        unsigned int len = 0;
        bool remove_page;
 
@@ -922,7 +922,7 @@ static int ceph_writepages_start(struct address_space *mapping,
 {
        struct inode *inode = mapping->host;
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_vino vino = ceph_vino(inode);
        pgoff_t index, start_index, end = -1;
        struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc;
@@ -1819,7 +1819,7 @@ int ceph_uninline_data(struct file *file)
 {
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_request *req = NULL;
        struct ceph_cap_flush *prealloc_cf = NULL;
        struct folio *folio = NULL;
@@ -1973,7 +1973,7 @@ enum {
 static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
                                s64 pool, struct ceph_string *pool_ns)
 {
-       struct ceph_fs_client *fsc = ceph_inode_to_client(&ci->netfs.inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(&ci->netfs.inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_osd_request *rd_req = NULL, *wr_req = NULL;
        struct rb_node **p, *parent;
@@ -2164,7 +2164,7 @@ int ceph_pool_perm_check(struct inode *inode, int need)
                return 0;
        }
 
-       if (ceph_test_mount_opt(ceph_inode_to_client(inode),
+       if (ceph_test_mount_opt(ceph_inode_to_fs_client(inode),
                                NOPOOLPERM))
                return 0;
 
fs/ceph/cache.c +1 -1
index 177d8e8d73fe..fedb8108c9f5 100644
@@ -15,7 +15,7 @@
 void ceph_fscache_register_inode_cookie(struct inode *inode)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 
        /* No caching for filesystem? */
        if (!fsc->fscache)
fs/ceph/caps.c +20 -20
index 99e805144935..4538c8280c70 100644
@@ -635,7 +635,7 @@ void ceph_add_cap(struct inode *inode,
                  unsigned seq, unsigned mseq, u64 realmino, int flags,
                  struct ceph_cap **new_cap)
 {
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_cap *cap;
        int mds = session->s_mds;
@@ -922,7 +922,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
 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->netfs.inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
        int r;
 
        r = __ceph_caps_issued_mask(ci, mask, touch);
@@ -996,7 +996,7 @@ int __ceph_caps_file_wanted(struct ceph_inode_info *ci)
        const int WR_SHIFT = ffs(CEPH_FILE_MODE_WR);
        const int LAZY_SHIFT = ffs(CEPH_FILE_MODE_LAZY);
        struct ceph_mount_options *opt =
-               ceph_inode_to_client(&ci->netfs.inode)->mount_options;
+               ceph_inode_to_fs_client(&ci->netfs.inode)->mount_options;
        unsigned long used_cutoff = jiffies - opt->caps_wanted_delay_max * HZ;
        unsigned long idle_cutoff = jiffies - opt->caps_wanted_delay_min * HZ;
 
@@ -1121,7 +1121,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)
 
        dout("__ceph_remove_cap %p from %p\n", cap, &ci->netfs.inode);
 
-       mdsc = ceph_inode_to_client(&ci->netfs.inode)->mdsc;
+       mdsc = ceph_inode_to_fs_client(&ci->netfs.inode)->mdsc;
 
        /* remove from inode's cap rbtree, and clear auth cap */
        rb_erase(&cap->ci_node, &ci->i_caps);
@@ -1192,7 +1192,7 @@ void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
 
        lockdep_assert_held(&ci->i_ceph_lock);
 
-       fsc = ceph_inode_to_client(&ci->netfs.inode);
+       fsc = ceph_inode_to_fs_client(&ci->netfs.inode);
        WARN_ON_ONCE(ci->i_auth_cap == cap &&
                     !list_empty(&ci->i_dirty_item) &&
                     !fsc->blocklisted &&
@@ -1343,7 +1343,7 @@ static void encode_cap_msg(struct ceph_msg *msg, struct cap_msg_args *arg)
 void __ceph_remove_caps(struct ceph_inode_info *ci)
 {
        struct inode *inode = &ci->netfs.inode;
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct rb_node *p;
 
        /* lock i_ceph_lock, because ceph_d_revalidate(..., LOOKUP_RCU)
@@ -1685,7 +1685,7 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,
                      struct ceph_mds_session **psession)
 {
        struct inode *inode = &ci->netfs.inode;
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct ceph_mds_session *session = NULL;
        bool need_put = false;
        int mds;
@@ -1750,7 +1750,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,
                           struct ceph_cap_flush **pcf)
 {
        struct ceph_mds_client *mdsc =
-               ceph_sb_to_client(ci->netfs.inode.i_sb)->mdsc;
+               ceph_sb_to_fs_client(ci->netfs.inode.i_sb)->mdsc;
        struct inode *inode = &ci->netfs.inode;
        int was = ci->i_dirty_caps;
        int dirty = 0;
@@ -1873,7 +1873,7 @@ static u64 __mark_caps_flushing(struct inode *inode,
                                struct ceph_mds_session *session, bool wake,
                                u64 *oldest_flush_tid)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_cap_flush *cf = NULL;
        int flushing;
@@ -2233,7 +2233,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
  */
 static int try_flush_caps(struct inode *inode, u64 *ptid)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_inode_info *ci = ceph_inode(inode);
        int flushing = 0;
        u64 flush_tid = 0, oldest_flush_tid = 0;
@@ -2311,7 +2311,7 @@ static int caps_are_flushed(struct inode *inode, u64 flush_tid)
  */
 static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mds_request *req1 = NULL, *req2 = NULL;
        int ret, err = 0;
@@ -2494,7 +2494,7 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)
                                       caps_are_flushed(inode, flush_tid));
        } else {
                struct ceph_mds_client *mdsc =
-                       ceph_sb_to_client(inode->i_sb)->mdsc;
+                       ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 
                spin_lock(&ci->i_ceph_lock);
                if (__ceph_caps_dirty(ci))
@@ -2747,7 +2747,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,
                            loff_t endoff, int flags, int *got)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        int ret = 0;
        int have, implemented;
        bool snap_rwsem_locked = false;
@@ -2965,7 +2965,7 @@ int __ceph_get_caps(struct inode *inode, struct ceph_file_info *fi, int need,
                    int want, loff_t endoff, int *got)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        int ret, _got, flags;
 
        ret = ceph_pool_perm_check(inode, need);
@@ -3717,7 +3717,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
        __releases(ci->i_ceph_lock)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_cap_flush *cf, *tmp_cf;
        LIST_HEAD(to_remove);
        unsigned seq = le32_to_cpu(m->seq);
@@ -3827,7 +3827,7 @@ void __ceph_remove_capsnap(struct inode *inode, struct ceph_cap_snap *capsnap,
                           bool *wake_ci, bool *wake_mdsc)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        bool ret;
 
        lockdep_assert_held(&ci->i_ceph_lock);
@@ -3871,7 +3871,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,
                                     struct ceph_mds_session *session)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        u64 follows = le64_to_cpu(m->snap_follows);
        struct ceph_cap_snap *capsnap = NULL, *iter;
        bool wake_ci = false;
@@ -3964,7 +3964,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
                              struct ceph_mds_cap_peer *ph,
                              struct ceph_mds_session *session)
 {
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct ceph_mds_session *tsession = NULL;
        struct ceph_cap *cap, *tcap, *new_cap = NULL;
        struct ceph_inode_info *ci = ceph_inode(inode);
@@ -4672,7 +4672,7 @@ int ceph_drop_caps_for_unlink(struct inode *inode)
 
                if (__ceph_caps_dirty(ci)) {
                        struct ceph_mds_client *mdsc =
-                               ceph_inode_to_client(inode)->mdsc;
+                               ceph_inode_to_fs_client(inode)->mdsc;
                        __cap_delay_requeue_front(mdsc, ci);
                }
        }
@@ -4855,7 +4855,7 @@ static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode)
 
 int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invalidate)
 {
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_inode_info *ci = ceph_inode(inode);
        bool is_auth;
fs/ceph/crypto.c +1 -1
index e72bab29d5e1..4b0e9c3a53c8 100644
@@ -128,7 +128,7 @@ static bool ceph_crypt_empty_dir(struct inode *inode)
 
 static const union fscrypt_policy *ceph_get_dummy_policy(struct super_block *sb)
 {
-       return ceph_sb_to_client(sb)->fsc_dummy_enc_policy.policy;
+       return ceph_sb_to_fs_client(sb)->fsc_dummy_enc_policy.policy;
 }
 
 static struct fscrypt_operations ceph_fscrypt_ops = {
fs/ceph/dir.c +11 -11
index 5fbcd0d5e5ec..69906b721992 100644
@@ -310,7 +310,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
        struct ceph_dir_file_info *dfi = file->private_data;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        int i;
        int err;
@@ -702,7 +702,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
 struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,
                                   struct dentry *dentry)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
        struct inode *parent = d_inode(dentry->d_parent); /* we hold i_rwsem */
 
        /* .snap dir? */
@@ -770,7 +770,7 @@ static bool is_root_ceph_dentry(struct inode *inode, struct dentry *dentry)
 static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,
                                  unsigned int flags)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
        struct ceph_mds_request *req;
        int op;
@@ -1192,7 +1192,7 @@ static void ceph_async_unlink_cb(struct ceph_mds_client *mdsc,
                                 struct ceph_mds_request *req)
 {
        struct dentry *dentry = req->r_dentry;
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
        struct ceph_dentry_info *di = ceph_dentry(dentry);
        int result = req->r_err ? req->r_err :
                        le32_to_cpu(req->r_reply_info.head->result);
@@ -1283,7 +1283,7 @@ static int get_caps_for_async_unlink(struct inode *dir, struct dentry *dentry)
  */
 static int ceph_unlink(struct inode *dir, struct dentry *dentry)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct inode *inode = d_inode(dentry);
        struct ceph_mds_request *req;
@@ -1461,7 +1461,7 @@ void __ceph_dentry_lease_touch(struct ceph_dentry_info *di)
                return;
        }
 
-       mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
+       mdsc = ceph_sb_to_fs_client(dn->d_sb)->mdsc;
        spin_lock(&mdsc->dentry_list_lock);
        list_move_tail(&di->lease_list, &mdsc->dentry_leases);
        spin_unlock(&mdsc->dentry_list_lock);
@@ -1508,7 +1508,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)
                return;
        }
 
-       mdsc = ceph_sb_to_client(dn->d_sb)->mdsc;
+       mdsc = ceph_sb_to_fs_client(dn->d_sb)->mdsc;
        spin_lock(&mdsc->dentry_list_lock);
        __dentry_dir_lease_touch(mdsc, di),
        spin_unlock(&mdsc->dentry_list_lock);
@@ -1522,7 +1522,7 @@ static void __dentry_lease_unlist(struct ceph_dentry_info *di)
        if (list_empty(&di->lease_list))
                return;
 
-       mdsc = ceph_sb_to_client(di->dentry->d_sb)->mdsc;
+       mdsc = ceph_sb_to_fs_client(di->dentry->d_sb)->mdsc;
        spin_lock(&mdsc->dentry_list_lock);
        list_del_init(&di->lease_list);
        spin_unlock(&mdsc->dentry_list_lock);
@@ -1879,7 +1879,7 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags)
        dout("d_revalidate %p '%pd' inode %p offset 0x%llx nokey %d\n", dentry,
             dentry, inode, ceph_dentry(dentry)->offset, !!(dentry->d_flags & DCACHE_NOKEY_NAME));
 
-       mdsc = ceph_sb_to_client(dir->i_sb)->mdsc;
+       mdsc = ceph_sb_to_fs_client(dir->i_sb)->mdsc;
 
        /* always trust cached snapped dentries, snapdir dentry */
        if (ceph_snap(dir) != CEPH_NOSNAP) {
@@ -1986,7 +1986,7 @@ static int ceph_d_delete(const struct dentry *dentry)
 static void ceph_d_release(struct dentry *dentry)
 {
        struct ceph_dentry_info *di = ceph_dentry(dentry);
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
 
        dout("d_release %p\n", dentry);
 
@@ -2055,7 +2055,7 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size,
        int left;
        const int bufsize = 1024;
 
-       if (!ceph_test_mount_opt(ceph_sb_to_client(inode->i_sb), DIRSTAT))
+       if (!ceph_test_mount_opt(ceph_sb_to_fs_client(inode->i_sb), DIRSTAT))
                return -EISDIR;
 
        if (!dfi->dir_info) {
fs/ceph/export.c +5 -5
index 8559990a59a5..52c4daf2447d 100644
@@ -123,7 +123,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
 
 static struct inode *__lookup_inode(struct super_block *sb, u64 ino)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
        struct inode *inode;
        struct ceph_vino vino;
        int err;
@@ -205,7 +205,7 @@ static struct dentry *__snapfh_to_dentry(struct super_block *sb,
                                          struct ceph_nfs_snapfh *sfh,
                                          bool want_parent)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
        struct ceph_mds_request *req;
        struct inode *inode;
        struct ceph_vino vino;
@@ -317,7 +317,7 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb,
 static struct dentry *__get_parent(struct super_block *sb,
                                   struct dentry *child, u64 ino)
 {
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(sb)->mdsc;
        struct ceph_mds_request *req;
        struct inode *inode;
        int mask;
@@ -439,7 +439,7 @@ static int __get_snap_name(struct dentry *parent, char *name,
 {
        struct inode *inode = d_inode(child);
        struct inode *dir = d_inode(parent);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_mds_request *req = NULL;
        char *last_name = NULL;
        unsigned next_offset = 2;
@@ -544,7 +544,7 @@ static int ceph_get_name(struct dentry *parent, char *name,
        if (ceph_snap(inode) != CEPH_NOSNAP)
                return __get_snap_name(parent, name, child);
 
-       mdsc = ceph_inode_to_client(inode)->mdsc;
+       mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPNAME,
                                       USE_ANY_MDS);
        if (IS_ERR(req))
fs/ceph/file.c +12 -12
index 04bc4cc8ad9b..344f0b6260bd 100644
@@ -200,7 +200,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mount_options *opt =
-               ceph_inode_to_client(&ci->netfs.inode)->mount_options;
+               ceph_inode_to_fs_client(&ci->netfs.inode)->mount_options;
        struct ceph_file_info *fi;
        int ret;
 
@@ -234,7 +234,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
 
        spin_lock_init(&fi->rw_contexts_lock);
        INIT_LIST_HEAD(&fi->rw_contexts);
-       fi->filp_gen = READ_ONCE(ceph_inode_to_client(inode)->filp_gen);
+       fi->filp_gen = READ_ONCE(ceph_inode_to_fs_client(inode)->filp_gen);
 
        if ((file->f_mode & FMODE_WRITE) && ceph_has_inline_data(ci)) {
                ret = ceph_uninline_data(file);
@@ -352,7 +352,7 @@ int ceph_renew_caps(struct inode *inode, int fmode)
 int ceph_open(struct inode *inode, struct file *file)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_mds_request *req;
        struct ceph_file_info *fi = file->private_data;
@@ -730,7 +730,7 @@ static int ceph_finish_async_create(struct inode *dir, struct inode *inode,
 int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
                     struct file *file, unsigned flags, umode_t mode)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dir->i_sb);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_mds_request *req;
        struct inode *new_inode = NULL;
@@ -959,7 +959,7 @@ ssize_t __ceph_sync_read(struct inode *inode, loff_t *ki_pos,
                         u64 *last_objver)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_client *osdc = &fsc->client->osdc;
        ssize_t ret;
        u64 off = *ki_pos;
@@ -1252,7 +1252,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
                if (aio_work) {
                        INIT_WORK(&aio_work->work, ceph_aio_retry_work);
                        aio_work->req = req;
-                       queue_work(ceph_inode_to_client(inode)->inode_wq,
+                       queue_work(ceph_inode_to_fs_client(inode)->inode_wq,
                                   &aio_work->work);
                        return;
                }
@@ -1382,7 +1382,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
        struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_client_metric *metric = &fsc->mdsc->metric;
        struct ceph_vino vino;
        struct ceph_osd_request *req;
@@ -1606,7 +1606,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
        struct file *file = iocb->ki_filp;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_client *osdc = &fsc->client->osdc;
        struct ceph_osd_request *req;
        struct page **pages;
@@ -2159,7 +2159,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
        struct ceph_file_info *fi = file->private_data;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_client *osdc = &fsc->client->osdc;
        struct ceph_cap_flush *prealloc_cf;
        ssize_t count, written = 0;
@@ -2399,7 +2399,7 @@ static int ceph_zero_partial_object(struct inode *inode,
                                    loff_t offset, loff_t *length)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_osd_request *req;
        int ret = 0;
        loff_t zero = 0;
@@ -2782,7 +2782,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
        struct ceph_inode_info *src_ci = ceph_inode(src_inode);
        struct ceph_inode_info *dst_ci = ceph_inode(dst_inode);
        struct ceph_cap_flush *prealloc_cf;
-       struct ceph_fs_client *src_fsc = ceph_inode_to_client(src_inode);
+       struct ceph_fs_client *src_fsc = ceph_inode_to_fs_client(src_inode);
        loff_t size;
        ssize_t ret = -EIO, bytes;
        u64 src_objnum, dst_objnum, src_objoff, dst_objoff;
@@ -2790,7 +2790,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
        int src_got = 0, dst_got = 0, err, dirty;
 
        if (src_inode->i_sb != dst_inode->i_sb) {
-               struct ceph_fs_client *dst_fsc = ceph_inode_to_client(dst_inode);
+               struct ceph_fs_client *dst_fsc = ceph_inode_to_fs_client(dst_inode);
 
                if (ceph_fsid_compare(&src_fsc->client->fsid,
                                      &dst_fsc->client->fsid)) {
fs/ceph/inode.c +7 -7
index fe8adb9d67a6..c283ea632c51 100644
@@ -1497,7 +1497,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req)
        struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info;
        struct inode *in = NULL;
        struct ceph_vino tvino, dvino;
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
        int err = 0;
 
        dout("fill_trace %p is_dentry %d is_target %d\n", req,
@@ -2087,7 +2087,7 @@ bool ceph_inode_set_size(struct inode *inode, loff_t size)
 
 void ceph_queue_inode_work(struct inode *inode, int work_bit)
 {
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_inode_info *ci = ceph_inode(inode);
        set_bit(work_bit, &ci->i_work_mask);
 
@@ -2429,7 +2429,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr, struct ceph_iattr *c
        struct ceph_inode_info *ci = ceph_inode(inode);
        unsigned int ia_valid = attr->ia_valid;
        struct ceph_mds_request *req;
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_cap_flush *prealloc_cf;
        loff_t isize = i_size_read(inode);
        int issued;
@@ -2741,7 +2741,7 @@ int ceph_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
                 struct iattr *attr)
 {
        struct inode *inode = d_inode(dentry);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        int err;
 
        if (ceph_snap(inode) != CEPH_NOSNAP)
@@ -2811,7 +2811,7 @@ int ceph_try_to_choose_auth_mds(struct inode *inode, int mask)
 int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
                      int mask, bool force)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_mds_request *req;
        int mode;
@@ -2857,7 +2857,7 @@ int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
 int ceph_do_getvxattr(struct inode *inode, const char *name, void *value,
                      size_t size)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        struct ceph_mds_request *req;
        int mode = USE_AUTH_MDS;
@@ -3002,7 +3002,7 @@ int ceph_getattr(struct mnt_idmap *idmap, const struct path *path,
                stat->dev = ci->i_snapid_map ? ci->i_snapid_map->dev : 0;
 
        if (S_ISDIR(inode->i_mode)) {
-               if (ceph_test_mount_opt(ceph_sb_to_client(sb), RBYTES)) {
+               if (ceph_test_mount_opt(ceph_sb_to_fs_client(sb), RBYTES)) {
                        stat->size = ci->i_rbytes;
                } else if (ceph_snap(inode) == CEPH_SNAPDIR) {
                        struct ceph_inode_info *pci;
fs/ceph/ioctl.c +4 -4
index 679402bd80ba..64d8e34d9f7e 100644
@@ -65,7 +65,7 @@ static long __validate_layout(struct ceph_mds_client *mdsc,
 static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
 {
        struct inode *inode = file_inode(file);
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
        struct ceph_inode_info *ci = ceph_inode(file_inode(file));
@@ -140,7 +140,7 @@ static long ceph_ioctl_set_layout_policy (struct file *file, void __user *arg)
        struct ceph_mds_request *req;
        struct ceph_ioctl_layout l;
        int err;
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
 
        /* copy and validate */
        if (copy_from_user(&l, arg, sizeof(l)))
@@ -183,7 +183,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_osd_client *osdc =
-               &ceph_sb_to_client(inode->i_sb)->client->osdc;
+               &ceph_sb_to_fs_client(inode->i_sb)->client->osdc;
        struct ceph_object_locator oloc;
        CEPH_DEFINE_OID_ONSTACK(oid);
        u32 xlen;
@@ -244,7 +244,7 @@ static long ceph_ioctl_lazyio(struct file *file)
        struct ceph_file_info *fi = file->private_data;
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
 
        if ((fi->fmode & CEPH_FILE_MODE_LAZY) == 0) {
                spin_lock(&ci->i_ceph_lock);
fs/ceph/mds_client.c +1 -1
index b9c7b6c60357..a730bd98a4d2 100644
@@ -829,7 +829,7 @@ static void destroy_reply_info(struct ceph_mds_reply_info_parsed *info)
  */
 int ceph_wait_on_conflict_unlink(struct dentry *dentry)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(dentry->d_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(dentry->d_sb);
        struct dentry *pdentry = dentry->d_parent;
        struct dentry *udentry, *found = NULL;
        struct ceph_dentry_info *di;
fs/ceph/snap.c +1 -1
index 5bd47829a005..09939ec0d1ee 100644
@@ -963,7 +963,7 @@ static void flush_snaps(struct ceph_mds_client *mdsc)
 void ceph_change_snap_realm(struct inode *inode, struct ceph_snap_realm *realm)
 {
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_inode_to_client(inode)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_inode_to_fs_client(inode)->mdsc;
        struct ceph_snap_realm *oldrealm = ci->i_snap_realm;
 
        lockdep_assert_held(&ci->i_ceph_lock);
fs/ceph/super.c +11 -11
index 070b3150d267..e0c9ed100767 100644
@@ -44,7 +44,7 @@ static LIST_HEAD(ceph_fsc_list);
  */
 static void ceph_put_super(struct super_block *s)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(s);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(s);
 
        dout("put_super\n");
        ceph_fscrypt_free_dummy_policy(fsc);
@@ -53,7 +53,7 @@ static void ceph_put_super(struct super_block *s)
 
 static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
-       struct ceph_fs_client *fsc = ceph_inode_to_client(d_inode(dentry));
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(d_inode(dentry));
        struct ceph_mon_client *monc = &fsc->client->monc;
        struct ceph_statfs st;
        int i, err;
@@ -118,7 +118,7 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 static int ceph_sync_fs(struct super_block *sb, int wait)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
        if (!wait) {
                dout("sync_fs (non-blocking)\n");
@@ -695,7 +695,7 @@ static int compare_mount_options(struct ceph_mount_options *new_fsopt,
  */
 static int ceph_show_options(struct seq_file *m, struct dentry *root)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(root->d_sb);
        struct ceph_mount_options *fsopt = fsc->mount_options;
        size_t pos;
        int ret;
@@ -1026,7 +1026,7 @@ static void __ceph_umount_begin(struct ceph_fs_client *fsc)
  */
 void ceph_umount_begin(struct super_block *sb)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
        dout("ceph_umount_begin - starting forced umount\n");
        if (!fsc)
@@ -1236,7 +1236,7 @@ static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
        struct ceph_fs_client *new = fc->s_fs_info;
        struct ceph_mount_options *fsopt = new->mount_options;
        struct ceph_options *opt = new->client->options;
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
        dout("ceph_compare_super %p\n", sb);
 
@@ -1332,9 +1332,9 @@ static int ceph_get_tree(struct fs_context *fc)
                goto out;
        }
 
-       if (ceph_sb_to_client(sb) != fsc) {
+       if (ceph_sb_to_fs_client(sb) != fsc) {
                destroy_fs_client(fsc);
-               fsc = ceph_sb_to_client(sb);
+               fsc = ceph_sb_to_fs_client(sb);
                dout("get_sb got existing client %p\n", fsc);
        } else {
                dout("get_sb using new client %p\n", fsc);
@@ -1387,7 +1387,7 @@ static int ceph_reconfigure_fc(struct fs_context *fc)
        struct ceph_parse_opts_ctx *pctx = fc->fs_private;
        struct ceph_mount_options *fsopt = pctx->opts;
        struct super_block *sb = fc->root->d_sb;
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
 
        err = ceph_apply_test_dummy_encryption(sb, fc, fsopt);
        if (err)
@@ -1526,7 +1526,7 @@ void ceph_dec_osd_stopping_blocker(struct ceph_mds_client *mdsc)
 
 static void ceph_kill_sb(struct super_block *s)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(s);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(s);
        struct ceph_mds_client *mdsc = fsc->mdsc;
        bool wait;
 
@@ -1587,7 +1587,7 @@ MODULE_ALIAS_FS("ceph");
 
 int ceph_force_reconnect(struct super_block *sb)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(sb);
        int err = 0;
 
        fsc->mount_state = CEPH_MOUNT_RECOVER;
fs/ceph/super.h +5 -5
index ab5c0c703eae..9655ea46e6ca 100644
@@ -490,13 +490,13 @@ ceph_inode(const struct inode *inode)
 }
 
 static inline struct ceph_fs_client *
-ceph_inode_to_client(const struct inode *inode)
+ceph_inode_to_fs_client(const struct inode *inode)
 {
        return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
 }
 
 static inline struct ceph_fs_client *
-ceph_sb_to_client(const struct super_block *sb)
+ceph_sb_to_fs_client(const struct super_block *sb)
 {
        return (struct ceph_fs_client *)sb->s_fs_info;
 }
@@ -504,7 +504,7 @@ ceph_sb_to_client(const struct super_block *sb)
 static inline struct ceph_mds_client *
 ceph_sb_to_mdsc(const struct super_block *sb)
 {
-       return (struct ceph_mds_client *)ceph_sb_to_client(sb)->mdsc;
+       return (struct ceph_mds_client *)ceph_sb_to_fs_client(sb)->mdsc;
 }
 
 static inline struct ceph_vino
@@ -560,7 +560,7 @@ static inline u64 ceph_snap(struct inode *inode)
  */
 static inline u64 ceph_present_ino(struct super_block *sb, u64 ino)
 {
-       if (unlikely(ceph_test_mount_opt(ceph_sb_to_client(sb), INO32)))
+       if (unlikely(ceph_test_mount_opt(ceph_sb_to_fs_client(sb), INO32)))
                return ceph_ino_to_ino32(ino);
        return ino;
 }
@@ -1106,7 +1106,7 @@ void ceph_inode_shutdown(struct inode *inode);
 static inline bool ceph_inode_is_shutdown(struct inode *inode)
 {
        unsigned long flags = READ_ONCE(ceph_inode(inode)->i_ceph_flags);
-       struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+       struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        int state = READ_ONCE(fsc->mount_state);
 
        return (flags & CEPH_I_SHUTDOWN) || state >= CEPH_MOUNT_SHUTDOWN;
fs/ceph/xattr.c +6 -7
index 76680e5c2f82..e30ae1032e13 100644
@@ -57,7 +57,7 @@ static bool ceph_vxattrcb_layout_exists(struct ceph_inode_info *ci)
 static ssize_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
                                    size_t size)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
        struct ceph_osd_client *osdc = &fsc->client->osdc;
        struct ceph_string *pool_ns;
        s64 pool = ci->i_layout.pool_id;
@@ -161,7 +161,7 @@ static ssize_t ceph_vxattrcb_layout_pool(struct ceph_inode_info *ci,
                                         char *val, size_t size)
 {
        ssize_t ret;
-       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
        struct ceph_osd_client *osdc = &fsc->client->osdc;
        s64 pool = ci->i_layout.pool_id;
        const char *pool_name;
@@ -313,7 +313,7 @@ static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
 static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
                                          char *val, size_t size)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 
        return ceph_fmt_xattr(val, size, "%pU", &fsc->client->fsid);
 }
@@ -321,7 +321,7 @@ static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
 static ssize_t ceph_vxattrcb_client_id(struct ceph_inode_info *ci,
                                       char *val, size_t size)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(ci->netfs.inode.i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(ci->netfs.inode.i_sb);
 
        return ceph_fmt_xattr(val, size, "client%lld",
                              ceph_client_gid(fsc->client));
@@ -1093,7 +1093,7 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 static int ceph_sync_setxattr(struct inode *inode, const char *name,
                              const char *value, size_t size, int flags)
 {
-       struct ceph_fs_client *fsc = ceph_sb_to_client(inode->i_sb);
+       struct ceph_fs_client *fsc = ceph_sb_to_fs_client(inode->i_sb);
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mds_request *req;
        struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -1163,7 +1163,7 @@ int __ceph_setxattr(struct inode *inode, const char *name,
 {
        struct ceph_vxattr *vxattr;
        struct ceph_inode_info *ci = ceph_inode(inode);
-       struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
+       struct ceph_mds_client *mdsc = ceph_sb_to_fs_client(inode->i_sb)->mdsc;
        struct ceph_cap_flush *prealloc_cf = NULL;
        struct ceph_buffer *old_blob = NULL;
        int issued;
--

2.40.1

Signature · 1 line
Milind
#7 lore raw

PATCH v4 4/6 ceph: move mdsmap.h to fs/ceph/

In reply to [email protected]

From: Xiubo Li <[email protected]>

The mdsmap.h is only used by the kcephfs and move it to fs/ceph/

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/mds_client.h                | 2 +-
 fs/ceph/mdsmap.c                    | 2 +-
 {include/linux => fs}/ceph/mdsmap.h | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename {include/linux => fs}/ceph/mdsmap.h (100%)
fs/ceph/mds_client.h +1 -1
index 20bcf8d5322e..5d02c8c582fd 100644
@@ -14,9 +14,9 @@
 
 #include <linux/ceph/types.h>
 #include <linux/ceph/messenger.h>
-#include <linux/ceph/mdsmap.h>
 #include <linux/ceph/auth.h>
 
+#include "mdsmap.h"
 #include "metric.h"
 #include "super.h"
 
fs/ceph/mdsmap.c +1 -1
index 6cbec7aed5a0..d1bc81eecc18 100644
@@ -7,11 +7,11 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 
-#include <linux/ceph/mdsmap.h>
 #include <linux/ceph/messenger.h>
 #include <linux/ceph/decode.h>
 
 #include "super.h"
+#include "mdsmap.h"
 
 #define CEPH_MDS_IS_READY(i, ignore_laggy) \
 	(m->m_info[i].state > 0 && ignore_laggy ? true : !m->m_info[i].laggy)
fs/ceph/mdsmap.h renamed from include/linux/ceph/mdsmap.h +0 -0
similarity index 100%
rename from include/linux/ceph/mdsmap.h
rename to fs/ceph/mdsmap.h
Signature · 1 line
2.40.1
Tested-by Tested-by Venky Shankar Reviewed-by Reviewed-by Venky Shankar on v4 4/6
#8 lore raw

Re: [PATCH v4 4/6] ceph: move mdsmap.h to fs/ceph/

Looks good to me.

Quoted 55 lines · On Mon, Jun 19, 2023 at 12:47 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

The mdsmap.h is only used by the kcephfs and move it to fs/ceph/

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/mds_client.h                | 2 +-
 fs/ceph/mdsmap.c                    | 2 +-
 {include/linux => fs}/ceph/mdsmap.h | 0
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename {include/linux => fs}/ceph/mdsmap.h (100%)
fs/ceph/mds_client.h +1 -1
index 20bcf8d5322e..5d02c8c582fd 100644
@@ -14,9 +14,9 @@
 
 #include <linux/ceph/types.h>
 #include <linux/ceph/messenger.h>
-#include <linux/ceph/mdsmap.h>
 #include <linux/ceph/auth.h>
 
+#include "mdsmap.h"
 #include "metric.h"
 #include "super.h"
 
fs/ceph/mdsmap.c +1 -1
index 6cbec7aed5a0..d1bc81eecc18 100644
@@ -7,11 +7,11 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 
-#include <linux/ceph/mdsmap.h>
 #include <linux/ceph/messenger.h>
 #include <linux/ceph/decode.h>
 
 #include "super.h"
+#include "mdsmap.h"
 
 #define CEPH_MDS_IS_READY(i, ignore_laggy) \
        (m->m_info[i].state > 0 && ignore_laggy ? true : !m->m_info[i].laggy)
fs/ceph/mdsmap.h renamed from include/linux/ceph/mdsmap.h +0 -1
similarity index 100%
rename from include/linux/ceph/mdsmap.h
rename to fs/ceph/mdsmap.h
--

2.40.1

Signature · 1 line
Milind
#9 lore raw

PATCH v4 5/6 ceph: add ceph_inode_to_client() helper support

In reply to [email protected]

From: Xiubo Li <[email protected]>

This will covert the inode to ceph_client.

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/snap.c  | 8 +++++---
 fs/ceph/super.h | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
fs/ceph/snap.c +5 -3
index 09939ec0d1ee..9dde4b5f513d 100644
@@ -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;
fs/ceph/super.h +6 -0
index 9655ea46e6ca..4e78de1be23e 100644
@@ -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)
 {
Signature · 1 line
2.40.1
Tested-by Tested-by Venky Shankar Reviewed-by Reviewed-by Venky Shankar on v4 5/6
#10 lore raw

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

Looks good to me.

Quoted 67 lines · On Mon, Jun 19, 2023 at 12:47 PM <[email protected]> wrote:

From: Xiubo Li <[email protected]>

This will covert the inode to ceph_client.

URL: https://tracker.ceph.com/issues/61590

---
 fs/ceph/snap.c  | 8 +++++---
 fs/ceph/super.h | 6 ++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
fs/ceph/snap.c +5 -3
index 09939ec0d1ee..9dde4b5f513d 100644
@@ -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;
fs/ceph/super.h +6 -1
index 9655ea46e6ca..4e78de1be23e 100644
@@ -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

Signature · 1 line
Milind
author
#11 lore raw
In reply to [email protected]
Quoted 6 lines · On 6/19/23 15:14, [email protected] wrote:

From: Xiubo Li <[email protected]>

V4:
- s/dout_client()/doutc()/
- Fixed the building errors reported by ceph: print the client global id for debug logs. Thanks.

Sorry, it's reported by "kernel test robot <[email protected]>".

- Xiubo

Quoted 35 lines

Xiubo Li (6):
ceph: add the *_client debug macros support
ceph: pass the mdsc to several helpers
ceph: rename _to_client() to _to_fs_client()
ceph: move mdsmap.h to fs/ceph/
ceph: add ceph_inode_to_client() helper support
ceph: print the client global_id in all the debug logs

  fs/ceph/acl.c                       |   6 +-
  fs/ceph/addr.c                      | 298 ++++++-----
  fs/ceph/cache.c                     |   2 +-
  fs/ceph/caps.c                      | 774 ++++++++++++++++------------
  fs/ceph/crypto.c                    |  41 +-
  fs/ceph/debugfs.c                   |  10 +-
  fs/ceph/dir.c                       | 237 +++++----
  fs/ceph/export.c                    |  49 +-
  fs/ceph/file.c                      | 270 +++++-----
  fs/ceph/inode.c                     | 521 ++++++++++---------
  fs/ceph/ioctl.c                     |  21 +-
  fs/ceph/locks.c                     |  57 +-
  fs/ceph/mds_client.c                | 624 ++++++++++++----------
  fs/ceph/mds_client.h                |   5 +-
  fs/ceph/mdsmap.c                    |  29 +-
  {include/linux => fs}/ceph/mdsmap.h |   5 +-
  fs/ceph/metric.c                    |   5 +-
  fs/ceph/quota.c                     |  29 +-
  fs/ceph/snap.c                      | 192 +++----
  fs/ceph/super.c                     |  92 ++--
  fs/ceph/super.h                     |  19 +-
  fs/ceph/xattr.c                     | 108 ++--
  include/linux/ceph/ceph_debug.h     |  48 +-
  23 files changed, 1976 insertions(+), 1466 deletions(-)

rename {include/linux => fs}/ceph/mdsmap.h (92%)