summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.h
diff options
context:
space:
mode:
authorJeff Layton2019-04-29 18:13:14 +0200
committerIlya Dryomov2019-05-07 19:22:37 +0200
commitf77f21bb28367d0ac4861a24da1db118bba850e6 (patch)
tree09381ee5d6fac1e444a8795da70eb08fe4ce551d /fs/ceph/mds_client.h
parentceph: use ceph_mdsc_build_path instead of clone_dentry_name (diff)
downloadkernel-qcow2-linux-f77f21bb28367d0ac4861a24da1db118bba850e6.tar.gz
kernel-qcow2-linux-f77f21bb28367d0ac4861a24da1db118bba850e6.tar.xz
kernel-qcow2-linux-f77f21bb28367d0ac4861a24da1db118bba850e6.zip
ceph: use __getname/__putname in ceph_mdsc_build_path
Al suggested we get rid of the kmalloc here and just use __getname and __putname to get a full PATH_MAX pathname buffer. Since we build the path in reverse, we continue to return a pointer to the beginning of the string and the length, and add a new helper to free the thing at the end. Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/mds_client.h')
-rw-r--r--fs/ceph/mds_client.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 0d1f673a5689..ebcad5afc87b 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -492,6 +492,12 @@ extern int ceph_iterate_session_caps(struct ceph_mds_session *session,
void *arg);
extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
+static inline void ceph_mdsc_free_path(char *path, int len)
+{
+ if (path)
+ __putname(path - (PATH_MAX - 1 - len));
+}
+
extern char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
int stop_on_nosnap);