Commit 19b54848 authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust

pnfs: allow non page aligned pnfs layout segments

Remove alignment checks that would revert to MDS and change pg_test
to return the max ammount left in the segment (or other pg_test call)
up to size of passed request, or 0 if no space is left.
Signed-off-by: default avatarWeston Andros Adamson <dros@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 5002c586
...@@ -1388,11 +1388,6 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r ...@@ -1388,11 +1388,6 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r
WARN_ON_ONCE(pgio->pg_lseg != NULL); WARN_ON_ONCE(pgio->pg_lseg != NULL);
if (req->wb_offset != req->wb_pgbase) {
nfs_pageio_reset_read_mds(pgio);
return;
}
if (pgio->pg_dreq == NULL) if (pgio->pg_dreq == NULL)
rd_size = i_size_read(pgio->pg_inode) - req_offset(req); rd_size = i_size_read(pgio->pg_inode) - req_offset(req);
else else
...@@ -1417,11 +1412,6 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, ...@@ -1417,11 +1412,6 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,
{ {
WARN_ON_ONCE(pgio->pg_lseg != NULL); WARN_ON_ONCE(pgio->pg_lseg != NULL);
if (req->wb_offset != req->wb_pgbase) {
nfs_pageio_reset_write_mds(pgio);
return;
}
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
req->wb_context, req->wb_context,
req_offset(req), req_offset(req),
...@@ -1443,9 +1433,9 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, ...@@ -1443,9 +1433,9 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
struct nfs_page *req) struct nfs_page *req)
{ {
unsigned int size; unsigned int size;
u64 end;
size = nfs_generic_pg_test(pgio, prev, req); size = nfs_generic_pg_test(pgio, prev, req);
if (!size) if (!size)
return 0; return 0;
...@@ -1463,11 +1453,16 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, ...@@ -1463,11 +1453,16 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
* first byte that lies outside the pnfs_layout_range. FIXME? * first byte that lies outside the pnfs_layout_range. FIXME?
* *
*/ */
if (req_offset(req) >= end_offset(pgio->pg_lseg->pls_range.offset, if (pgio->pg_lseg) {
pgio->pg_lseg->pls_range.length)) end = end_offset(pgio->pg_lseg->pls_range.offset,
return 0; pgio->pg_lseg->pls_range.length);
WARN_ON_ONCE(req_offset(req) > end);
if (req_offset(req) >= end)
return 0;
size = min((unsigned int)(end - req_offset(req)), size);
}
return min(size, req->wb_bytes); return size;
} }
EXPORT_SYMBOL_GPL(pnfs_generic_pg_test); EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment