Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308595
b: refs/heads/master
c: 7ad84aa
h: refs/heads/master
i:
  308593: f4ef5d5
  308591: 7e5f466
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed May 9, 2012
1 parent 691a415 commit fae6a19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 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: d1182b33ed9b62470cb6ab892a8a301542120086
refs/heads/master: 7ad84aa9448571678c243f0c5ef383fbe5b50f4f
1 change: 1 addition & 0 deletions trunk/fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ static ssize_t nfs_direct_write_schedule_segment(struct nfs_pageio_descriptor *d
break;
}
nfs_lock_request(req);
kref_get(&req->wb_kref);
req->wb_index = pos >> PAGE_SHIFT;
req->wb_offset = pos & ~PAGE_MASK;
if (!nfs_pageio_add_request(desc, req)) {
Expand Down
11 changes: 6 additions & 5 deletions trunk/fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ static struct nfs_page *nfs_find_and_lock_request(struct page *page, bool nonblo
req = nfs_page_find_request_locked(page);
if (req == NULL)
break;
if (nfs_lock_request_dontget(req))
if (nfs_lock_request(req))
break;
/* Note: If we hold the page lock, as is the case in nfs_writepage,
* then the call to nfs_lock_request_dontget() will always
* then the call to nfs_lock_request() will always
* succeed provided that someone hasn't already marked the
* request as dirty (in which case we don't care).
*/
Expand Down Expand Up @@ -406,7 +406,7 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
struct nfs_inode *nfsi = NFS_I(inode);

/* Lock the request! */
nfs_lock_request_dontget(req);
nfs_lock_request(req);

spin_lock(&inode->i_lock);
if (!nfsi->npages && nfs_have_delegation(inode, FMODE_WRITE))
Expand Down Expand Up @@ -651,6 +651,7 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
list_for_each_entry_safe(req, tmp, src, wb_list) {
if (!nfs_lock_request(req))
continue;
kref_get(&req->wb_kref);
if (cond_resched_lock(cinfo->lock))
list_safe_reset_next(req, tmp, wb_list);
nfs_request_remove_commit_list(req, cinfo);
Expand Down Expand Up @@ -741,7 +742,7 @@ static struct nfs_page *nfs_try_to_update_request(struct inode *inode,
|| end < req->wb_offset)
goto out_flushme;

if (nfs_lock_request_dontget(req))
if (nfs_lock_request(req))
break;

/* The request is locked, so wait and then retry */
Expand Down Expand Up @@ -1717,7 +1718,7 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
req = nfs_page_find_request(page);
if (req == NULL)
break;
if (nfs_lock_request_dontget(req)) {
if (nfs_lock_request(req)) {
nfs_clear_request_commit(req);
nfs_inode_remove_request(req);
/*
Expand Down
14 changes: 2 additions & 12 deletions trunk/include/linux/nfs_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,24 +99,14 @@ extern void nfs_unlock_request(struct nfs_page *req);
extern void nfs_unlock_request_dont_release(struct nfs_page *req);

/*
* Lock the page of an asynchronous request without getting a new reference
* Lock the page of an asynchronous request
*/
static inline int
nfs_lock_request_dontget(struct nfs_page *req)
{
return !test_and_set_bit(PG_BUSY, &req->wb_flags);
}

static inline int
nfs_lock_request(struct nfs_page *req)
{
if (test_and_set_bit(PG_BUSY, &req->wb_flags))
return 0;
kref_get(&req->wb_kref);
return 1;
return !test_and_set_bit(PG_BUSY, &req->wb_flags);
}


/**
* nfs_list_add_request - Insert a request into a list
* @req: request
Expand Down

0 comments on commit fae6a19

Please sign in to comment.