@@ -466,8 +466,12 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
}
lseg = nfs4_pull_lseg_from_fsdata(file, fsdata);
+ status = pnfs_write_end(file, page, pos, len, copied, lseg);
+ if (status)
+ goto out;
status = nfs_updatepage(file, page, offset, copied);
+out:
unlock_page(page);
page_cache_release(page);
pnfs_write_end_cleanup(file, fsdata);
@@ -113,6 +113,9 @@ struct pnfs_layoutdriver_type {
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_layout_segment *lseg);
void (*free_deviceid_node) (struct nfs4_deviceid_node *);
@@ -333,6 +336,21 @@ static inline int pnfs_write_begin(struct file *filp, struct page *page,
return status;
}
+/* CAREFUL - what happens if copied < len??? */
+static inline int pnfs_write_end(struct file *filp, struct page *page,
+ loff_t pos, unsigned len, unsigned copied,
+ struct pnfs_layout_segment *lseg)
+{
+ struct inode *inode = filp->f_dentry->d_inode;
+ struct nfs_server *nfss = NFS_SERVER(inode);
+
+ if (nfss->pnfs_curr_ld && nfss->pnfs_curr_ld->write_end)
+ return nfss->pnfs_curr_ld->write_end(inode, page, pos, len,
+ copied, lseg);
+ else
+ return 0;
+}
+
static inline void pnfs_write_end_cleanup(struct file *filp, void *fsdata)
{
struct nfs_server *nfss = NFS_SERVER(filp->f_dentry->d_inode);
@@ -432,6 +450,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,
+ struct pnfs_layout_segment *lseg)
+{
+ return 0;
+}
+
static inline void pnfs_write_end_cleanup(struct file *filp, void *fsdata)
{
}