From 7d2214858f137ff5fe20d0fdc2823c12b4b54f46 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Mon, 4 Jan 2016 15:05:28 -0500 Subject: orangefs: Fix some more global namespace pollution. This only changes the names of things, so there is no functional change. Signed-off-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/devorangefs-req.c | 4 ++-- fs/orangefs/dir.c | 23 ++++++++++++++--------- fs/orangefs/orangefs-bufmap.c | 10 +++++----- fs/orangefs/orangefs-bufmap.h | 6 +++--- fs/orangefs/orangefs-dev-proto.h | 32 +++++--------------------------- fs/orangefs/waitqueue.c | 8 ++++---- 6 files changed, 33 insertions(+), 50 deletions(-) diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index 5a9c53eb115f..e3bb15e344ed 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c @@ -600,7 +600,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file) __func__); mutex_lock(&devreq_mutex); - if (get_bufmap_init()) + if (orangefs_get_bufmap_init()) orangefs_bufmap_finalize(); open_access_count--; @@ -693,7 +693,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg) (struct ORANGEFS_dev_map_desc __user *) arg, sizeof(struct ORANGEFS_dev_map_desc)); - if (get_bufmap_init()) { + if (orangefs_get_bufmap_init()) { return -EINVAL; } else { return ret ? diff --git a/fs/orangefs/dir.c b/fs/orangefs/dir.c index c043894fc2bd..58558e37fb8a 100644 --- a/fs/orangefs/dir.c +++ b/fs/orangefs/dir.c @@ -52,7 +52,11 @@ static long decode_dirents(char *ptr, size_t size, readdir->dirent_array[i].d_name = buf + 4; readdir->dirent_array[i].d_length = len; - len = roundup8(4 + len + 1); + /* + * Round 4 + len + 1, which is the encoded size plus the string + * plus the null terminator to the nearest eight byte boundry. + */ + len = ((4 + len + 1) + 7) & ~7; if (size < len + 16) goto Einval; size -= len + 16; @@ -109,7 +113,7 @@ static void readdir_handle_dtor(struct orangefs_bufmap *bufmap, rhandle->readdir_response.dirent_array = NULL; if (rhandle->buffer_index >= 0) { - readdir_index_put(bufmap, rhandle->buffer_index); + orangefs_readdir_index_put(bufmap, rhandle->buffer_index); rhandle->buffer_index = -1; } if (rhandle->dents_buf) { @@ -175,7 +179,8 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) new_op->uses_shared_memory = 1; new_op->upcall.req.readdir.refn = orangefs_inode->refn; - new_op->upcall.req.readdir.max_dirent_count = MAX_DIRENT_COUNT_READDIR; + new_op->upcall.req.readdir.max_dirent_count = + ORANGEFS_MAX_DIRENT_COUNT_READDIR; gossip_debug(GOSSIP_DIR_DEBUG, "%s: upcall.req.readdir.refn.khandle: %pU\n", @@ -185,9 +190,9 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) new_op->upcall.req.readdir.token = *ptoken; get_new_buffer_index: - ret = readdir_index_get(&bufmap, &buffer_index); + ret = orangefs_readdir_index_get(&bufmap, &buffer_index); if (ret < 0) { - gossip_lerr("orangefs_readdir: readdir_index_get() failure (%d)\n", + gossip_lerr("orangefs_readdir: orangefs_readdir_index_get() failure (%d)\n", ret); goto out_free_op; } @@ -211,14 +216,14 @@ get_new_buffer_index: gossip_debug(GOSSIP_DIR_DEBUG, "%s: Getting new buffer_index for retry of readdir..\n", __func__); - readdir_index_put(bufmap, buffer_index); + orangefs_readdir_index_put(bufmap, buffer_index); goto get_new_buffer_index; } if (ret == -EIO && op_state_purged(new_op)) { gossip_err("%s: Client is down. Aborting readdir call.\n", __func__); - readdir_index_put(bufmap, buffer_index); + orangefs_readdir_index_put(bufmap, buffer_index); goto out_free_op; } @@ -226,7 +231,7 @@ get_new_buffer_index: gossip_debug(GOSSIP_DIR_DEBUG, "Readdir request failed. Status:%d\n", new_op->downcall.status); - readdir_index_put(bufmap, buffer_index); + orangefs_readdir_index_put(bufmap, buffer_index); if (ret >= 0) ret = new_op->downcall.status; goto out_free_op; @@ -241,7 +246,7 @@ get_new_buffer_index: gossip_err("orangefs_readdir: Could not decode trailer buffer into a readdir response %d\n", ret); ret = bytes_decoded; - readdir_index_put(bufmap, buffer_index); + orangefs_readdir_index_put(bufmap, buffer_index); goto out_free_op; } diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c index 888aa28136ee..15baecb8094d 100644 --- a/fs/orangefs/orangefs-bufmap.c +++ b/fs/orangefs/orangefs-bufmap.c @@ -115,14 +115,14 @@ static DECLARE_WAIT_QUEUE_HEAD(bufmap_waitq); static DECLARE_WAIT_QUEUE_HEAD(readdir_waitq); /* - * get_bufmap_init + * orangefs_get_bufmap_init * * If bufmap_init is 1, then the shared memory system, including the * buffer_index_array, is available. Otherwise, it is not. * * returns the value of bufmap_init */ -int get_bufmap_init(void) +int orangefs_get_bufmap_init(void) { return __orangefs_bufmap ? 1 : 0; } @@ -473,7 +473,7 @@ void orangefs_bufmap_put(struct orangefs_bufmap *bufmap, int buffer_index) } /* - * readdir_index_get() + * orangefs_readdir_index_get() * * gets a free descriptor, will sleep until one becomes * available if necessary. @@ -483,7 +483,7 @@ void orangefs_bufmap_put(struct orangefs_bufmap *bufmap, int buffer_index) * * returns 0 on success, -errno on failure */ -int readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index) +int orangefs_readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index) { struct orangefs_bufmap *bufmap = orangefs_bufmap_ref(); struct slot_args slargs; @@ -505,7 +505,7 @@ int readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index) return ret; } -void readdir_index_put(struct orangefs_bufmap *bufmap, int buffer_index) +void orangefs_readdir_index_put(struct orangefs_bufmap *bufmap, int buffer_index) { struct slot_args slargs; diff --git a/fs/orangefs/orangefs-bufmap.h b/fs/orangefs/orangefs-bufmap.h index 112ec33a1b86..dff55e2857c5 100644 --- a/fs/orangefs/orangefs-bufmap.h +++ b/fs/orangefs/orangefs-bufmap.h @@ -15,7 +15,7 @@ int orangefs_bufmap_shift_query(void); int orangefs_bufmap_initialize(struct ORANGEFS_dev_map_desc *user_desc); -int get_bufmap_init(void); +int orangefs_get_bufmap_init(void); void orangefs_bufmap_finalize(void); @@ -23,9 +23,9 @@ int orangefs_bufmap_get(struct orangefs_bufmap **mapp, int *buffer_index); void orangefs_bufmap_put(struct orangefs_bufmap *bufmap, int buffer_index); -int readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index); +int orangefs_readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index); -void readdir_index_put(struct orangefs_bufmap *bufmap, int buffer_index); +void orangefs_readdir_index_put(struct orangefs_bufmap *bufmap, int buffer_index); int orangefs_bufmap_copy_from_iovec(struct orangefs_bufmap *bufmap, struct iov_iter *iter, diff --git a/fs/orangefs/orangefs-dev-proto.h b/fs/orangefs/orangefs-dev-proto.h index dc1951dd7045..5a8725a88eac 100644 --- a/fs/orangefs/orangefs-dev-proto.h +++ b/fs/orangefs/orangefs-dev-proto.h @@ -51,35 +51,13 @@ #define ORANGEFS_MAX_DEBUG_ARRAY_LEN 0x00000800 /* - * MAX_DIRENT_COUNT cannot be larger than ORANGEFS_REQ_LIMIT_LISTATTR. - * The value of ORANGEFS_REQ_LIMIT_LISTATTR has been changed from 113 to 60 - * to accomodate an attribute object with mirrored handles. - * MAX_DIRENT_COUNT is replaced by MAX_DIRENT_COUNT_READDIR and - * MAX_DIRENT_COUNT_READDIRPLUS, since readdir doesn't trigger a listattr - * but readdirplus might. -*/ -#define MAX_DIRENT_COUNT_READDIR 0x00000060 -#define MAX_DIRENT_COUNT_READDIRPLUS 0x0000003C + * The maximum number of directory entries in a single request is 96. + * XXX: Why can this not be higher. The client-side code can handle up to 512. + * XXX: What happens if we expect more than the client can return? + */ +#define ORANGEFS_MAX_DIRENT_COUNT_READDIR 96 #include "upcall.h" #include "downcall.h" -/* - * These macros differ from proto macros in that they don't do any - * byte-swappings and are used to ensure that kernel-clientcore interactions - * don't cause any unaligned accesses etc on 64 bit machines - */ -#ifndef roundup4 -#define roundup4(x) (((x)+3) & ~3) -#endif - -#ifndef roundup8 -#define roundup8(x) (((x)+7) & ~7) -#endif - -struct read_write_x { - __s64 off; - __s64 len; -}; - #endif diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c index e1415e3882ba..751c3c640a52 100644 --- a/fs/orangefs/waitqueue.c +++ b/fs/orangefs/waitqueue.c @@ -180,7 +180,7 @@ retry_servicing: goto retry_servicing; /* op uses shared memory */ - if (get_bufmap_init() == 0) { + if (orangefs_get_bufmap_init() == 0) { /* * This operation uses the shared memory system AND * the system is not yet ready. This situation occurs @@ -194,7 +194,7 @@ retry_servicing: "Client core in-service status(%d).\n", is_daemon_in_service()); gossip_debug(GOSSIP_WAIT_DEBUG, "bufmap_init:%d.\n", - get_bufmap_init()); + orangefs_get_bufmap_init()); gossip_debug(GOSSIP_WAIT_DEBUG, "operation's status is 0x%0x.\n", op->op_state); @@ -222,13 +222,13 @@ retry_servicing: ret); gossip_debug(GOSSIP_WAIT_DEBUG, "Is shared memory available? (%d).\n", - get_bufmap_init()); + orangefs_get_bufmap_init()); spin_lock_irqsave(&op->lock, irqflags); finish_wait(&orangefs_bufmap_init_waitq, &wait_entry); spin_unlock_irqrestore(&op->lock, irqflags); - if (get_bufmap_init() == 0) { + if (orangefs_get_bufmap_init() == 0) { gossip_err("%s:The shared memory system has not started in %d seconds after the client core restarted. Aborting user's request(%s).\n", __func__, ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS, -- cgit v1.2.3