NFS: Remove redundant open context from nfs_page
The lock context already references and tracks the open context, so take the opportunity to save some space in struct nfs_page. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
9fcd5960e8
commit
c79d183ebb
|
@ -325,7 +325,6 @@ __nfs_create_request(struct nfs_lock_context *l_ctx, struct page *page,
|
||||||
req->wb_offset = offset;
|
req->wb_offset = offset;
|
||||||
req->wb_pgbase = pgbase;
|
req->wb_pgbase = pgbase;
|
||||||
req->wb_bytes = count;
|
req->wb_bytes = count;
|
||||||
req->wb_context = get_nfs_open_context(ctx);
|
|
||||||
kref_init(&req->wb_kref);
|
kref_init(&req->wb_kref);
|
||||||
req->wb_nio = 0;
|
req->wb_nio = 0;
|
||||||
return req;
|
return req;
|
||||||
|
@ -414,8 +413,8 @@ void nfs_unlock_and_release_request(struct nfs_page *req)
|
||||||
static void nfs_clear_request(struct nfs_page *req)
|
static void nfs_clear_request(struct nfs_page *req)
|
||||||
{
|
{
|
||||||
struct page *page = req->wb_page;
|
struct page *page = req->wb_page;
|
||||||
struct nfs_open_context *ctx = req->wb_context;
|
|
||||||
struct nfs_lock_context *l_ctx = req->wb_lock_context;
|
struct nfs_lock_context *l_ctx = req->wb_lock_context;
|
||||||
|
struct nfs_open_context *ctx;
|
||||||
|
|
||||||
if (page != NULL) {
|
if (page != NULL) {
|
||||||
put_page(page);
|
put_page(page);
|
||||||
|
@ -424,16 +423,13 @@ static void nfs_clear_request(struct nfs_page *req)
|
||||||
if (l_ctx != NULL) {
|
if (l_ctx != NULL) {
|
||||||
if (atomic_dec_and_test(&l_ctx->io_count)) {
|
if (atomic_dec_and_test(&l_ctx->io_count)) {
|
||||||
wake_up_var(&l_ctx->io_count);
|
wake_up_var(&l_ctx->io_count);
|
||||||
|
ctx = l_ctx->open_context;
|
||||||
if (test_bit(NFS_CONTEXT_UNLOCK, &ctx->flags))
|
if (test_bit(NFS_CONTEXT_UNLOCK, &ctx->flags))
|
||||||
rpc_wake_up(&NFS_SERVER(d_inode(ctx->dentry))->uoc_rpcwaitq);
|
rpc_wake_up(&NFS_SERVER(d_inode(ctx->dentry))->uoc_rpcwaitq);
|
||||||
}
|
}
|
||||||
nfs_put_lock_context(l_ctx);
|
nfs_put_lock_context(l_ctx);
|
||||||
req->wb_lock_context = NULL;
|
req->wb_lock_context = NULL;
|
||||||
}
|
}
|
||||||
if (ctx != NULL) {
|
|
||||||
put_nfs_open_context(ctx);
|
|
||||||
req->wb_context = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,6 @@ struct nfs_inode;
|
||||||
struct nfs_page {
|
struct nfs_page {
|
||||||
struct list_head wb_list; /* Defines state of page: */
|
struct list_head wb_list; /* Defines state of page: */
|
||||||
struct page *wb_page; /* page to read in/write out */
|
struct page *wb_page; /* page to read in/write out */
|
||||||
struct nfs_open_context *wb_context; /* File state context info */
|
|
||||||
struct nfs_lock_context *wb_lock_context; /* lock context info */
|
struct nfs_lock_context *wb_lock_context; /* lock context info */
|
||||||
pgoff_t wb_index; /* Offset >> PAGE_SHIFT */
|
pgoff_t wb_index; /* Offset >> PAGE_SHIFT */
|
||||||
unsigned int wb_offset, /* Offset & ~PAGE_MASK */
|
unsigned int wb_offset, /* Offset & ~PAGE_MASK */
|
||||||
|
@ -203,7 +202,7 @@ loff_t req_offset(struct nfs_page *req)
|
||||||
static inline struct nfs_open_context *
|
static inline struct nfs_open_context *
|
||||||
nfs_req_openctx(struct nfs_page *req)
|
nfs_req_openctx(struct nfs_page *req)
|
||||||
{
|
{
|
||||||
return req->wb_context;
|
return req->wb_lock_context->open_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _LINUX_NFS_PAGE_H */
|
#endif /* _LINUX_NFS_PAGE_H */
|
||||||
|
|
Loading…
Reference in New Issue