[PATCH v6 14/15] ceph: pass idmap to ceph_netfs_issue_op_inline

From: Alexander Mikhalitsyn
Date: Fri Jun 09 2023 - 06:10:47 EST


Just pass down the mount's idmapping to ceph_netfs_issue_op_inline.

Cc: Xiubo Li <xiubli@xxxxxxxxxx>
Cc: Jeff Layton <jlayton@xxxxxxxxxx>
Cc: Ilya Dryomov <idryomov@xxxxxxxxx>
Cc: brauner@xxxxxxxxxx
Cc: ceph-devel@xxxxxxxxxxxxxxx
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@xxxxxxxxxxxxx>
---
fs/ceph/addr.c | 12 ++++++++++++
fs/ceph/super.h | 2 ++
2 files changed, 14 insertions(+)

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 0a32475ed034..2759a0cf2381 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -291,6 +291,8 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
{
struct netfs_io_request *rreq = subreq->rreq;
struct inode *inode = rreq->inode;
+ struct ceph_netfs_request_data *priv = rreq->netfs_priv;
+ struct mnt_idmap *idmap = priv->mnt_idmap;
struct ceph_mds_reply_info_parsed *rinfo;
struct ceph_mds_reply_info_in *iinfo;
struct ceph_mds_request *req;
@@ -318,6 +320,8 @@ static bool ceph_netfs_issue_op_inline(struct netfs_io_subrequest *subreq)
req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INLINE_DATA);
req->r_num_caps = 2;

+ req->r_mnt_idmap = mnt_idmap_get(idmap);
+
err = ceph_mdsc_do_request(mdsc, NULL, req);
if (err < 0)
goto out;
@@ -443,13 +447,18 @@ static int ceph_init_request(struct netfs_io_request *rreq, struct file *file)
if (!priv)
return -ENOMEM;

+ priv->mnt_idmap = &nop_mnt_idmap;
+
if (file) {
struct ceph_rw_context *rw_ctx;
struct ceph_file_info *fi = file->private_data;
+ struct mnt_idmap *idmap = file_mnt_idmap(file);

priv->file_ra_pages = file->f_ra.ra_pages;
priv->file_ra_disabled = file->f_mode & FMODE_RANDOM;

+ priv->mnt_idmap = mnt_idmap_get(idmap);
+
rw_ctx = ceph_find_rw_context(fi);
if (rw_ctx) {
rreq->netfs_priv = priv;
@@ -496,6 +505,9 @@ static void ceph_netfs_free_request(struct netfs_io_request *rreq)

if (priv->caps)
ceph_put_cap_refs(ceph_inode(rreq->inode), priv->caps);
+
+ mnt_idmap_put(priv->mnt_idmap);
+
kfree(priv);
rreq->netfs_priv = NULL;
}
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index d89e7b99ac5f..0badf58fb5fc 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -481,6 +481,8 @@ struct ceph_netfs_request_data {

/* Set it if fadvise disables file readahead entirely */
bool file_ra_disabled;
+
+ struct mnt_idmap *mnt_idmap;
};

static inline struct ceph_inode_info *
--
2.34.1