Loading fs/orangefs/devorangefs-req.c +2 −2 Original line number Diff line number Diff line Loading @@ -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--; Loading Loading @@ -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 ? Loading fs/orangefs/dir.c +14 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading Loading @@ -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", Loading @@ -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; } Loading @@ -211,14 +216,14 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; } Loading @@ -226,7 +231,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; Loading @@ -241,7 +246,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; } Loading fs/orangefs/orangefs-bufmap.c +5 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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. Loading @@ -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; Loading @@ -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; Loading fs/orangefs/orangefs-bufmap.h +3 −3 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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, Loading fs/orangefs/orangefs-dev-proto.h +5 −27 Original line number Diff line number Diff line Loading @@ -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. * 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 MAX_DIRENT_COUNT_READDIR 0x00000060 #define MAX_DIRENT_COUNT_READDIRPLUS 0x0000003C #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 Loading
fs/orangefs/devorangefs-req.c +2 −2 Original line number Diff line number Diff line Loading @@ -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--; Loading Loading @@ -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 ? Loading
fs/orangefs/dir.c +14 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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) { Loading Loading @@ -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", Loading @@ -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; } Loading @@ -211,14 +216,14 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; } Loading @@ -226,7 +231,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; Loading @@ -241,7 +246,7 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx) 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; } Loading
fs/orangefs/orangefs-bufmap.c +5 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading Loading @@ -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. Loading @@ -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; Loading @@ -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; Loading
fs/orangefs/orangefs-bufmap.h +3 −3 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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, Loading
fs/orangefs/orangefs-dev-proto.h +5 −27 Original line number Diff line number Diff line Loading @@ -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. * 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 MAX_DIRENT_COUNT_READDIR 0x00000060 #define MAX_DIRENT_COUNT_READDIRPLUS 0x0000003C #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