]> granicus.if.org Git - zfs/commitdiff
Disable unused pathname::pn_path* (unneeded in Linux)
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 15 Jul 2019 20:57:56 +0000 (05:57 +0900)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 15 Jul 2019 20:57:56 +0000 (13:57 -0700)
struct pathname is originally from Solaris VFS, and it has been used
in ZoL to merely call VOP from Linux VFS interface without API change,
therefore pathname::pn_path* are unused and unneeded. Technically,
struct pathname is a wrapper for C string in ZoL.

Saves stack a bit on lookup and unlink.

(#if0'd members instead of removing since comments refer to them.)

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Closes #9025

include/sys/pathname.h
module/zfs/pathname.c

index 5db69b1784c9eaa3424200ac475fbbaac8c65490..d79cc5c01afdabfcc44973be76d4b044743a3ee7 100644 (file)
@@ -54,8 +54,10 @@ extern "C" {
  */
 typedef struct pathname {
        char    *pn_buf;                /* underlying storage */
+#if 0 /* unused in ZoL */
        char    *pn_path;               /* remaining pathname */
        size_t  pn_pathlen;             /* remaining length */
+#endif
        size_t  pn_bufsize;             /* total size of pn_buf */
 } pathname_t;
 
index e3e97c9bb365e7fb6d7cc9024458e7b90bdc4c40..4766762f37d177a49e4f84cceaf17e5596e462c1 100644 (file)
@@ -71,9 +71,12 @@ pn_alloc(struct pathname *pnp)
 void
 pn_alloc_sz(struct pathname *pnp, size_t sz)
 {
-       pnp->pn_path = pnp->pn_buf = kmem_alloc(sz, KM_SLEEP);
-       pnp->pn_pathlen = 0;
+       pnp->pn_buf = kmem_alloc(sz, KM_SLEEP);
        pnp->pn_bufsize = sz;
+#if 0 /* unused in ZoL */
+       pnp->pn_path = pnp->pn_buf;
+       pnp->pn_pathlen = 0;
+#endif
 }
 
 /*
@@ -84,6 +87,10 @@ pn_free(struct pathname *pnp)
 {
        /* pn_bufsize is usually MAXPATHLEN, but may not be */
        kmem_free(pnp->pn_buf, pnp->pn_bufsize);
-       pnp->pn_path = pnp->pn_buf = NULL;
-       pnp->pn_pathlen = pnp->pn_bufsize = 0;
+       pnp->pn_buf = NULL;
+       pnp->pn_bufsize = 0;
+#if 0 /* unused in ZoL */
+       pnp->pn_path = NULL;
+       pnp->pn_pathlen = 0;
+#endif
 }