aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ef535f2a2c74..171662114fdd 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -243,7 +243,7 @@ put_lseg_common(struct pnfs_layout_segment *lseg)
243{ 243{
244 struct inode *inode = lseg->pls_layout->plh_inode; 244 struct inode *inode = lseg->pls_layout->plh_inode;
245 245
246 BUG_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); 246 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
247 list_del_init(&lseg->pls_list); 247 list_del_init(&lseg->pls_list);
248 if (list_empty(&lseg->pls_layout->plh_segs)) { 248 if (list_empty(&lseg->pls_layout->plh_segs)) {
249 set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags); 249 set_bit(NFS_LAYOUT_DESTROYED, &lseg->pls_layout->plh_flags);
@@ -1054,6 +1054,29 @@ pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode)
1054 pgio->pg_test = (ld && ld->pg_test) ? pnfs_write_pg_test : NULL; 1054 pgio->pg_test = (ld && ld->pg_test) ? pnfs_write_pg_test : NULL;
1055} 1055}
1056 1056
1057/*
1058 * Called by non rpc-based layout drivers
1059 */
1060int
1061pnfs_ld_write_done(struct nfs_write_data *data)
1062{
1063 int status;
1064
1065 if (!data->pnfs_error) {
1066 pnfs_set_layoutcommit(data);
1067 data->mds_ops->rpc_call_done(&data->task, data);
1068 data->mds_ops->rpc_release(data);
1069 return 0;
1070 }
1071
1072 dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
1073 data->pnfs_error);
1074 status = nfs_initiate_write(data, NFS_CLIENT(data->inode),
1075 data->mds_ops, NFS_FILE_SYNC);
1076 return status ? : -EAGAIN;
1077}
1078EXPORT_SYMBOL_GPL(pnfs_ld_write_done);
1079
1057enum pnfs_try_status 1080enum pnfs_try_status
1058pnfs_try_to_write_data(struct nfs_write_data *wdata, 1081pnfs_try_to_write_data(struct nfs_write_data *wdata,
1059 const struct rpc_call_ops *call_ops, int how) 1082 const struct rpc_call_ops *call_ops, int how)
@@ -1079,6 +1102,29 @@ pnfs_try_to_write_data(struct nfs_write_data *wdata,
1079} 1102}
1080 1103
1081/* 1104/*
1105 * Called by non rpc-based layout drivers
1106 */
1107int
1108pnfs_ld_read_done(struct nfs_read_data *data)
1109{
1110 int status;
1111
1112 if (!data->pnfs_error) {
1113 __nfs4_read_done_cb(data);
1114 data->mds_ops->rpc_call_done(&data->task, data);
1115 data->mds_ops->rpc_release(data);
1116 return 0;
1117 }
1118
1119 dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__,
1120 data->pnfs_error);
1121 status = nfs_initiate_read(data, NFS_CLIENT(data->inode),
1122 data->mds_ops);
1123 return status ? : -EAGAIN;
1124}
1125EXPORT_SYMBOL_GPL(pnfs_ld_read_done);
1126
1127/*
1082 * Call the appropriate parallel I/O subsystem read function. 1128 * Call the appropriate parallel I/O subsystem read function.
1083 */ 1129 */
1084enum pnfs_try_status 1130enum pnfs_try_status