diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/pnfs.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 0fb0f1920a1f..c7be9b997f5e 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1711,19 +1711,19 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r | |||
1711 | { | 1711 | { |
1712 | u64 rd_size = req->wb_bytes; | 1712 | u64 rd_size = req->wb_bytes; |
1713 | 1713 | ||
1714 | WARN_ON_ONCE(pgio->pg_lseg != NULL); | 1714 | if (pgio->pg_lseg == NULL) { |
1715 | 1715 | if (pgio->pg_dreq == NULL) | |
1716 | if (pgio->pg_dreq == NULL) | 1716 | rd_size = i_size_read(pgio->pg_inode) - req_offset(req); |
1717 | rd_size = i_size_read(pgio->pg_inode) - req_offset(req); | 1717 | else |
1718 | else | 1718 | rd_size = nfs_dreq_bytes_left(pgio->pg_dreq); |
1719 | rd_size = nfs_dreq_bytes_left(pgio->pg_dreq); | 1719 | |
1720 | 1720 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | |
1721 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | 1721 | req->wb_context, |
1722 | req->wb_context, | 1722 | req_offset(req), |
1723 | req_offset(req), | 1723 | rd_size, |
1724 | rd_size, | 1724 | IOMODE_READ, |
1725 | IOMODE_READ, | 1725 | GFP_KERNEL); |
1726 | GFP_KERNEL); | 1726 | } |
1727 | /* If no lseg, fall back to read through mds */ | 1727 | /* If no lseg, fall back to read through mds */ |
1728 | if (pgio->pg_lseg == NULL) | 1728 | if (pgio->pg_lseg == NULL) |
1729 | nfs_pageio_reset_read_mds(pgio); | 1729 | nfs_pageio_reset_read_mds(pgio); |
@@ -1735,14 +1735,13 @@ void | |||
1735 | pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, | 1735 | pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, |
1736 | struct nfs_page *req, u64 wb_size) | 1736 | struct nfs_page *req, u64 wb_size) |
1737 | { | 1737 | { |
1738 | WARN_ON_ONCE(pgio->pg_lseg != NULL); | 1738 | if (pgio->pg_lseg == NULL) |
1739 | 1739 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | |
1740 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | 1740 | req->wb_context, |
1741 | req->wb_context, | 1741 | req_offset(req), |
1742 | req_offset(req), | 1742 | wb_size, |
1743 | wb_size, | 1743 | IOMODE_RW, |
1744 | IOMODE_RW, | 1744 | GFP_NOFS); |
1745 | GFP_NOFS); | ||
1746 | /* If no lseg, fall back to write through mds */ | 1745 | /* If no lseg, fall back to write through mds */ |
1747 | if (pgio->pg_lseg == NULL) | 1746 | if (pgio->pg_lseg == NULL) |
1748 | nfs_pageio_reset_write_mds(pgio); | 1747 | nfs_pageio_reset_write_mds(pgio); |