summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-inode-handle.h
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-10-28 21:53:01 +0530
committerAtin Mukherjee <amukherj@redhat.com>2019-11-18 01:14:18 +0000
commitcd1872ae49d7bc83403fce6821c102edc4e97796 (patch)
tree0d662f26ab042cdfbad0bf6051cbe70777cf2863 /xlators/storage/posix/src/posix-inode-handle.h
parent515d1b4577d989fa99f236d9e344a71db7d001a0 (diff)
posix: Improve MAKE_HANDLE_PATH
Pass the maximum buffer (PATH_MAX) to posix_handle_path to avoid the posix_handle_path call again. Change-Id: I7d18313870218dc028c5f7fc94d6ec85a2bdb332 Updates #761 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-inode-handle.h')
-rw-r--r--xlators/storage/posix/src/posix-inode-handle.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix-inode-handle.h b/xlators/storage/posix/src/posix-inode-handle.h
index 78a85b34c31..36c47f2bebc 100644
--- a/xlators/storage/posix/src/posix-inode-handle.h
+++ b/xlators/storage/posix/src/posix-inode-handle.h
@@ -44,14 +44,13 @@
#define MAKE_HANDLE_PATH(var, this, gfid, base) \
do { \
- int __len; \
- __len = posix_handle_path(this, gfid, base, NULL, 0); \
- if (__len <= 0) \
- break; \
- var = alloca(__len); \
- __len = posix_handle_path(this, gfid, base, var, __len); \
- if (__len <= 0) \
+ int __len = 0; \
+ int tot = PATH_MAX; \
+ var = alloca(tot); \
+ __len = posix_handle_path(this, gfid, base, var, tot); \
+ if (__len <= 0) { \
var = NULL; \
+ } \
} while (0)
/* TODO: it is not a good idea to change a variable which