: pnfs_submit: removal of fsdata manipulation
Subsystems (2)
cover : pnfs_submit: removal of fsdata manipulation
These revert patches in the submit branch in order to remove the fsdata manipulation needed by the block driver, followed immediately by the post-submit "un-reverts".
They apply on top of the 13 patches Andy previously sent.
Fred
PATCH 1/8 SQUASHME: pnfs_submit: Revert the pnfs_write_end part of "pnfs: commit and pnfs_write_end"
This reverts sections of commit db413b6aad54478ff0a11852b93aade64969f0ca.
pnfs_write_end is not used by the layout driver.
--- fs/nfs/file.c | 4 ---- fs/nfs/pnfs.c | 14 -------------- fs/nfs/pnfs.h | 23 ----------------------- include/linux/nfs4_pnfs.h | 3 --- 4 files changed, 0 insertions(+), 44 deletions(-)
fs/nfs/file.c +0 -4
@@ -487,12 +487,8 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,zero_user_segment (page, pglen,PAGE_CACHE_SIZE ); } - status =pnfs_write_end (file, page, pos, len, copied, fsdata); -if (status) - goto out; status =nfs_updatepage (file, page, offset, copied, fsdata); - out:unlock_page (page);page_cache_release (page);pnfs_write_end_cleanup (fsdata);
fs/nfs/pnfs.c +0 -14
@@ -1965,20 +1965,6 @@ out:return status; } -/* Return 0 on succes, negative on failure */ -/* CAREFUL - what happens if copied < len??? */ -int _pnfs_write_end (struct inode *inode,struct page *page, -loff_t pos,unsigned len, -unsigned copied,struct pnfs_fsdata *fsdata) -{ -struct nfs_server *nfss =NFS_SERVER (inode); -int status; - - status = nfss->pnfs_curr_ld->ld_io_ops->write_end (inode, page, - pos, len, copied, fsdata); -return status; -} -/* Given an nfs request, determine if it should be flushed before proceeding. * It should default to returning False, returning True only if there is a * specific reason to flush.
fs/nfs/pnfs.h +0 -23
@@ -76,9 +76,6 @@ void pnfs_destroy_layout(struct nfs_inode *);int _pnfs_write_begin (struct inode *inode,struct page *page,loff_t pos,unsigned len,struct pnfs_fsdata **fsdata); -int _pnfs_write_end (struct inode *inode,struct page *page, -loff_t pos,unsigned len, -unsigned copied,struct pnfs_fsdata *fsdata);int _pnfs_do_flush (struct inode *inode,struct nfs_page *req,struct pnfs_fsdata *fsdata); void _pnfs_modify_new_write_request(struct nfs_page *req,
@@ -200,19 +197,6 @@ static inline int pnfs_do_flush(struct nfs_page *req, void *fsdata)return 0 ; } -static inline int pnfs_write_end (struct file *filp,struct page *page, -loff_t pos,unsigned len,unsigned copied, -void *fsdata) -{ -struct inode *inode = filp->f_dentry->d_inode; -struct nfs_server *nfss =NFS_SERVER (inode); - -if (PNFS_EXISTS_LDIO_OP (nfss, write_end)) -return _pnfs_write_end (inode, page, pos, len, copied, fsdata); -else -return 0 ; -} -static inline void pnfs_write_end_cleanup (void *fsdata) {pnfs_free_fsdata (fsdata);
@@ -312,13 +296,6 @@ static inline int pnfs_write_begin(struct file *filp, struct page *page,return 0 ; } -static inline int pnfs_write_end (struct file *filp,struct page *page, -loff_t pos,unsigned len,unsigned copied, -void *fsdata) -{ -return 0 ; -} -static inline void pnfs_write_end_cleanup (void *fsdata) { }
include/linux/nfs4_pnfs.h +0 -3
@@ -142,9 +142,6 @@ struct layoutdriver_io_operations {int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata); -int (*write_end)(struct inode *inode,struct page *page,loff_t pos, -unsigned count,unsigned copied, -struct pnfs_fsdata *fsdata);void (*new_request)(struct pnfs_layout_segment *lseg,struct nfs_page *req,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata);
Signature · 1 line
1.6.6.1
PATCH 2/8 SQUASHME: pnfs_submit: Revert "pnfs: pnfs_modify_new_request"
This reverts commit 0b10c9be0ad8e2da1f21dafc5e4526b50710c977.
This is not used by the file layout driver.
Conflicts:
fs/nfs/pnfs.h
--- fs/nfs/pagelist.c | 2 -- fs/nfs/pnfs.c | 19 ------------------- fs/nfs/pnfs.h | 15 --------------- include/linux/nfs4_pnfs.h | 3 --- 4 files changed, 0 insertions(+), 39 deletions(-)
fs/nfs/pagelist.c +0 -2
@@ -20,7 +20,6 @@#include <linux/nfs_mount.h> #include "internal.h" -#include "pnfs.h" static struct kmem_cache *nfs_page_cachep;
@@ -87,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, req->wb_bytes = count; req->wb_context =get_nfs_open_context (ctx);kref_init (&req->wb_kref); -pnfs_modify_new_request (req, fsdata);return req; }
fs/nfs/pnfs.c +0 -19
@@ -2245,25 +2245,6 @@ out_unlock: goto out; } -/* Note that fsdata != NULL */ -void _pnfs_modify_new_write_request (struct nfs_page *req, -struct pnfs_fsdata *fsdata) -{ -struct inode *inode = req->wb_page->mapping->host; -struct pnfs_layout_segment *lseg =NULL ; -loff_t pos; -unsigned count; - - pos = ((loff_t )req->wb_index <<PAGE_CACHE_SHIFT ) + req->wb_offset; - count = req->wb_bytes; - lseg =pnfs_find_get_lseg (inode, pos, count,IOMODE_RW ); -if (lseg) { -if (fsdata->ok_to_use_pnfs) -set_bit (PG_USE_PNFS , &req->wb_flags); -put_lseg (lseg); - } -} -void pnfs_free_fsdata (struct pnfs_fsdata *fsdata) {if (fsdata) {
fs/nfs/pnfs.h +0 -15
@@ -78,8 +78,6 @@ int _pnfs_write_begin(struct inode *inode, struct page *page, struct pnfs_fsdata **fsdata);int _pnfs_do_flush (struct inode *inode,struct nfs_page *req,struct pnfs_fsdata *fsdata); -void _pnfs_modify_new_write_request (struct nfs_page *req, -struct pnfs_fsdata *fsdata);void _pnfs_direct_init_io (struct inode *inode,struct nfs_open_context *ctx,size_t count,loff_t loff,int iswrite,size_t *rwsize,size_t *remaining);
@@ -207,14 +205,6 @@ static inline void pnfs_redirty_request(struct nfs_page *req)clear_bit (PG_USE_PNFS , &req->wb_flags); } -static inline void pnfs_modify_new_request (struct nfs_page *req, -void *fsdata) -{ -if (fsdata) -_pnfs_modify_new_write_request (req, fsdata); -/* Should we do something (like set PG_USE_PNFS) if !fsdata ? */ -} - static inline int pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *lseg, const nfs4_stateid *stateid, /* optional */
@@ -304,11 +294,6 @@ static inline void pnfs_redirty_request(struct nfs_page *req) { } -static inline void pnfs_modify_new_request (struct nfs_page *req, -void *fsdata) -{ -} -static inline int pnfs_get_write_status (struct nfs_write_data *data) {return 0 ;
include/linux/nfs4_pnfs.h +0 -3
@@ -142,9 +142,6 @@ struct layoutdriver_io_operations {int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata); -void (*new_request)(struct pnfs_layout_segment *lseg, -struct nfs_page *req,loff_t pos,unsigned count, -struct pnfs_fsdata *fsdata);/* Consistency ops */ /* 2 problems:
Signature · 1 line
1.6.6.1
PATCH 3/8 SQUASHME: pnfs_submit: Revert "pnfs: propagate fsdata into nfs_create_request"
This reverts commit 4c33e93770316cfa71e2c39965e344a0cc068c65.
fsdata is not used by the file layout
--- fs/nfs/file.c | 4 ++-- fs/nfs/pagelist.c | 2 +- fs/nfs/read.c | 4 ++-- fs/nfs/write.c | 20 +++++++++----------- include/linux/nfs_fs.h | 3 +-- include/linux/nfs_page.h | 3 +-- 6 files changed, 16 insertions(+), 20 deletions(-)
fs/nfs/file.c +2 -2
@@ -487,7 +487,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,zero_user_segment (page, pglen,PAGE_CACHE_SIZE ); } - status =nfs_updatepage (file, page, offset, copied, fsdata); + status =nfs_updatepage (file, page, offset, copied);unlock_page (page);page_cache_release (page);
@@ -608,7 +608,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)if (ret !=0 ) goto out_unlock; - ret =nfs_updatepage (filp, page,0 , pagelen,NULL ); + ret =nfs_updatepage (filp, page,0 , pagelen); out_unlock:if (!ret)return VM_FAULT_LOCKED ;
fs/nfs/pagelist.c +1 -1
@@ -56,7 +56,7 @@ nfs_page_free(struct nfs_page *p)struct nfs_page *nfs_create_request (struct nfs_open_context *ctx,struct inode *inode,struct page *page, -unsigned int offset,unsigned int count,void *fsdata) +unsigned int offset,unsigned int count) {struct nfs_page *req;
fs/nfs/read.c +2 -2
@@ -125,7 +125,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, len =nfs_page_length (page);if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (ctx, inode, page,0 , len,NULL ); + new =nfs_create_request (ctx, inode, page,0 , len);if (IS_ERR (new)) {unlock_page (page);return PTR_ERR (new);
@@ -606,7 +606,7 @@ readpage_async_filler(void *data, struct page *page)if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (desc->ctx, inode, page,0 , len,NULL ); + new =nfs_create_request (desc->ctx, inode, page,0 , len);if (IS_ERR (new)) goto out_error;
fs/nfs/write.c +9 -11
@@ -570,8 +570,7 @@ static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgstatic struct nfs_page *nfs_try_to_update_request (struct inode *inode,struct page *page,unsigned int offset, -unsigned int bytes, -void *fsdata) +unsigned int bytes) {struct nfs_page *req;unsigned int rqend;
@@ -598,7 +597,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,*/ if (offset > rqend || end < req->wb_offset - ||pnfs_do_flush (req, fsdata)) + ||pnfs_do_flush (req,NULL )) goto out_flushme;if (nfs_set_page_tag_locked (req))
@@ -646,17 +645,16 @@ out_err:* already called nfs_flush_incompatible() if necessary. */ static struct nfs_page *nfs_setup_write_request (struct nfs_open_context * ctx, -struct page *page,unsigned int offset,unsigned int bytes, -void *fsdata) +struct page *page,unsigned int offset,unsigned int bytes) {struct inode *inode = page->mapping->host;struct nfs_page *req;int error; - req =nfs_try_to_update_request (inode, page, offset, bytes, fsdata); + req =nfs_try_to_update_request (inode, page, offset, bytes);if (req !=NULL ) goto out; - req =nfs_create_request (ctx, inode, page, offset, bytes, fsdata); + req =nfs_create_request (ctx, inode, page, offset, bytes);if (IS_ERR (req)) goto out; error =nfs_inode_add_request (inode, req);
@@ -669,11 +667,11 @@ out: }static int nfs_writepage_setup (struct nfs_open_context *ctx,struct page *page, -unsigned int offset,unsigned int count,void *fsdata) +unsigned int offset,unsigned int count) {struct nfs_page *req; - req =nfs_setup_write_request (ctx, page, offset, count, fsdata); + req =nfs_setup_write_request (ctx, page, offset, count);if (IS_ERR (req))return PTR_ERR (req);nfs_mark_request_dirty (req);
@@ -730,7 +728,7 @@ static int nfs_write_pageuptodate(struct page *page, struct inode *inode)* things with a page scheduled for an RPC call (e.g. invalidate it). */ int nfs_updatepage (struct file *file,struct page *page, -unsigned int offset,unsigned int count,void *fsdata) +unsigned int offset,unsigned int count) {struct nfs_open_context *ctx =nfs_file_open_context (file);struct inode *inode = page->mapping->host;
@@ -755,7 +753,7 @@ int nfs_updatepage(struct file *file, struct page *page, offset =0 ; } - status =nfs_writepage_setup (ctx, page, offset, count, fsdata); + status =nfs_writepage_setup (ctx, page, offset, count);if (status <0 )nfs_set_pageerror (page);
include/linux/nfs_fs.h +1 -2
@@ -504,8 +504,7 @@ extern int nfs_congestion_kb;extern int nfs_writepage (struct page *page,struct writeback_control *wbc);extern int nfs_writepages (struct address_space *,struct writeback_control *);extern int nfs_flush_incompatible (struct file *file,struct page *page); -extern int nfs_updatepage (struct file *,struct page *,unsigned int , -unsigned int ,void *); +extern int nfs_updatepage (struct file *,struct page *,unsigned int ,unsigned int );extern int nfs_writeback_done (struct rpc_task *,struct nfs_write_data *);/*
include/linux/nfs_page.h +1 -2
@@ -75,8 +75,7 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,struct inode *inode, struct page *page, unsigned int offset, - unsigned int count, - void *fsdata); + unsigned int count);extern void nfs_clear_request (struct nfs_page *req);extern void nfs_release_request (struct nfs_page *req);
Signature · 1 line
1.6.6.1
PATCH 4/8 SQUASHME: pnfs_submit: Revert "pnfs: pnfs_do_flush"
This reverts commit f61a5fb1508434b904f9382ba9488d1be4e6ac79.
pnfs_write_begin, fsdata handling, and pnfs_do_flush are not used by the layout driver.
Conflicts:
fs/nfs/pnfs.c
fs/nfs/pnfs.h
--- fs/nfs/file.c | 14 +------ fs/nfs/pnfs.c | 95 --------------------------------------------- fs/nfs/pnfs.h | 58 --------------------------- fs/nfs/write.c | 6 +-- include/linux/nfs4_pnfs.h | 12 ------ 5 files changed, 4 insertions(+), 181 deletions(-)
fs/nfs/file.c +2 -12
@@ -433,7 +433,8 @@ start: ret =nfs_flush_incompatible (file, page);if (ret) { - goto out_err; +unlock_page (page); +page_cache_release (page); }else if (!once_thru &&nfs_want_read_modify_write (file, page, pos, len)) { once_thru =1 ;
@@ -441,18 +442,8 @@ start:page_cache_release (page);if (!ret) goto start; - }else { - ret =pnfs_write_begin (file, page, pos, len, fsdata); -if (ret) - goto out_err; }return ret; - - out_err: -unlock_page (page); -page_cache_release (page); - *pagep =NULL ; -return ret; } static int nfs_write_end(struct file *file, struct address_space *mapping,
@@ -491,7 +482,6 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,unlock_page (page);page_cache_release (page); -pnfs_write_end_cleanup (fsdata);if (status <0 )return status;
fs/nfs/pnfs.c +0 -95
113 lines not on this page · raw message
fs/nfs/pnfs.h +0 -58
82 lines not on this page · raw message
fs/nfs/write.c +2 -4
@@ -596,8 +596,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,* have flushed out requests having wrong owners. */ if (offset > rqend - || end < req->wb_offset - ||pnfs_do_flush (req,NULL )) + || end < req->wb_offset) goto out_flushme;if (nfs_set_page_tag_locked (req))
@@ -700,8 +699,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page) req =nfs_page_find_request (page);if (req ==NULL )return 0 ; - do_flush = req->wb_page != page || req->wb_context != ctx || -pnfs_do_flush (req,NULL ); + do_flush = req->wb_page != page || req->wb_context != ctx;nfs_release_request (req);if (!do_flush)return 0 ;
include/linux/nfs4_pnfs.h +0 -12
@@ -37,11 +37,6 @@ struct pnfs_mount_type {void *mountid; }; -struct pnfs_fsdata { -int ok_to_use_pnfs; -struct pnfs_layout_segment *lseg; -}; -#if defined(CONFIG_NFS_V4_1 ) static inline struct nfs_inode *
@@ -139,9 +134,6 @@ struct layoutdriver_io_operations { struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, int sync, struct nfs_write_data *nfs_data); -int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page, -loff_t pos,unsigned count, -struct pnfs_fsdata *fsdata);/* Consistency ops */ /* 2 problems:
@@ -204,10 +196,6 @@ struct layoutdriver_policy_operations {/* test for nfs page cache coalescing */ int (*pg_test)(struct nfs_pageio_descriptor *,struct nfs_page *,struct nfs_page *); -/* Test for pre-write request flushing */ -int (*do_flush)(struct pnfs_layout_segment *lseg,struct nfs_page *req, -struct pnfs_fsdata *fsdata); -/* Retreive the block size of the file system. If gather_across_stripes == 1, * then the file system will gather requests into the block size. * TODO: Where will the layout driver get this info? It is hard coded in PVFS2.
Signature · 1 line
1.6.6.1
PATCH 5/8 pnfs_post_submit: Restore "pnfs: pnfs_do_flush"
From: Fred Isaman <[email protected]>
pnfs: pnfs_do_flush
Adds a hook into the "check if request needs flushed" routines. This will be needed to allow driver the ability to prevent comingling of layout driver handled requests and fallback nfs requests.
--- fs/nfs/file.c | 14 ++++++- fs/nfs/pnfs.c | 95 +++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/pnfs.h | 58 +++++++++++++++++++++++++++ fs/nfs/write.c | 6 ++- include/linux/nfs4_pnfs.h | 12 ++++++ 5 files changed, 181 insertions(+), 4 deletions(-)
fs/nfs/file.c +12 -2
@@ -433,8 +433,7 @@ start: ret =nfs_flush_incompatible (file, page);if (ret) { -unlock_page (page); -page_cache_release (page); + goto out_err; }else if (!once_thru &&nfs_want_read_modify_write (file, page, pos, len)) { once_thru =1 ;
@@ -442,8 +441,18 @@ start:page_cache_release (page);if (!ret) goto start; + }else { + ret =pnfs_write_begin (file, page, pos, len, fsdata); +if (ret) + goto out_err; }return ret; + + out_err: +unlock_page (page); +page_cache_release (page); + *pagep =NULL ; +return ret; } static int nfs_write_end(struct file *file, struct address_space *mapping,
@@ -482,6 +491,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,unlock_page (page);page_cache_release (page); +pnfs_write_end_cleanup (fsdata);if (status <0 )return status;
fs/nfs/pnfs.c +95 -0
113 lines not on this page · raw message
fs/nfs/pnfs.h +58 -0
82 lines not on this page · raw message
fs/nfs/write.c +4 -2
@@ -596,7 +596,8 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,* have flushed out requests having wrong owners. */ if (offset > rqend - || end < req->wb_offset) + || end < req->wb_offset + ||pnfs_do_flush (req,NULL )) goto out_flushme;if (nfs_set_page_tag_locked (req))
@@ -699,7 +700,8 @@ int nfs_flush_incompatible(struct file *file, struct page *page) req =nfs_page_find_request (page);if (req ==NULL )return 0 ; - do_flush = req->wb_page != page || req->wb_context != ctx; + do_flush = req->wb_page != page || req->wb_context != ctx || +pnfs_do_flush (req,NULL );nfs_release_request (req);if (!do_flush)return 0 ;
include/linux/nfs4_pnfs.h +12 -0
@@ -37,6 +37,11 @@ struct pnfs_mount_type {void *mountid; }; +struct pnfs_fsdata { +int ok_to_use_pnfs; +struct pnfs_layout_segment *lseg; +}; +#if defined(CONFIG_NFS_V4_1 ) static inline struct nfs_inode *
@@ -134,6 +139,9 @@ struct layoutdriver_io_operations { struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, int sync, struct nfs_write_data *nfs_data); +int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page, +loff_t pos,unsigned count, +struct pnfs_fsdata *fsdata);/* Consistency ops */ /* 2 problems:
@@ -196,6 +204,10 @@ struct layoutdriver_policy_operations {/* test for nfs page cache coalescing */ int (*pg_test)(struct nfs_pageio_descriptor *,struct nfs_page *,struct nfs_page *); +/* Test for pre-write request flushing */ +int (*do_flush)(struct pnfs_layout_segment *lseg,struct nfs_page *req, +struct pnfs_fsdata *fsdata); +/* Retreive the block size of the file system. If gather_across_stripes == 1, * then the file system will gather requests into the block size. * TODO: Where will the layout driver get this info? It is hard coded in PVFS2.
Signature · 1 line
1.6.6.1
PATCH 6/8 pnfs_post_submit: Restore "pnfs: propagate fsdata into nfs_create_request"
From: Fred Isaman <[email protected]>
pnfs: propagate fsdata into nfs_create_request
Now that layout drivers can pass information into nfs_write_end via fsdata, the natural place to use that data is in nfs_create_request. So propagate fsdata into nfs_create_request.
Pass NULL fsdata to nfs_updatepage from nfs_vm_page_mkwrite as this path does not go through write_{begin,end}
--- fs/nfs/file.c | 4 ++-- fs/nfs/pagelist.c | 2 +- fs/nfs/read.c | 4 ++-- fs/nfs/write.c | 20 +++++++++++--------- include/linux/nfs_fs.h | 3 ++- include/linux/nfs_page.h | 3 ++- 6 files changed, 20 insertions(+), 16 deletions(-)
fs/nfs/file.c +2 -2
@@ -487,7 +487,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,zero_user_segment (page, pglen,PAGE_CACHE_SIZE ); } - status =nfs_updatepage (file, page, offset, copied); + status =nfs_updatepage (file, page, offset, copied, fsdata);unlock_page (page);page_cache_release (page);
@@ -608,7 +608,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)if (ret !=0 ) goto out_unlock; - ret =nfs_updatepage (filp, page,0 , pagelen); + ret =nfs_updatepage (filp, page,0 , pagelen,NULL ); out_unlock:if (!ret)return VM_FAULT_LOCKED ;
fs/nfs/pagelist.c +1 -1
@@ -56,7 +56,7 @@ nfs_page_free(struct nfs_page *p)struct nfs_page *nfs_create_request (struct nfs_open_context *ctx,struct inode *inode,struct page *page, -unsigned int offset,unsigned int count) +unsigned int offset,unsigned int count,void *fsdata) {struct nfs_page *req;
fs/nfs/read.c +2 -2
@@ -125,7 +125,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, len =nfs_page_length (page);if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (ctx, inode, page,0 , len); + new =nfs_create_request (ctx, inode, page,0 , len,NULL );if (IS_ERR (new)) {unlock_page (page);return PTR_ERR (new);
@@ -606,7 +606,7 @@ readpage_async_filler(void *data, struct page *page)if (len ==0 )return nfs_return_empty_page (page); - new =nfs_create_request (desc->ctx, inode, page,0 , len); + new =nfs_create_request (desc->ctx, inode, page,0 , len,NULL );if (IS_ERR (new)) goto out_error;
fs/nfs/write.c +11 -9
@@ -570,7 +570,8 @@ static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pgstatic struct nfs_page *nfs_try_to_update_request (struct inode *inode,struct page *page,unsigned int offset, -unsigned int bytes) +unsigned int bytes, +void *fsdata) {struct nfs_page *req;unsigned int rqend;
@@ -597,7 +598,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,*/ if (offset > rqend || end < req->wb_offset - ||pnfs_do_flush (req,NULL )) + ||pnfs_do_flush (req, fsdata)) goto out_flushme;if (nfs_set_page_tag_locked (req))
@@ -645,16 +646,17 @@ out_err:* already called nfs_flush_incompatible() if necessary. */ static struct nfs_page *nfs_setup_write_request (struct nfs_open_context * ctx, -struct page *page,unsigned int offset,unsigned int bytes) +struct page *page,unsigned int offset,unsigned int bytes, +void *fsdata) {struct inode *inode = page->mapping->host;struct nfs_page *req;int error; - req =nfs_try_to_update_request (inode, page, offset, bytes); + req =nfs_try_to_update_request (inode, page, offset, bytes, fsdata);if (req !=NULL ) goto out; - req =nfs_create_request (ctx, inode, page, offset, bytes); + req =nfs_create_request (ctx, inode, page, offset, bytes, fsdata);if (IS_ERR (req)) goto out; error =nfs_inode_add_request (inode, req);
@@ -667,11 +669,11 @@ out: }static int nfs_writepage_setup (struct nfs_open_context *ctx,struct page *page, -unsigned int offset,unsigned int count) +unsigned int offset,unsigned int count,void *fsdata) {struct nfs_page *req; - req =nfs_setup_write_request (ctx, page, offset, count); + req =nfs_setup_write_request (ctx, page, offset, count, fsdata);if (IS_ERR (req))return PTR_ERR (req);nfs_mark_request_dirty (req);
@@ -728,7 +730,7 @@ static int nfs_write_pageuptodate(struct page *page, struct inode *inode)* things with a page scheduled for an RPC call (e.g. invalidate it). */ int nfs_updatepage (struct file *file,struct page *page, -unsigned int offset,unsigned int count) +unsigned int offset,unsigned int count,void *fsdata) {struct nfs_open_context *ctx =nfs_file_open_context (file);struct inode *inode = page->mapping->host;
@@ -753,7 +755,7 @@ int nfs_updatepage(struct file *file, struct page *page, offset =0 ; } - status =nfs_writepage_setup (ctx, page, offset, count); + status =nfs_writepage_setup (ctx, page, offset, count, fsdata);if (status <0 )nfs_set_pageerror (page);
include/linux/nfs_fs.h +2 -1
@@ -504,7 +504,8 @@ extern int nfs_congestion_kb;extern int nfs_writepage (struct page *page,struct writeback_control *wbc);extern int nfs_writepages (struct address_space *,struct writeback_control *);extern int nfs_flush_incompatible (struct file *file,struct page *page); -extern int nfs_updatepage (struct file *,struct page *,unsigned int ,unsigned int ); +extern int nfs_updatepage (struct file *,struct page *,unsigned int , +unsigned int ,void *);extern int nfs_writeback_done (struct rpc_task *,struct nfs_write_data *);/*
include/linux/nfs_page.h +2 -1
@@ -75,7 +75,8 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,struct inode *inode, struct page *page, unsigned int offset, - unsigned int count); + unsigned int count, + void *fsdata);extern void nfs_clear_request (struct nfs_page *req);extern void nfs_release_request (struct nfs_page *req);
Signature · 1 line
1.6.6.1
PATCH 7/8 pnfs_post_submit: Restore "pnfs: pnfs_modify_new_request"
From: Fred Isaman <[email protected]>
pnfs: pnfs_modify_new_request
Add hook into nfs_page initialization to allow for setting of PG_USE_PNFS.
--- fs/nfs/pagelist.c | 2 ++ fs/nfs/pnfs.c | 19 +++++++++++++++++++ fs/nfs/pnfs.h | 15 +++++++++++++++ include/linux/nfs4_pnfs.h | 3 +++ 4 files changed, 39 insertions(+), 0 deletions(-)
fs/nfs/pagelist.c +2 -0
@@ -20,6 +20,7 @@#include <linux/nfs_mount.h> #include "internal.h" +#include "pnfs.h" static struct kmem_cache *nfs_page_cachep;
@@ -86,6 +87,7 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, req->wb_bytes = count; req->wb_context =get_nfs_open_context (ctx);kref_init (&req->wb_kref); +pnfs_modify_new_request (req, fsdata);return req; }
fs/nfs/pnfs.c +19 -0
@@ -2245,6 +2245,25 @@ out_unlock: goto out; } +/* Note that fsdata != NULL */ +void _pnfs_modify_new_write_request (struct nfs_page *req, +struct pnfs_fsdata *fsdata) +{ +struct inode *inode = req->wb_page->mapping->host; +struct pnfs_layout_segment *lseg =NULL ; +loff_t pos; +unsigned count; + + pos = ((loff_t )req->wb_index <<PAGE_CACHE_SHIFT ) + req->wb_offset; + count = req->wb_bytes; + lseg =pnfs_find_get_lseg (inode, pos, count,IOMODE_RW ); +if (lseg) { +if (fsdata->ok_to_use_pnfs) +set_bit (PG_USE_PNFS , &req->wb_flags); +put_lseg (lseg); + } +} +void pnfs_free_fsdata (struct pnfs_fsdata *fsdata) {if (fsdata) {
fs/nfs/pnfs.h +15 -0
@@ -78,6 +78,8 @@ int _pnfs_write_begin(struct inode *inode, struct page *page, struct pnfs_fsdata **fsdata);int _pnfs_do_flush (struct inode *inode,struct nfs_page *req,struct pnfs_fsdata *fsdata); +void _pnfs_modify_new_write_request (struct nfs_page *req, +struct pnfs_fsdata *fsdata);void _pnfs_direct_init_io (struct inode *inode,struct nfs_open_context *ctx,size_t count,loff_t loff,int iswrite,size_t *rwsize,size_t *remaining);
@@ -205,6 +207,14 @@ static inline void pnfs_redirty_request(struct nfs_page *req)clear_bit (PG_USE_PNFS , &req->wb_flags); } +static inline void pnfs_modify_new_request (struct nfs_page *req, +void *fsdata) +{ +if (fsdata) +_pnfs_modify_new_write_request (req, fsdata); +/* Should we do something (like set PG_USE_PNFS) if !fsdata ? */ +} + static inline int pnfs_return_layout(struct inode *ino, struct nfs4_pnfs_layout_segment *lseg, const nfs4_stateid *stateid, /* optional */
@@ -294,6 +304,11 @@ static inline void pnfs_redirty_request(struct nfs_page *req) { } +static inline void pnfs_modify_new_request (struct nfs_page *req, +void *fsdata) +{ +} +static inline int pnfs_get_write_status (struct nfs_write_data *data) {return 0 ;
include/linux/nfs4_pnfs.h +3 -0
@@ -142,6 +142,9 @@ struct layoutdriver_io_operations {int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata); +void (*new_request)(struct pnfs_layout_segment *lseg, +struct nfs_page *req,loff_t pos,unsigned count, +struct pnfs_fsdata *fsdata);/* Consistency ops */ /* 2 problems:
Signature · 1 line
1.6.6.1
PATCH 8/8 pnfs_post_submit: Revert the pnfs_write_end part of "pnfs: commit and pnfs_write_end"
From: Fred Isaman <[email protected]>
pnfs: commit and pnfs_write_end
Add hooks in the nfs_write_end path, giving a driver the potential for post-copy manipulation of the page.
Whole file semantics are different for COMMIT (0,0) and layouts (0,NFS4_MAX_UINT64).
--- fs/nfs/file.c | 4 ++++ fs/nfs/pnfs.c | 14 ++++++++++++++ fs/nfs/pnfs.h | 23 +++++++++++++++++++++++ include/linux/nfs4_pnfs.h | 3 +++ 4 files changed, 44 insertions(+), 0 deletions(-)
fs/nfs/file.c +4 -0
@@ -487,8 +487,12 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,zero_user_segment (page, pglen,PAGE_CACHE_SIZE ); } + status =pnfs_write_end (file, page, pos, len, copied, fsdata); +if (status) + goto out; status =nfs_updatepage (file, page, offset, copied, fsdata); + out:unlock_page (page);page_cache_release (page);pnfs_write_end_cleanup (fsdata);
fs/nfs/pnfs.c +14 -0
@@ -1965,6 +1965,20 @@ out:return status; } +/* Return 0 on succes, negative on failure */ +/* CAREFUL - what happens if copied < len??? */ +int _pnfs_write_end (struct inode *inode,struct page *page, +loff_t pos,unsigned len, +unsigned copied,struct pnfs_fsdata *fsdata) +{ +struct nfs_server *nfss =NFS_SERVER (inode); +int status; + + status = nfss->pnfs_curr_ld->ld_io_ops->write_end (inode, page, + pos, len, copied, fsdata); +return status; +} +/* Given an nfs request, determine if it should be flushed before proceeding. * It should default to returning False, returning True only if there is a * specific reason to flush.
fs/nfs/pnfs.h +23 -0
@@ -76,6 +76,9 @@ void pnfs_destroy_layout(struct nfs_inode *);int _pnfs_write_begin (struct inode *inode,struct page *page,loff_t pos,unsigned len,struct pnfs_fsdata **fsdata); +int _pnfs_write_end (struct inode *inode,struct page *page, +loff_t pos,unsigned len, +unsigned copied,struct pnfs_fsdata *fsdata);int _pnfs_do_flush (struct inode *inode,struct nfs_page *req,struct pnfs_fsdata *fsdata); void _pnfs_modify_new_write_request(struct nfs_page *req,
@@ -197,6 +200,19 @@ static inline int pnfs_do_flush(struct nfs_page *req, void *fsdata)return 0 ; } +static inline int pnfs_write_end (struct file *filp,struct page *page, +loff_t pos,unsigned len,unsigned copied, +void *fsdata) +{ +struct inode *inode = filp->f_dentry->d_inode; +struct nfs_server *nfss =NFS_SERVER (inode); + +if (PNFS_EXISTS_LDIO_OP (nfss, write_end)) +return _pnfs_write_end (inode, page, pos, len, copied, fsdata); +else +return 0 ; +} +static inline void pnfs_write_end_cleanup (void *fsdata) {pnfs_free_fsdata (fsdata);
@@ -296,6 +312,13 @@ static inline int pnfs_write_begin(struct file *filp, struct page *page,return 0 ; } +static inline int pnfs_write_end (struct file *filp,struct page *page, +loff_t pos,unsigned len,unsigned copied, +void *fsdata) +{ +return 0 ; +} +static inline void pnfs_write_end_cleanup (void *fsdata) { }
include/linux/nfs4_pnfs.h +3 -0
@@ -142,6 +142,9 @@ struct layoutdriver_io_operations {int (*write_begin) (struct pnfs_layout_segment *lseg,struct page *page,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata); +int (*write_end)(struct inode *inode,struct page *page,loff_t pos, +unsigned count,unsigned copied, +struct pnfs_fsdata *fsdata);void (*new_request)(struct pnfs_layout_segment *lseg,struct nfs_page *req,loff_t pos,unsigned count,struct pnfs_fsdata *fsdata);
Signature · 1 line
1.6.6.1
Quoted 3 lines · Fred Isaman
These revert patches in the submit branch in order to remove the fsdata manipulation needed by the block driver, followed immediately by the post-submit "un-reverts".
They apply on top of the 13 patches Andy previously sent.
patches 1-4 committed to pnfs-submit
5-8 to pnfs
Thanks!
Benny
Quoted 7 lines
Fred
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html