summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomohiro Kusumi <[email protected]>2019-07-16 05:57:56 +0900
committerBrian Behlendorf <[email protected]>2019-07-15 13:57:56 -0700
commitff9630d1a8006c7a6afac4386378324e4bc94ae4 (patch)
tree2445168017bcf8af8670a340660b30d3f4f05272
parente5db31349484e5e859c7a942eb15b98d68ce5b4d (diff)
Disable unused pathname::pn_path* (unneeded in Linux)
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 <[email protected]> Reviewed-by: Richard Elling <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Tomohiro Kusumi <[email protected]> Closes #9025
-rw-r--r--include/sys/pathname.h2
-rw-r--r--module/zfs/pathname.c15
2 files changed, 13 insertions, 4 deletions
diff --git a/include/sys/pathname.h b/include/sys/pathname.h
index 5db69b178..d79cc5c01 100644
--- a/include/sys/pathname.h
+++ b/include/sys/pathname.h
@@ -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;
diff --git a/module/zfs/pathname.c b/module/zfs/pathname.c
index e3e97c9bb..4766762f3 100644
--- a/module/zfs/pathname.c
+++ b/module/zfs/pathname.c
@@ -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
}