Skip to content

Commit

Permalink
NFS: Don't fail an O_DIRECT read/write if get_user_pages() returns pages
Browse files Browse the repository at this point in the history
There is no need to fail the entire O_DIRECT read/write just because
get_user_pages() returned fewer pages than we requested.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Jul 11, 2007
1 parent 070ea60 commit d9df8d6
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,14 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo
break;
}
if ((unsigned)result < data->npages) {
nfs_direct_release_pages(data->pagevec, result);
nfs_readdata_release(data);
break;
bytes = result * PAGE_SIZE;
if (bytes <= pgbase) {
nfs_direct_release_pages(data->pagevec, result);
nfs_readdata_release(data);
break;
}
bytes -= pgbase;
data->npages = result;
}

get_dreq(dreq);
Expand Down Expand Up @@ -630,9 +635,14 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l
break;
}
if ((unsigned)result < data->npages) {
nfs_direct_release_pages(data->pagevec, result);
nfs_writedata_release(data);
break;
bytes = result * PAGE_SIZE;
if (bytes <= pgbase) {
nfs_direct_release_pages(data->pagevec, result);
nfs_writedata_release(data);
break;
}
bytes -= pgbase;
data->npages = result;
}

get_dreq(dreq);
Expand Down

0 comments on commit d9df8d6

Please sign in to comment.