Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56939
b: refs/heads/master
c: d4a8f36
h: refs/heads/master
i:
  56937: a96bd28
  56935: 988131c
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed May 24, 2007
1 parent 75d7445 commit 7376d87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 749e146e01cf87ce3c1d6f6077b877471b04df5b
refs/heads/master: d4a8f3677fe2c2fc86443254fe42825e244c194d
29 changes: 18 additions & 11 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,19 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_
return -EINVAL;
}

static void nfs_direct_dirty_pages(struct page **pages, unsigned int npages)
static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, size_t count)
{
unsigned int npages;
unsigned int i;

if (count == 0)
return;
pages += (pgbase >> PAGE_SHIFT);
npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
for (i = 0; i < npages; i++) {
struct page *page = pages[i];
if (!PageCompound(page))
set_page_dirty_lock(page);
set_page_dirty(page);
}
}

Expand Down Expand Up @@ -224,17 +230,18 @@ static void nfs_direct_read_result(struct rpc_task *task, void *calldata)
if (nfs_readpage_result(task, data) != 0)
return;

nfs_direct_dirty_pages(data->pagevec, data->npages);
nfs_direct_release_pages(data->pagevec, data->npages);

spin_lock(&dreq->lock);

if (likely(task->tk_status >= 0))
dreq->count += data->res.count;
else
if (unlikely(task->tk_status < 0)) {
dreq->error = task->tk_status;

spin_unlock(&dreq->lock);
spin_unlock(&dreq->lock);
} else {
dreq->count += data->res.count;
spin_unlock(&dreq->lock);
nfs_direct_dirty_pages(data->pagevec,
data->args.pgbase,
data->res.count);
}
nfs_direct_release_pages(data->pagevec, data->npages);

if (put_dreq(dreq))
nfs_direct_complete(dreq);
Expand Down

0 comments on commit 7376d87

Please sign in to comment.