[pnfs] [PATCH 06/37] pnfs: obliterate use_pagecache policy op and non page cache paths

Dean Hildebrand seattleplus at gmail.com
Wed Jan 2 16:57:17 EST 2008


I guess removing the non-pagecache code is ok.  Is the below_threshold 
function being called elsewhere?  I'm not sure which repository to check 
for the original code.

Dean
> -/*
> - * Call the appropriate parallel I/O subsystem read function.
> - * If no I/O device driver exists, or one does match the returned
> - * fstype, then call regular NFS processing.
> - */
> -ssize_t
> -pnfs_file_read(struct file *filp,
> -	       char __user *buf,
> -	       size_t count,
> -	       loff_t *pos)
> -{
> -	struct dentry  *dentry = filp->f_dentry;
> -	struct inode *inode = dentry->d_inode;
> -	ssize_t result = count;
> -	struct nfs_inode *nfsi = NFS_I(inode);
> -	struct nfs_server *nfss = NFS_SERVER(inode);
> -
> -	dfprintk(IO, "%s:(%s/%s, %lu@%lu)\n",
> -		 __FUNCTION__,
> -		 dentry->d_parent->d_name.name,
> -		 dentry->d_name.name,
> -		 (unsigned long) count,
> -		 (unsigned long) *pos);
> -
> -	/* Using NFS page cache with pNFS */
> -	if (use_page_cache(inode))
> -		goto fallback;
> -
> -	/* Small I/O Optimization */
> -	if (below_threshold(inode, count, 0)) {
> -		dfprintk(IO, "%s: Below Read threshold, using NFSv4 read\n", __FUNCTION__);
> -		goto fallback;
> -	}
> -
> -	/* Step 1: Retrieve and set layout if not allready cached*/
> -	result = virtual_update_layout(inode,
> -				(struct nfs_open_context *)filp->private_data,
> -				count,
> -				*pos,
> -				IOMODE_READ);
> -	if (result) {
> -		dfprintk(IO, "%s: Could not get layout result=%Zd, using NFSv4 read\n", __FUNCTION__, result);
> -		goto fallback;
> -	}
> -
> -	/* Step 2: Call I/O device driver's read function */
> -	if (!nfss->pnfs_curr_ld->ld_io_ops &&
> -	    nfss->pnfs_curr_ld->ld_io_ops->read) {
> -		dfprintk(IO, "%s: No LD read function, using NFSv4 read\n", __FUNCTION__);
> -		goto fallback;
> -	}
> -
> -	result = nfss->pnfs_curr_ld->ld_io_ops->read(nfsi->current_layout,
> -						     filp, buf, count, pos);
> -	dprintk("%s end (err:%Zd)\n", __FUNCTION__, result);
> -	return result;
> -
> -fallback:
> -	return do_sync_read(filp, buf, count, pos);
> -}
> -
>  int pnfs_try_to_write_data(struct nfs_write_data *data,
>  				const struct rpc_call_ops *call_ops, int how)
>  {
> @@ -1148,85 +1064,6 @@ int pnfs_try_to_write_data(struct nfs_write_data *data,
>  	}
>  }
>  
> -/*
> - * Call the appropriate parallel I/O subsystem write function.
> - * If no I/O device driver exists, or one does match the returned
> - * fstype, then call regular NFS processing.
> - */
> -ssize_t
> -pnfs_file_write(struct file *filp,
> -		const char __user *buf,
> -		size_t count,
> -		loff_t *pos)
> -{
> -	struct dentry  *dentry = filp->f_dentry;
> -	struct inode *inode = dentry->d_inode;
> -	ssize_t result = count;
> -	loff_t pos_orig = *pos;
> -	const int isblk = S_ISBLK(inode->i_mode);
> -	struct nfs_server *nfss = NFS_SERVER(inode);
> -	struct nfs_inode *nfsi = NFS_I(inode);
> -
> -	dfprintk(IO, "%s:(%s/%s(%ld), %lu@%lu)\n",
> -		 __FUNCTION__,
> -		 dentry->d_parent->d_name.name,
> -		 dentry->d_name.name,
> -		 inode->i_ino,
> -		 (unsigned long) count,
> -		 (unsigned long) *pos);
> -
> -	/* Using NFS page cache with pNFS */
> -	if (use_page_cache(inode))
> -		goto fallback;
> -
> -	/* Small I/O Optimization */
> -	if (below_threshold(inode, count, 1)) {
> -		dfprintk(IO, "%s: Below write threshold, using NFSv4 write\n", __FUNCTION__);
> -		goto fallback;
> -	}
> -
> -	/* Need to adjust write param if this is an append, etc */
> -	generic_write_checks(filp, pos, &count, isblk);
> -
> -	dprintk("%s:Readjusted %lu@%lu)\n", __FUNCTION__,
> -		(unsigned long) count, (unsigned long) *pos);
> -
> -	/* Step 1: Retrieve and set layout if not allready cached */
> -	result = virtual_update_layout(inode,
> -				(struct nfs_open_context *)filp->private_data,
> -				count,
> -				*pos,
> -				IOMODE_RW);
> -	if (result) {
> -		dfprintk(IO, "%s: Could not get layout result=%Zd, using NFSv4 write\n", __FUNCTION__, result);
> -		goto fallback;
> -	}
> -
> -	/* Step 2: Call I/O device driver's write function */
> -	if (!nfss->pnfs_curr_ld->ld_io_ops &&
> -	    nfss->pnfs_curr_ld->ld_io_ops->write) {
> -		dfprintk(IO, "%s: No LD write function, using NFSv4 write\n", __FUNCTION__);
> -		goto fallback;
> -	}
> -
> -	result = nfss->pnfs_curr_ld->ld_io_ops->write(nfsi->current_layout,
> -						      filp, buf, count, pos);
> -
> -	/* Update layoutcommit info.
> -	 * TODO: This assumes the layout driver wrote synchronously.
> -	 * This is fine for PVFS2, the only current layout driver to
> -	 * use the read/write interface. */
> -	if (result > 0) {
> -		pnfs_update_last_write(nfsi, pos_orig, result);
> -		pnfs_need_layoutcommit(nfsi, (struct nfs_open_context *)filp->private_data);
> -	}
> -	dprintk("%s end (err:%Zd)\n", __FUNCTION__, result);
> -	return result;
> -
> -fallback:
> -	return do_sync_write(filp, buf, count, pos);
> -}
> -
>  int pnfs_try_to_commit(struct inode *inode, struct nfs_write_data *data, struct list_head *head, int how)
>  {
>  	int status;
> @@ -1296,59 +1133,6 @@ pnfs_commit(struct inode *inode,
>  }
>  
>  int
> -pnfs_fsync(struct file *file, struct dentry *dentry, int datasync)
> -{
> -	int result = 0;
> -	struct inode *inode = dentry->d_inode;
> -	struct nfs_inode *nfsi = NFS_I(inode);
> -	struct nfs_server *nfss = NFS_SERVER(inode);
> -	dprintk("%s: Begin\n", __FUNCTION__);
> -
> -	/* pNFS is only for v4
> -	 * Only fsync nfs if an outstanding nfs request requires it
> -	 * Some problems seem to be happening if ncommit and ndirty
> -	 * are both 0 and I still don't call nfs_fsync
> -	 */
> -	if (use_page_cache(inode)) {
> -		dfprintk(IO, "%s: Calling nfs_fsync\n", __FUNCTION__);
> -		result = nfs_fsync(file, dentry, datasync);
> -		goto out;
> -	}
> -
> -	if (!nfss->pnfs_curr_ld->ld_io_ops->fsync) {
> -		dprintk("%s: Layoutdriver lacks fsync function!\n", __FUNCTION__);
> -		result = -EIO;
> -		goto out;
> -	}
> -
> -	/* Retrieve and set layout if not allready cached.
> -	 * This is necessary since read/write may not have necessarily
> -	 * been already called.  Just put in any random count and offset.
> -	 * TODO: May need special count and offset depending on how file system
> -	 * work that actually pay attention to such values.
> -	 */
> -	result = virtual_update_layout(inode,
> -				(struct nfs_open_context *)file->private_data,
> -				0,
> -				0,
> -				IOMODE_RW);
> -	if (result) {
> -		result = -EIO;
> -		goto out;
> -	}
> -
> -	dprintk("%s: Calling layout driver fsync\n", __FUNCTION__);
> -	result = nfss->pnfs_curr_ld->ld_io_ops->fsync(nfsi->current_layout,
> -						      file,
> -						      dentry,
> -						      datasync);
> -
> -out:
> -	dprintk("%s end (err:%d)\n", __FUNCTION__, result);
> -	return result;
> -}
> -
> -int
>  pnfs_getdevicelist(struct super_block *sb, struct nfs_fh *fh,
>  		   struct pnfs_devicelist *devlist)
>  {
> @@ -1563,7 +1347,6 @@ out_unlock:
>  /* Callback operations for layout drivers.
>   */
>  struct pnfs_client_operations pnfs_ops = {
> -	.nfs_fsync = nfs_fsync,
>  	.nfs_getdevicelist = pnfs_getdevicelist,
>  	.nfs_getdeviceinfo = pnfs_getdeviceinfo,
>  	.nfs_readlist_complete = pnfs_read_done,
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index f1b5862..6a5931f 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -22,8 +22,6 @@ int pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *range
>  int pnfs_return_layout_rpc(struct nfs_server *server, struct nfs4_pnfs_layoutreturn_arg *argp);
>  void set_pnfs_layoutdriver(struct super_block *sb, struct nfs_fh *fh, u32 id);
>  void unmount_pnfs_layoutdriver(struct super_block *sb);
> -ssize_t pnfs_file_write(struct file *filp, const char __user *buf, size_t count, loff_t *pos);
> -ssize_t pnfs_file_read(struct file *filp, char __user *buf, size_t count, loff_t *pos);
>  int pnfs_use_read(struct inode *inode, ssize_t count);
>  int pnfs_use_ds_io(struct list_head *, struct inode *, int);
>  
> @@ -32,7 +30,6 @@ int pnfs_writepages(struct nfs_write_data *wdata, int how);
>  int pnfs_try_to_write_data(struct nfs_write_data *, const struct rpc_call_ops *, int);
>  int pnfs_readpages(struct nfs_read_data *rdata);
>  int pnfs_try_to_read_data(struct nfs_read_data *data, const struct rpc_call_ops *call_ops);
> -int pnfs_fsync(struct file *file, struct dentry *dentry, int datasync);
>  int pnfs_initialize(void);
>  void pnfs_uninitialize(void);
>  void pnfs_layoutcommit_done(struct pnfs_layoutcommit_data *data, int status);
> diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
> index 529f522..941dda7 100644
> --- a/include/linux/nfs4_pnfs.h
> +++ b/include/linux/nfs4_pnfs.h
> @@ -44,16 +44,7 @@ struct layoutdriver_io_operations {
>  	ssize_t (*read_pagelist) (struct pnfs_layout_type *layoutid, struct inode *, struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, struct nfs_read_data *nfs_data);
>  	ssize_t (*write_pagelist) (struct pnfs_layout_type *layoutid, struct inode *, struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, int sync, struct nfs_write_data *nfs_data);
>  
> -	/* Functions that do not use the pagecache.
> -	 * If use_pagecache == 0, then these functions must be implemented.
> -	 */
> -	ssize_t (*read) (struct pnfs_layout_type *layoutid, struct file *, char __user *, size_t, loff_t *);
> -	ssize_t (*write) (struct pnfs_layout_type *layoutid, struct file *, const char __user *, size_t, loff_t *);
> -	ssize_t (*readv) (struct pnfs_layout_type *layoutid, struct file *, const struct iovec *, unsigned long, loff_t *);
> -	ssize_t (*writev) (struct pnfs_layout_type *layoutid, struct file *, const struct iovec *, unsigned long, loff_t *);
> -
>  	/* Consistency ops */
> -	int (*fsync) (struct pnfs_layout_type *layoutid, struct file *, struct dentry *, int);
>  	/* 2 problems:
>  	 * 1) the page list contains nfs_pages, NOT pages
>  	 * 2) currently the NFS code doesn't create a page array (as it does with read/write)
> @@ -102,11 +93,6 @@ struct layoutdriver_policy_operations {
>  	/* Write requests under this value are sent to the NFSv4 server */
>  	ssize_t (*get_write_threshold) (struct pnfs_layout_type *, struct inode *);
>  
> -	/* Use the linux page cache prior to calling layout driver
> -	 * read/write functions
> -	 */
> -	int (*use_pagecache) (struct pnfs_layout_type *, struct inode *);
> -
>  	/* Should the pNFS client issue a layoutget call in the
>  	 * same compound as the OPEN operation?
>  	 */
> @@ -146,7 +132,6 @@ struct pnfs_devicelist {
>   * E.g., getdeviceinfo, I/O callbacks, etc
>   */
>  struct pnfs_client_operations {
> -	int (*nfs_fsync) (struct file *file, struct dentry *dentry, int datasync);
>  	int (*nfs_getdevicelist) (struct super_block *sb, struct nfs_fh *fh, struct pnfs_devicelist *devlist);
>  	int (*nfs_getdeviceinfo) (struct inode *inode, u32 dev_id, struct pnfs_device *dev);
>  
>   


More information about the pNFS mailing list