[Pvfs2-cvs] commit by slang in pvfs2/src/kernel/linux-2.6:
devpvfs2-req.c file.c pvfs2-cache.c
CVS commit program
cvs at parl.clemson.edu
Tue Nov 28 12:47:13 EST 2006
Update of /projects/cvsroot/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv24385/src/kernel/linux-2.6
Modified Files:
Tag: pvfs-2-6-branch
devpvfs2-req.c file.c pvfs2-cache.c
Log Message:
back out immutable changes for now.
Index: devpvfs2-req.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/devpvfs2-req.c,v
diff -p -u -r1.66.10.1 -r1.66.10.2
--- devpvfs2-req.c 27 Nov 2006 20:02:48 -0000 1.66.10.1
+++ devpvfs2-req.c 28 Nov 2006 17:47:13 -0000 1.66.10.2
@@ -232,18 +232,11 @@ static ssize_t pvfs2_devreq_read(
return len;
}
-struct devrw_options {
- struct file *file;
- /* Asynch I/O control block */
- struct kiocb *iocb;
- struct iovec *iov;
- unsigned long nr_segs;
- loff_t *offset;
-};
-
-#if defined(HAVE_WRITEV_FILE_OPERATIONS) || defined(HAVE_AIO_NEW_AIO_SIGNATURE)
-/* Common function for writev() and aio_write() callers into the device */
-static ssize_t do_devreq_writev(struct devrw_options *rw)
+static ssize_t pvfs2_devreq_writev(
+ struct file *file,
+ const struct iovec *iov,
+ unsigned long count,
+ loff_t * offset)
{
pvfs2_kernel_op_t *op = NULL;
struct qhash_head *hash_link = NULL;
@@ -257,18 +250,12 @@ static ssize_t do_devreq_writev(struct d
int32_t magic = 0;
int32_t proto_ver = 0;
uint64_t tag = 0;
- struct iovec *iov = NULL;
- ssize_t total_returned_size = 0;
- if (!rw || ((iov = rw->iov) == NULL)) {
- gossip_err("Error: invalid parameter to device vectored write\n");
- return -EINVAL;
- }
/* Either there is a trailer or there isn't */
- if (rw->nr_segs != notrailer_count && rw->nr_segs != (notrailer_count + 1))
+ if (count != notrailer_count && count != (notrailer_count + 1))
{
gossip_err("Error: Number of iov vectors is (%ld) and notrailer count is %d\n",
- rw->nr_segs, notrailer_count);
+ count, notrailer_count);
return -EPROTO;
}
buffer = dev_req_alloc();
@@ -297,7 +284,6 @@ static ssize_t do_devreq_writev(struct d
ptr += iov[i].iov_len;
payload_size += iov[i].iov_len;
}
- total_returned_size = payload_size;
/* these elements are currently 8 byte aligned (8 bytes for (version +
* magic) 8 bytes for tag). If you add another element, either make it 8
@@ -352,10 +338,10 @@ static ssize_t do_devreq_writev(struct d
if (op->downcall.status == 0 && op->downcall.trailer_size > 0)
{
gossip_debug(GOSSIP_DEV_DEBUG, "writev: trailer size %ld\n", (unsigned long) op->downcall.trailer_size);
- if (rw->nr_segs != (notrailer_count + 1))
+ if (count != (notrailer_count + 1))
{
gossip_err("Error: trailer size (%ld) is non-zero, no trailer elements though? (%ld)\n",
- (unsigned long) op->downcall.trailer_size, rw->nr_segs);
+ (unsigned long) op->downcall.trailer_size, count);
dev_req_release(buffer);
put_op(op);
return -EPROTO;
@@ -555,51 +541,8 @@ static ssize_t do_devreq_writev(struct d
}
dev_req_release(buffer);
- /* if we are called from aio context, just mark that the iocb is completed */
- if (rw->iocb) {
- aio_complete(rw->iocb, total_returned_size, 0);
- }
-
- return total_returned_size;
-}
-/* end of do_devreq_writev */
-#endif /* HAVE_WRITEV_FILE_OPERATIONS || HAVE_AIO_NEW_AIO_SIGNATURE */
-
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
-static ssize_t pvfs2_devreq_writev(
- struct file *file,
- const struct iovec *iov,
- unsigned long n_segs,
- loff_t * offset)
-{
- struct devrw_options rw;
-
- memset(&rw, 0, sizeof(rw));
- rw.iocb = NULL;
- rw.iov = (struct iovec *) iov;
- rw.nr_segs = n_segs;
- rw.offset = offset;
- return do_devreq_writev(&rw);
+ return count;
}
-#endif
-
-#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
-/* For simplicity I am going to treat this aio call as if it were synchronous */
-static ssize_t
-pvfs2_devreq_aio_write(struct kiocb *iocb, const struct iovec *iov,
- unsigned long n_segs, loff_t offset)
-{
- struct devrw_options rw;
-
- memset(&rw, 0, sizeof(rw));
- rw.file = iocb->ki_filp;
- rw.iov = (struct iovec *) iov;
- rw.nr_segs = n_segs;
- rw.offset = &offset;
- return do_devreq_writev(&rw);
-}
-
-#endif
/* Returns whether any FS are still pending remounted */
static int mark_all_pending_mounts(void)
@@ -1053,21 +996,14 @@ struct file_operations pvfs2_devreq_file
#ifdef PVFS2_LINUX_KERNEL_2_4
owner: THIS_MODULE,
read : pvfs2_devreq_read,
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
writev : pvfs2_devreq_writev,
-#endif
open : pvfs2_devreq_open,
release : pvfs2_devreq_release,
ioctl : pvfs2_devreq_ioctl,
poll : pvfs2_devreq_poll
#else
.read = pvfs2_devreq_read,
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
.writev = pvfs2_devreq_writev,
-#endif
-#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
- .aio_write = pvfs2_devreq_aio_write,
-#endif
.open = pvfs2_devreq_open,
.release = pvfs2_devreq_release,
.ioctl = pvfs2_devreq_ioctl,
Index: file.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/file.c,v
diff -p -u -r1.129.8.1 -r1.129.8.2
--- file.c 27 Nov 2006 20:02:48 -0000 1.129.8.1
+++ file.c 28 Nov 2006 17:47:13 -0000 1.129.8.2
@@ -725,8 +725,16 @@ ssize_t pvfs2_file_read(
rw.dest.address.nr_segs = 1;
rw.off.io.offset = offset;
- rw.readahead_size = 0;
- return do_direct_readv_writev(&rw);
+ if (IS_IMMUTABLE(rw.inode))
+ {
+ rw.readahead_size = (rw.inode)->i_size;
+ return generic_file_read(file, buf, count, offset);
+ }
+ else
+ {
+ rw.readahead_size = 0;
+ return do_direct_readv_writev(&rw);
+ }
}
/** Write data from a contiguous user buffer into a file at a specified
@@ -759,7 +767,6 @@ static ssize_t pvfs2_file_write(
return do_direct_readv_writev(&rw);
}
-#ifdef HAVE_READV_FILE_OPERATIONS
/** Reads data to several contiguous user buffers (an iovec) from a file at a
* specified offset.
*/
@@ -787,9 +794,7 @@ static ssize_t pvfs2_file_readv(
rw.readahead_size = 0;
return do_direct_readv_writev(&rw);
}
-#endif
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
/** Write data from a several contiguous user buffers (an iovec) into a file at
* a specified offset.
*/
@@ -817,7 +822,6 @@ static ssize_t pvfs2_file_writev(
return do_direct_readv_writev(&rw);
}
-#endif
/* Construct a trailer of <file offsets, length pairs> in a buffer that we
@@ -2060,32 +2064,12 @@ out_error:
return error;
}
-#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
-static ssize_t
-pvfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
- unsigned long n_segs, loff_t offset)
-#else
static ssize_t
pvfs2_file_aio_read(struct kiocb *iocb, char __user *buffer,
size_t count, loff_t offset)
-#endif
{
struct rw_options rw;
- struct iovec *pvec;
- unsigned long nr_segs;
-
-#ifndef HAVE_AIO_NEW_AIO_SIGNATURE
struct iovec vec;
-
- vec.iov_base = (char __user *) buffer;
- vec.iov_len = count;
- pvec = (struct iovec *) &vec;
- nr_segs = 1;
-#else
- pvec = (struct iovec *) iov;
- nr_segs = n_segs;
-#endif
-
memset(&rw, 0, sizeof(rw));
rw.async = !is_sync_kiocb(iocb);
rw.type = IO_READ;
@@ -2094,6 +2078,8 @@ pvfs2_file_aio_read(struct kiocb *iocb,
rw.copy_to_user = 1;
rw.fnstr = __FUNCTION__;
rw.iocb = iocb;
+ vec.iov_base = (char __user *) buffer;
+ vec.iov_len = count;
rw.file = iocb->ki_filp;
if (!rw.file || !(rw.file)->f_mapping)
{
@@ -2101,39 +2087,28 @@ pvfs2_file_aio_read(struct kiocb *iocb,
}
rw.inode = (rw.file)->f_mapping->host;
rw.pvfs2_inode = PVFS2_I(rw.inode);
- rw.dest.address.iov = pvec;
- rw.dest.address.nr_segs = nr_segs;
+ rw.dest.address.iov = &vec;
+ rw.dest.address.nr_segs = 1;
- rw.readahead_size = 0;
- return do_direct_aio_read_write(&rw);
+ if (IS_IMMUTABLE(rw.inode))
+ {
+ rw.readahead_size = (rw.inode)->i_size;
+ return generic_file_aio_read(iocb, buffer, count, offset);
+ }
+ else
+ {
+ rw.readahead_size = 0;
+ return do_direct_aio_read_write(&rw);
+ }
}
-#ifdef HAVE_AIO_NEW_AIO_SIGNATURE
-static ssize_t
-pvfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
- unsigned long n_segs, loff_t offset)
-#else
static ssize_t
pvfs2_file_aio_write(struct kiocb *iocb, const char __user *buffer,
size_t count, loff_t offset)
-#endif
{
struct rw_options rw;
- struct iovec *pvec;
- unsigned long nr_segs;
-
-#ifndef HAVE_AIO_NEW_AIO_SIGNATURE
struct iovec vec;
- vec.iov_base = (char __user *) buffer;
- vec.iov_len = count;
- pvec = (struct iovec *) &vec;
- nr_segs = 1;
-#else
- pvec = (struct iovec *) iov;
- nr_segs = n_segs;
-#endif
-
memset(&rw, 0, sizeof(rw));
rw.async = !is_sync_kiocb(iocb);
rw.type = IO_WRITE;
@@ -2143,6 +2118,8 @@ pvfs2_file_aio_write(struct kiocb *iocb,
rw.copy_to_user = 1;
rw.fnstr = __FUNCTION__;
rw.iocb = iocb;
+ vec.iov_base = (char __user *) buffer;
+ vec.iov_len = count;
rw.file = iocb->ki_filp;
if (!rw.file || !(rw.file)->f_mapping)
{
@@ -2150,8 +2127,8 @@ pvfs2_file_aio_write(struct kiocb *iocb,
}
rw.inode = (rw.file)->f_mapping->host;
rw.pvfs2_inode = PVFS2_I(rw.inode);
- rw.dest.address.iov = pvec;
- rw.dest.address.nr_segs = nr_segs;
+ rw.dest.address.iov = &vec;
+ rw.dest.address.nr_segs = 1;
return do_direct_aio_read_write(&rw);
}
@@ -2471,12 +2448,8 @@ struct file_operations pvfs2_file_operat
llseek : pvfs2_file_llseek,
read : pvfs2_file_read,
write : pvfs2_file_write,
-#ifdef HAVE_READV_FILE_OPERATIONS
readv : pvfs2_file_readv,
-#endif
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
writev : pvfs2_file_writev,
-#endif
ioctl : pvfs2_ioctl,
mmap : pvfs2_file_mmap,
open : pvfs2_file_open,
@@ -2486,12 +2459,8 @@ struct file_operations pvfs2_file_operat
.llseek = pvfs2_file_llseek,
.read = pvfs2_file_read,
.write = pvfs2_file_write,
-#ifdef HAVE_READV_FILE_OPERATIONS
.readv = pvfs2_file_readv,
-#endif
-#ifdef HAVE_WRITEV_FILE_OPERATIONS
.writev = pvfs2_file_writev,
-#endif
#ifdef HAVE_AIO_VFS_SUPPORT
.aio_read = pvfs2_file_aio_read,
.aio_write = pvfs2_file_aio_write,
Index: pvfs2-cache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-cache.c,v
diff -p -u -r1.36.8.1 -r1.36.8.2
--- pvfs2-cache.c 27 Nov 2006 20:02:48 -0000 1.36.8.1
+++ pvfs2-cache.c 28 Nov 2006 17:47:13 -0000 1.36.8.2
@@ -48,12 +48,7 @@ int op_cache_initialize(void)
int op_cache_finalize(void)
{
- int ret = 0;
-#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
- ret =
-#endif
- kmem_cache_destroy(op_cache);
- if (ret != 0)
+ if (kmem_cache_destroy(op_cache) != 0)
{
gossip_err("Failed to destroy pvfs2_op_cache\n");
return -EINVAL;
@@ -217,12 +212,7 @@ int dev_req_cache_initialize(void)
int dev_req_cache_finalize(void)
{
- int ret = 0;
-#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
- ret =
-#endif
- kmem_cache_destroy(dev_req_cache);
- if (ret != 0)
+ if (kmem_cache_destroy(dev_req_cache) != 0)
{
gossip_err("Failed to destroy pvfs2_devreqcache\n");
return -EINVAL;
@@ -336,7 +326,6 @@ int pvfs2_inode_cache_initialize(void)
int pvfs2_inode_cache_finalize(void)
{
- int ret = 0;
if (!list_empty(&pvfs2_inode_list))
{
gossip_err("pvfs2_inode_cache_finalize: WARNING: releasing unreleased pvfs2 inode objects!\n");
@@ -347,11 +336,7 @@ int pvfs2_inode_cache_finalize(void)
kmem_cache_free(pvfs2_inode_cache, pinode);
}
}
-#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
- ret =
-#endif
- kmem_cache_destroy(pvfs2_inode_cache);
- if (ret != 0)
+ if (kmem_cache_destroy(pvfs2_inode_cache) != 0)
{
gossip_err("Failed to destroy pvfs2_inode_cache\n");
return -EINVAL;
@@ -428,12 +413,7 @@ int kiocb_cache_initialize(void)
int kiocb_cache_finalize(void)
{
- int ret = 0;
-#ifdef HAVE_INT_RETURN_KMEM_CACHE_DESTROY
- ret =
-#endif
- kmem_cache_destroy(pvfs2_kiocb_cache);
- if (ret != 0)
+ if (kmem_cache_destroy(pvfs2_kiocb_cache) != 0)
{
gossip_err("Failed to destroy pvfs2_devreqcache\n");
return -EINVAL;
More information about the Pvfs2-cvs
mailing list