orangefs: saner calling conventions for getting a slot
just have it return the slot number or -E... - the caller checks the sign anyway Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
parent
bf6bf606e5
commit
b8a99a8f9f
|
@ -141,7 +141,6 @@ out:
|
||||||
*/
|
*/
|
||||||
static int orangefs_readdir(struct file *file, struct dir_context *ctx)
|
static int orangefs_readdir(struct file *file, struct dir_context *ctx)
|
||||||
{
|
{
|
||||||
struct orangefs_bufmap *bufmap = NULL;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int buffer_index;
|
int buffer_index;
|
||||||
/*
|
/*
|
||||||
|
@ -205,8 +204,9 @@ static int orangefs_readdir(struct file *file, struct dir_context *ctx)
|
||||||
new_op->upcall.req.readdir.token = *ptoken;
|
new_op->upcall.req.readdir.token = *ptoken;
|
||||||
|
|
||||||
get_new_buffer_index:
|
get_new_buffer_index:
|
||||||
ret = orangefs_readdir_index_get(&bufmap, &buffer_index);
|
buffer_index = orangefs_readdir_index_get();
|
||||||
if (ret < 0) {
|
if (buffer_index < 0) {
|
||||||
|
ret = buffer_index;
|
||||||
gossip_lerr("orangefs_readdir: orangefs_readdir_index_get() failure (%d)\n",
|
gossip_lerr("orangefs_readdir: orangefs_readdir_index_get() failure (%d)\n",
|
||||||
ret);
|
ret);
|
||||||
goto out_free_op;
|
goto out_free_op;
|
||||||
|
|
|
@ -87,7 +87,6 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
|
||||||
{
|
{
|
||||||
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
|
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
|
||||||
struct orangefs_khandle *handle = &orangefs_inode->refn.khandle;
|
struct orangefs_khandle *handle = &orangefs_inode->refn.khandle;
|
||||||
struct orangefs_bufmap *bufmap = NULL;
|
|
||||||
struct orangefs_kernel_op_s *new_op = NULL;
|
struct orangefs_kernel_op_s *new_op = NULL;
|
||||||
struct iov_iter saved = *iter;
|
struct iov_iter saved = *iter;
|
||||||
int buffer_index = -1;
|
int buffer_index = -1;
|
||||||
|
@ -104,11 +103,12 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
|
||||||
|
|
||||||
populate_shared_memory:
|
populate_shared_memory:
|
||||||
/* get a shared buffer index */
|
/* get a shared buffer index */
|
||||||
ret = orangefs_bufmap_get(&bufmap, &buffer_index);
|
buffer_index = orangefs_bufmap_get();
|
||||||
if (ret < 0) {
|
if (buffer_index < 0) {
|
||||||
|
ret = buffer_index;
|
||||||
gossip_debug(GOSSIP_FILE_DEBUG,
|
gossip_debug(GOSSIP_FILE_DEBUG,
|
||||||
"%s: orangefs_bufmap_get failure (%ld)\n",
|
"%s: orangefs_bufmap_get failure (%zd)\n",
|
||||||
__func__, (long)ret);
|
__func__, ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
gossip_debug(GOSSIP_FILE_DEBUG,
|
gossip_debug(GOSSIP_FILE_DEBUG,
|
||||||
|
|
|
@ -455,17 +455,11 @@ void orangefs_bufmap_run_down(void)
|
||||||
* gets a free mapped buffer descriptor, will sleep until one becomes
|
* gets a free mapped buffer descriptor, will sleep until one becomes
|
||||||
* available if necessary
|
* available if necessary
|
||||||
*
|
*
|
||||||
* returns 0 on success, -errno on failure
|
* returns slot on success, -errno on failure
|
||||||
*/
|
*/
|
||||||
int orangefs_bufmap_get(struct orangefs_bufmap **mapp, int *buffer_index)
|
int orangefs_bufmap_get(void)
|
||||||
{
|
{
|
||||||
int ret = get(&rw_map);
|
return get(&rw_map);
|
||||||
if (ret >= 0) {
|
|
||||||
*mapp = __orangefs_bufmap;
|
|
||||||
*buffer_index = ret;
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -489,17 +483,11 @@ void orangefs_bufmap_put(int buffer_index)
|
||||||
* we could do that at a later point of time. Regardless, these
|
* we could do that at a later point of time. Regardless, these
|
||||||
* indices are used by the client-core.
|
* indices are used by the client-core.
|
||||||
*
|
*
|
||||||
* returns 0 on success, -errno on failure
|
* returns slot on success, -errno on failure
|
||||||
*/
|
*/
|
||||||
int orangefs_readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index)
|
int orangefs_readdir_index_get(void)
|
||||||
{
|
{
|
||||||
int ret = get(&readdir_map);
|
return get(&readdir_map);
|
||||||
if (ret >= 0) {
|
|
||||||
*mapp = __orangefs_bufmap;
|
|
||||||
*buffer_index = ret;
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void orangefs_readdir_index_put(int buffer_index)
|
void orangefs_readdir_index_put(int buffer_index)
|
||||||
|
|
|
@ -19,11 +19,11 @@ void orangefs_bufmap_finalize(void);
|
||||||
|
|
||||||
void orangefs_bufmap_run_down(void);
|
void orangefs_bufmap_run_down(void);
|
||||||
|
|
||||||
int orangefs_bufmap_get(struct orangefs_bufmap **mapp, int *buffer_index);
|
int orangefs_bufmap_get(void);
|
||||||
|
|
||||||
void orangefs_bufmap_put(int buffer_index);
|
void orangefs_bufmap_put(int buffer_index);
|
||||||
|
|
||||||
int orangefs_readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index);
|
int orangefs_readdir_index_get(void);
|
||||||
|
|
||||||
void orangefs_readdir_index_put(int buffer_index);
|
void orangefs_readdir_index_put(int buffer_index);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue