Linux Kernel
3.7.1
|
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/file.h>
#include <linux/pagemap.h>
#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/task_io_accounting_ops.h>
#include <linux/module.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_page.h>
#include <linux/sunrpc/clnt.h>
#include <asm/uaccess.h>
#include <linux/atomic.h>
#include "internal.h"
#include "iostat.h"
#include "pnfs.h"
Go to the source code of this file.
Data Structures | |
struct | nfs_direct_req |
Macros | |
#define | NFSDBG_FACILITY NFSDBG_VFS |
#define | NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */ |
#define | NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */ |
Functions | |
ssize_t | nfs_direct_IO (int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs) |
void | nfs_init_cinfo_from_dreq (struct nfs_commit_info *cinfo, struct nfs_direct_req *dreq) |
ssize_t | nfs_dreq_bytes_left (struct nfs_direct_req *dreq) |
EXPORT_SYMBOL_GPL (nfs_dreq_bytes_left) | |
ssize_t | nfs_file_direct_read (struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos, bool uio) |
ssize_t | nfs_file_direct_write (struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos, bool uio) |
int __init | nfs_init_directcache (void) |
void | nfs_destroy_directcache (void) |
#define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */ |
#define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */ |
#define NFSDBG_FACILITY NFSDBG_VFS |
EXPORT_SYMBOL_GPL | ( | nfs_dreq_bytes_left | ) |
nfs_destroy_directcache - destroy the slab cache for nfs_direct_req structures
ssize_t nfs_direct_IO | ( | int | rw, |
struct kiocb * | iocb, | ||
const struct iovec * | iov, | ||
loff_t | pos, | ||
unsigned long | nr_segs | ||
) |
nfs_direct_IO - NFS address space operation for direct I/O : direction (read or write) : target I/O control block : array of vectors that define I/O buffer : offset in file to begin the operation : size of iovec array
The presence of this routine in the address space ops vector means the NFS client supports direct I/O. However, for most direct IO, we shunt off direct read and write requests before the VFS gets them, so this method is only ever called for swap.
ssize_t nfs_dreq_bytes_left | ( | struct nfs_direct_req * | dreq | ) |
ssize_t nfs_file_direct_read | ( | struct kiocb * | iocb, |
const struct iovec * | iov, | ||
unsigned long | nr_segs, | ||
loff_t | pos, | ||
bool | uio | ||
) |
nfs_file_direct_read - file direct read operation for NFS files : target I/O control block : vector of user buffers into which to read data : size of iov vector : byte offset in file where reading starts
We use this function for direct reads instead of calling generic_file_aio_read() in order to avoid gfar's check to see if the request starts before the end of the file. For that check to work, we must generate a GETATTR before each direct read, and even then there is a window between the GETATTR and the subsequent READ where the file size could change. Our preference is simply to do all reads the application wants, and the server will take care of managing the end of file boundary.
This function also eliminates unnecessarily updating the file's atime locally, as the NFS server sets the file's atime, and this client must read the updated atime from the server back into its cache.
ssize_t nfs_file_direct_write | ( | struct kiocb * | iocb, |
const struct iovec * | iov, | ||
unsigned long | nr_segs, | ||
loff_t | pos, | ||
bool | uio | ||
) |
nfs_file_direct_write - file direct write operation for NFS files : target I/O control block : vector of user buffers from which to write data : size of iov vector : byte offset in file where writing starts
We use this function for direct writes instead of calling generic_file_aio_write() in order to avoid taking the inode semaphore and updating the i_size. The NFS server will set the new i_size and this client must read the updated size back into its cache. We let the server do generic write parameter checking and report problems.
We eliminate local atime updates, see direct read above.
We avoid unnecessary page cache invalidations for normal cached readers of this file.
Note that O_APPEND is not supported for NFS direct writes, as there is no atomic O_APPEND write facility in the NFS protocol.
void nfs_init_cinfo_from_dreq | ( | struct nfs_commit_info * | cinfo, |
struct nfs_direct_req * | dreq | ||
) |