summaryrefslogtreecommitdiff
path: root/fs/orangefs/pvfs2-bufmap.c
diff options
context:
space:
mode:
authorYi Liu <yi9@clemson.edu>2015-11-24 23:12:14 +0300
committerMike Marshall <hubcap@omnibond.com>2015-12-03 22:45:44 +0300
commit8bb8aefd5afb54a25a002feb4ec70011812d06a0 (patch)
tree08ca295ca2541c889e2805f92ae0aa699b0a13df /fs/orangefs/pvfs2-bufmap.c
parent555fa0fa618b846c5b38406347b7d53ace320ac6 (diff)
downloadlinux-8bb8aefd5afb54a25a002feb4ec70011812d06a0.tar.xz
OrangeFS: Change almost all instances of the string PVFS2 to OrangeFS.
OrangeFS was formerly known as PVFS2 and retains the name in many places. I leave the device /dev/pvfs2-req since this affects userspace. I leave the filesystem type pvfs2 since this affects userspace. Further the OrangeFS sysint library reads fstab for an entry of type pvfs2 independently of kernel mounts. I leave extended attribute keys user.pvfs2 and system.pvfs2 as the sysint library understands these. I leave references to userspace binaries still named pvfs2. I leave the filenames. Signed-off-by: Yi Liu <yi9@clemson.edu> [martin@omnibond.com: clairify above constraints and merge] Signed-off-by: Martin Brandenburg <martin@omnibond.com> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/pvfs2-bufmap.c')
-rw-r--r--fs/orangefs/pvfs2-bufmap.c168
1 files changed, 84 insertions, 84 deletions
diff --git a/fs/orangefs/pvfs2-bufmap.c b/fs/orangefs/pvfs2-bufmap.c
index c7b0f3560734..345287e871b1 100644
--- a/fs/orangefs/pvfs2-bufmap.c
+++ b/fs/orangefs/pvfs2-bufmap.c
@@ -7,9 +7,9 @@
#include "pvfs2-kernel.h"
#include "pvfs2-bufmap.h"
-DECLARE_WAIT_QUEUE_HEAD(pvfs2_bufmap_init_waitq);
+DECLARE_WAIT_QUEUE_HEAD(orangefs_bufmap_init_waitq);
-static struct pvfs2_bufmap {
+static struct orangefs_bufmap {
atomic_t refcnt;
int desc_size;
@@ -19,21 +19,21 @@ static struct pvfs2_bufmap {
int page_count;
struct page **page_array;
- struct pvfs_bufmap_desc *desc_array;
+ struct orangefs_bufmap_desc *desc_array;
/* array to track usage of buffer descriptors */
int *buffer_index_array;
spinlock_t buffer_index_lock;
/* array to track usage of buffer descriptors for readdir */
- int readdir_index_array[PVFS2_READDIR_DEFAULT_DESC_COUNT];
+ int readdir_index_array[ORANGEFS_READDIR_DEFAULT_DESC_COUNT];
spinlock_t readdir_index_lock;
-} *__pvfs2_bufmap;
+} *__orangefs_bufmap;
-static DEFINE_SPINLOCK(pvfs2_bufmap_lock);
+static DEFINE_SPINLOCK(orangefs_bufmap_lock);
static void
-pvfs2_bufmap_unmap(struct pvfs2_bufmap *bufmap)
+orangefs_bufmap_unmap(struct orangefs_bufmap *bufmap)
{
int i;
@@ -42,7 +42,7 @@ pvfs2_bufmap_unmap(struct pvfs2_bufmap *bufmap)
}
static void
-pvfs2_bufmap_free(struct pvfs2_bufmap *bufmap)
+orangefs_bufmap_free(struct orangefs_bufmap *bufmap)
{
kfree(bufmap->page_array);
kfree(bufmap->desc_array);
@@ -50,45 +50,45 @@ pvfs2_bufmap_free(struct pvfs2_bufmap *bufmap)
kfree(bufmap);
}
-struct pvfs2_bufmap *pvfs2_bufmap_ref(void)
+struct orangefs_bufmap *orangefs_bufmap_ref(void)
{
- struct pvfs2_bufmap *bufmap = NULL;
+ struct orangefs_bufmap *bufmap = NULL;
- spin_lock(&pvfs2_bufmap_lock);
- if (__pvfs2_bufmap) {
- bufmap = __pvfs2_bufmap;
+ spin_lock(&orangefs_bufmap_lock);
+ if (__orangefs_bufmap) {
+ bufmap = __orangefs_bufmap;
atomic_inc(&bufmap->refcnt);
}
- spin_unlock(&pvfs2_bufmap_lock);
+ spin_unlock(&orangefs_bufmap_lock);
return bufmap;
}
-void pvfs2_bufmap_unref(struct pvfs2_bufmap *bufmap)
+void orangefs_bufmap_unref(struct orangefs_bufmap *bufmap)
{
- if (atomic_dec_and_lock(&bufmap->refcnt, &pvfs2_bufmap_lock)) {
- __pvfs2_bufmap = NULL;
- spin_unlock(&pvfs2_bufmap_lock);
+ if (atomic_dec_and_lock(&bufmap->refcnt, &orangefs_bufmap_lock)) {
+ __orangefs_bufmap = NULL;
+ spin_unlock(&orangefs_bufmap_lock);
- pvfs2_bufmap_unmap(bufmap);
- pvfs2_bufmap_free(bufmap);
+ orangefs_bufmap_unmap(bufmap);
+ orangefs_bufmap_free(bufmap);
}
}
-inline int pvfs_bufmap_size_query(void)
+inline int orangefs_bufmap_size_query(void)
{
- struct pvfs2_bufmap *bufmap = pvfs2_bufmap_ref();
+ struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
int size = bufmap ? bufmap->desc_size : 0;
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
return size;
}
-inline int pvfs_bufmap_shift_query(void)
+inline int orangefs_bufmap_shift_query(void)
{
- struct pvfs2_bufmap *bufmap = pvfs2_bufmap_ref();
+ struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
int shift = bufmap ? bufmap->desc_shift : 0;
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
return shift;
}
@@ -105,14 +105,14 @@ static DECLARE_WAIT_QUEUE_HEAD(readdir_waitq);
*/
int get_bufmap_init(void)
{
- return __pvfs2_bufmap ? 1 : 0;
+ return __orangefs_bufmap ? 1 : 0;
}
-static struct pvfs2_bufmap *
-pvfs2_bufmap_alloc(struct PVFS_dev_map_desc *user_desc)
+static struct orangefs_bufmap *
+orangefs_bufmap_alloc(struct ORANGEFS_dev_map_desc *user_desc)
{
- struct pvfs2_bufmap *bufmap;
+ struct orangefs_bufmap *bufmap;
bufmap = kzalloc(sizeof(*bufmap), GFP_KERNEL);
if (!bufmap)
@@ -128,17 +128,17 @@ pvfs2_bufmap_alloc(struct PVFS_dev_map_desc *user_desc)
bufmap->buffer_index_array =
kcalloc(bufmap->desc_count, sizeof(int), GFP_KERNEL);
if (!bufmap->buffer_index_array) {
- gossip_err("pvfs2: could not allocate %d buffer indices\n",
+ gossip_err("orangefs: could not allocate %d buffer indices\n",
bufmap->desc_count);
goto out_free_bufmap;
}
spin_lock_init(&bufmap->readdir_index_lock);
bufmap->desc_array =
- kcalloc(bufmap->desc_count, sizeof(struct pvfs_bufmap_desc),
+ kcalloc(bufmap->desc_count, sizeof(struct orangefs_bufmap_desc),
GFP_KERNEL);
if (!bufmap->desc_array) {
- gossip_err("pvfs2: could not allocate %d descriptors\n",
+ gossip_err("orangefs: could not allocate %d descriptors\n",
bufmap->desc_count);
goto out_free_index_array;
}
@@ -164,8 +164,8 @@ out:
}
static int
-pvfs2_bufmap_map(struct pvfs2_bufmap *bufmap,
- struct PVFS_dev_map_desc *user_desc)
+orangefs_bufmap_map(struct orangefs_bufmap *bufmap,
+ struct ORANGEFS_dev_map_desc *user_desc)
{
int pages_per_desc = bufmap->desc_size / PAGE_SIZE;
int offset = 0, ret, i;
@@ -178,7 +178,7 @@ pvfs2_bufmap_map(struct pvfs2_bufmap *bufmap,
return ret;
if (ret != bufmap->page_count) {
- gossip_err("pvfs2 error: asked for %d pages, only got %d.\n",
+ gossip_err("orangefs error: asked for %d pages, only got %d.\n",
bufmap->page_count, ret);
for (i = 0; i < ret; i++) {
@@ -210,19 +210,19 @@ pvfs2_bufmap_map(struct pvfs2_bufmap *bufmap,
}
/*
- * pvfs_bufmap_initialize()
+ * orangefs_bufmap_initialize()
*
* initializes the mapped buffer interface
*
* returns 0 on success, -errno on failure
*/
-int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc)
+int orangefs_bufmap_initialize(struct ORANGEFS_dev_map_desc *user_desc)
{
- struct pvfs2_bufmap *bufmap;
+ struct orangefs_bufmap *bufmap;
int ret = -EINVAL;
gossip_debug(GOSSIP_BUFMAP_DEBUG,
- "pvfs_bufmap_initialize: called (ptr ("
+ "orangefs_bufmap_initialize: called (ptr ("
"%p) sz (%d) cnt(%d).\n",
user_desc->ptr,
user_desc->size,
@@ -234,21 +234,21 @@ int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc)
*/
if (PAGE_ALIGN((unsigned long)user_desc->ptr) !=
(unsigned long)user_desc->ptr) {
- gossip_err("pvfs2 error: memory alignment (front). %p\n",
+ gossip_err("orangefs error: memory alignment (front). %p\n",
user_desc->ptr);
goto out;
}
if (PAGE_ALIGN(((unsigned long)user_desc->ptr + user_desc->total_size))
!= (unsigned long)(user_desc->ptr + user_desc->total_size)) {
- gossip_err("pvfs2 error: memory alignment (back).(%p + %d)\n",
+ gossip_err("orangefs error: memory alignment (back).(%p + %d)\n",
user_desc->ptr,
user_desc->total_size);
goto out;
}
if (user_desc->total_size != (user_desc->size * user_desc->count)) {
- gossip_err("pvfs2 error: user provided an oddly sized buffer: (%d, %d, %d)\n",
+ gossip_err("orangefs error: user provided an oddly sized buffer: (%d, %d, %d)\n",
user_desc->total_size,
user_desc->size,
user_desc->count);
@@ -256,33 +256,33 @@ int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc)
}
if ((user_desc->size % PAGE_SIZE) != 0) {
- gossip_err("pvfs2 error: bufmap size not page size divisible (%d).\n",
+ gossip_err("orangefs error: bufmap size not page size divisible (%d).\n",
user_desc->size);
goto out;
}
ret = -ENOMEM;
- bufmap = pvfs2_bufmap_alloc(user_desc);
+ bufmap = orangefs_bufmap_alloc(user_desc);
if (!bufmap)
goto out;
- ret = pvfs2_bufmap_map(bufmap, user_desc);
+ ret = orangefs_bufmap_map(bufmap, user_desc);
if (ret)
goto out_free_bufmap;
- spin_lock(&pvfs2_bufmap_lock);
- if (__pvfs2_bufmap) {
- spin_unlock(&pvfs2_bufmap_lock);
- gossip_err("pvfs2: error: bufmap already initialized.\n");
+ spin_lock(&orangefs_bufmap_lock);
+ if (__orangefs_bufmap) {
+ spin_unlock(&orangefs_bufmap_lock);
+ gossip_err("orangefs: error: bufmap already initialized.\n");
ret = -EALREADY;
goto out_unmap_bufmap;
}
- __pvfs2_bufmap = bufmap;
- spin_unlock(&pvfs2_bufmap_lock);
+ __orangefs_bufmap = bufmap;
+ spin_unlock(&orangefs_bufmap_lock);
/*
- * If there are operations in pvfs2_bufmap_init_waitq, wake them up.
+ * If there are operations in orangefs_bufmap_init_waitq, wake them up.
* This scenario occurs when the client-core is restarted and I/O
* requests in the in-progress or waiting tables are restarted. I/O
* requests cannot be restarted until the shared memory system is
@@ -291,35 +291,35 @@ int pvfs_bufmap_initialize(struct PVFS_dev_map_desc *user_desc)
* are also on a timer, so they don't wait forever just in case the
* client-core doesn't come back up.
*/
- wake_up_interruptible(&pvfs2_bufmap_init_waitq);
+ wake_up_interruptible(&orangefs_bufmap_init_waitq);
gossip_debug(GOSSIP_BUFMAP_DEBUG,
- "pvfs_bufmap_initialize: exiting normally\n");
+ "orangefs_bufmap_initialize: exiting normally\n");
return 0;
out_unmap_bufmap:
- pvfs2_bufmap_unmap(bufmap);
+ orangefs_bufmap_unmap(bufmap);
out_free_bufmap:
- pvfs2_bufmap_free(bufmap);
+ orangefs_bufmap_free(bufmap);
out:
return ret;
}
/*
- * pvfs_bufmap_finalize()
+ * orangefs_bufmap_finalize()
*
* shuts down the mapped buffer interface and releases any resources
* associated with it
*
* no return value
*/
-void pvfs_bufmap_finalize(void)
+void orangefs_bufmap_finalize(void)
{
- gossip_debug(GOSSIP_BUFMAP_DEBUG, "pvfs2_bufmap_finalize: called\n");
- BUG_ON(!__pvfs2_bufmap);
- pvfs2_bufmap_unref(__pvfs2_bufmap);
+ gossip_debug(GOSSIP_BUFMAP_DEBUG, "orangefs_bufmap_finalize: called\n");
+ BUG_ON(!__orangefs_bufmap);
+ orangefs_bufmap_unref(__orangefs_bufmap);
gossip_debug(GOSSIP_BUFMAP_DEBUG,
- "pvfs2_bufmap_finalize: exiting normally\n");
+ "orangefs_bufmap_finalize: exiting normally\n");
}
struct slot_args {
@@ -377,7 +377,7 @@ static int wait_for_a_slot(struct slot_args *slargs, int *buffer_index)
continue;
}
- gossip_debug(GOSSIP_BUFMAP_DEBUG, "pvfs2: %s interrupted.\n",
+ gossip_debug(GOSSIP_BUFMAP_DEBUG, "orangefs: %s interrupted.\n",
__func__);
ret = -EINTR;
break;
@@ -406,21 +406,21 @@ static void put_back_slot(struct slot_args *slargs, int buffer_index)
}
/*
- * pvfs_bufmap_get()
+ * orangefs_bufmap_get()
*
* gets a free mapped buffer descriptor, will sleep until one becomes
* available if necessary
*
* returns 0 on success, -errno on failure
*/
-int pvfs_bufmap_get(struct pvfs2_bufmap **mapp, int *buffer_index)
+int orangefs_bufmap_get(struct orangefs_bufmap **mapp, int *buffer_index)
{
- struct pvfs2_bufmap *bufmap = pvfs2_bufmap_ref();
+ struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
struct slot_args slargs;
int ret;
if (!bufmap) {
- gossip_err("pvfs2: please confirm that pvfs2-client daemon is running.\n");
+ gossip_err("orangefs: please confirm that pvfs2-client daemon is running.\n");
return -EIO;
}
@@ -430,19 +430,19 @@ int pvfs_bufmap_get(struct pvfs2_bufmap **mapp, int *buffer_index)
slargs.slot_wq = &bufmap_waitq;
ret = wait_for_a_slot(&slargs, buffer_index);
if (ret)
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
*mapp = bufmap;
return ret;
}
/*
- * pvfs_bufmap_put()
+ * orangefs_bufmap_put()
*
* returns a mapped buffer descriptor to the collection
*
* no return value
*/
-void pvfs_bufmap_put(struct pvfs2_bufmap *bufmap, int buffer_index)
+void orangefs_bufmap_put(struct orangefs_bufmap *bufmap, int buffer_index)
{
struct slot_args slargs;
@@ -451,7 +451,7 @@ void pvfs_bufmap_put(struct pvfs2_bufmap *bufmap, int buffer_index)
slargs.slot_lock = &bufmap->buffer_index_lock;
slargs.slot_wq = &bufmap_waitq;
put_back_slot(&slargs, buffer_index);
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
}
/*
@@ -465,46 +465,46 @@ void pvfs_bufmap_put(struct pvfs2_bufmap *bufmap, int buffer_index)
*
* returns 0 on success, -errno on failure
*/
-int readdir_index_get(struct pvfs2_bufmap **mapp, int *buffer_index)
+int readdir_index_get(struct orangefs_bufmap **mapp, int *buffer_index)
{
- struct pvfs2_bufmap *bufmap = pvfs2_bufmap_ref();
+ struct orangefs_bufmap *bufmap = orangefs_bufmap_ref();
struct slot_args slargs;
int ret;
if (!bufmap) {
- gossip_err("pvfs2: please confirm that pvfs2-client daemon is running.\n");
+ gossip_err("orangefs: please confirm that pvfs2-client daemon is running.\n");
return -EIO;
}
- slargs.slot_count = PVFS2_READDIR_DEFAULT_DESC_COUNT;
+ slargs.slot_count = ORANGEFS_READDIR_DEFAULT_DESC_COUNT;
slargs.slot_array = bufmap->readdir_index_array;
slargs.slot_lock = &bufmap->readdir_index_lock;
slargs.slot_wq = &readdir_waitq;
ret = wait_for_a_slot(&slargs, buffer_index);
if (ret)
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
*mapp = bufmap;
return ret;
}
-void readdir_index_put(struct pvfs2_bufmap *bufmap, int buffer_index)
+void readdir_index_put(struct orangefs_bufmap *bufmap, int buffer_index)
{
struct slot_args slargs;
- slargs.slot_count = PVFS2_READDIR_DEFAULT_DESC_COUNT;
+ slargs.slot_count = ORANGEFS_READDIR_DEFAULT_DESC_COUNT;
slargs.slot_array = bufmap->readdir_index_array;
slargs.slot_lock = &bufmap->readdir_index_lock;
slargs.slot_wq = &readdir_waitq;
put_back_slot(&slargs, buffer_index);
- pvfs2_bufmap_unref(bufmap);
+ orangefs_bufmap_unref(bufmap);
}
-int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap,
+int orangefs_bufmap_copy_from_iovec(struct orangefs_bufmap *bufmap,
struct iov_iter *iter,
int buffer_index,
size_t size)
{
- struct pvfs_bufmap_desc *to = &bufmap->desc_array[buffer_index];
+ struct orangefs_bufmap_desc *to = &bufmap->desc_array[buffer_index];
int i;
gossip_debug(GOSSIP_BUFMAP_DEBUG,
@@ -531,12 +531,12 @@ int pvfs_bufmap_copy_from_iovec(struct pvfs2_bufmap *bufmap,
* a file being read.
*
*/
-int pvfs_bufmap_copy_to_iovec(struct pvfs2_bufmap *bufmap,
+int orangefs_bufmap_copy_to_iovec(struct orangefs_bufmap *bufmap,
struct iov_iter *iter,
int buffer_index,
size_t size)
{
- struct pvfs_bufmap_desc *from = &bufmap->desc_array[buffer_index];
+ struct orangefs_bufmap_desc *from = &bufmap->desc_array[buffer_index];
int i;
gossip_debug(GOSSIP_BUFMAP_DEBUG,