提交 17089a29 编写于 作者: W Weston Andros Adamson 提交者: Trond Myklebust

nfs: mark nfs_page reqs with flag for extra ref

Change the use of PG_INODE_REF - set it when taking extra reference on
subrequests and take care to only release once for each request.
Signed-off-by: NWeston Andros Adamson <dros@primarydata.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 74adf83f
...@@ -251,9 +251,11 @@ nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev) ...@@ -251,9 +251,11 @@ nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev)
/* grab extra ref if head request has extra ref from /* grab extra ref if head request has extra ref from
* the write/commit path to handle handoff between write * the write/commit path to handle handoff between write
* and commit lists */ * and commit lists */
if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) {
set_bit(PG_INODE_REF, &req->wb_flags);
kref_get(&req->wb_kref); kref_get(&req->wb_kref);
} }
}
} }
/* /*
......
...@@ -448,7 +448,9 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req) ...@@ -448,7 +448,9 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
set_page_private(req->wb_page, (unsigned long)req); set_page_private(req->wb_page, (unsigned long)req);
} }
nfsi->npages++; nfsi->npages++;
set_bit(PG_INODE_REF, &req->wb_flags); /* this a head request for a page group - mark it as having an
* extra reference so sub groups can follow suit */
WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags));
kref_get(&req->wb_kref); kref_get(&req->wb_kref);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
...@@ -474,6 +476,8 @@ static void nfs_inode_remove_request(struct nfs_page *req) ...@@ -474,6 +476,8 @@ static void nfs_inode_remove_request(struct nfs_page *req)
nfsi->npages--; nfsi->npages--;
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
} }
if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags))
nfs_release_request(req); nfs_release_request(req);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册