Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
c03b4024
Commit
c03b4024
authored
Jun 17, 2007
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NFS: Convert struct nfs_page to use krefs
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
a50f7951
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
fs/nfs/pagelist.c
fs/nfs/pagelist.c
+8
-6
fs/nfs/write.c
fs/nfs/write.c
+3
-3
include/linux/nfs_page.h
include/linux/nfs_page.h
+5
-5
No files found.
fs/nfs/pagelist.c
View file @
c03b4024
...
@@ -85,9 +85,8 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
...
@@ -85,9 +85,8 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
req
->
wb_offset
=
offset
;
req
->
wb_offset
=
offset
;
req
->
wb_pgbase
=
offset
;
req
->
wb_pgbase
=
offset
;
req
->
wb_bytes
=
count
;
req
->
wb_bytes
=
count
;
atomic_set
(
&
req
->
wb_count
,
1
);
req
->
wb_context
=
get_nfs_open_context
(
ctx
);
req
->
wb_context
=
get_nfs_open_context
(
ctx
);
kref_init
(
&
req
->
wb_kref
);
return
req
;
return
req
;
}
}
...
@@ -160,11 +159,9 @@ void nfs_clear_request(struct nfs_page *req)
...
@@ -160,11 +159,9 @@ void nfs_clear_request(struct nfs_page *req)
*
*
* Note: Should never be called with the spinlock held!
* Note: Should never be called with the spinlock held!
*/
*/
void
static
void
nfs_free_request
(
struct
kref
*
kref
)
nfs_release_request
(
struct
nfs_page
*
req
)
{
{
if
(
!
atomic_dec_and_test
(
&
req
->
wb_count
))
struct
nfs_page
*
req
=
container_of
(
kref
,
struct
nfs_page
,
wb_kref
);
return
;
/* Release struct file or cached credential */
/* Release struct file or cached credential */
nfs_clear_request
(
req
);
nfs_clear_request
(
req
);
...
@@ -172,6 +169,11 @@ nfs_release_request(struct nfs_page *req)
...
@@ -172,6 +169,11 @@ nfs_release_request(struct nfs_page *req)
nfs_page_free
(
req
);
nfs_page_free
(
req
);
}
}
void
nfs_release_request
(
struct
nfs_page
*
req
)
{
kref_put
(
&
req
->
wb_kref
,
nfs_free_request
);
}
static
int
nfs_wait_bit_interruptible
(
void
*
word
)
static
int
nfs_wait_bit_interruptible
(
void
*
word
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
...
fs/nfs/write.c
View file @
c03b4024
...
@@ -117,7 +117,7 @@ static struct nfs_page *nfs_page_find_request_locked(struct page *page)
...
@@ -117,7 +117,7 @@ static struct nfs_page *nfs_page_find_request_locked(struct page *page)
if
(
PagePrivate
(
page
))
{
if
(
PagePrivate
(
page
))
{
req
=
(
struct
nfs_page
*
)
page_private
(
page
);
req
=
(
struct
nfs_page
*
)
page_private
(
page
);
if
(
req
!=
NULL
)
if
(
req
!=
NULL
)
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
}
}
return
req
;
return
req
;
}
}
...
@@ -398,7 +398,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
...
@@ -398,7 +398,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
if
(
PageDirty
(
req
->
wb_page
))
if
(
PageDirty
(
req
->
wb_page
))
set_bit
(
PG_NEED_FLUSH
,
&
req
->
wb_flags
);
set_bit
(
PG_NEED_FLUSH
,
&
req
->
wb_flags
);
nfsi
->
npages
++
;
nfsi
->
npages
++
;
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
return
0
;
return
0
;
}
}
...
@@ -531,7 +531,7 @@ static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, u
...
@@ -531,7 +531,7 @@ static int nfs_wait_on_requests_locked(struct inode *inode, pgoff_t idx_start, u
next
=
req
->
wb_index
+
1
;
next
=
req
->
wb_index
+
1
;
BUG_ON
(
!
NFS_WBACK_BUSY
(
req
));
BUG_ON
(
!
NFS_WBACK_BUSY
(
req
));
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
spin_unlock
(
&
nfsi
->
req_lock
);
spin_unlock
(
&
nfsi
->
req_lock
);
error
=
nfs_wait_on_request
(
req
);
error
=
nfs_wait_on_request
(
req
);
nfs_release_request
(
req
);
nfs_release_request
(
req
);
...
...
include/linux/nfs_page.h
View file @
c03b4024
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include <linux/sunrpc/auth.h>
#include <linux/sunrpc/auth.h>
#include <linux/nfs_xdr.h>
#include <linux/nfs_xdr.h>
#include <
asm/atomic
.h>
#include <
linux/kref
.h>
/*
/*
* Valid flags for the radix tree
* Valid flags for the radix tree
...
@@ -42,7 +42,7 @@ struct nfs_page {
...
@@ -42,7 +42,7 @@ struct nfs_page {
unsigned
int
wb_offset
,
/* Offset & ~PAGE_CACHE_MASK */
unsigned
int
wb_offset
,
/* Offset & ~PAGE_CACHE_MASK */
wb_pgbase
,
/* Start of page data */
wb_pgbase
,
/* Start of page data */
wb_bytes
;
/* Length of request */
wb_bytes
;
/* Length of request */
atomic_t
wb_count
;
/* reference count */
struct
kref
wb_kref
;
/* reference count */
unsigned
long
wb_flags
;
unsigned
long
wb_flags
;
struct
nfs_writeverf
wb_verf
;
/* Commit cookie */
struct
nfs_writeverf
wb_verf
;
/* Commit cookie */
};
};
...
@@ -89,7 +89,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
...
@@ -89,7 +89,7 @@ extern void nfs_clear_page_writeback(struct nfs_page *req);
/*
/*
* Lock the page of an asynchronous request without
incrementing the wb_count
* Lock the page of an asynchronous request without
getting a new reference
*/
*/
static
inline
int
static
inline
int
nfs_lock_request_dontget
(
struct
nfs_page
*
req
)
nfs_lock_request_dontget
(
struct
nfs_page
*
req
)
...
@@ -98,14 +98,14 @@ nfs_lock_request_dontget(struct nfs_page *req)
...
@@ -98,14 +98,14 @@ nfs_lock_request_dontget(struct nfs_page *req)
}
}
/*
/*
* Lock the page of an asynchronous request
* Lock the page of an asynchronous request
and take a reference
*/
*/
static
inline
int
static
inline
int
nfs_lock_request
(
struct
nfs_page
*
req
)
nfs_lock_request
(
struct
nfs_page
*
req
)
{
{
if
(
test_and_set_bit
(
PG_BUSY
,
&
req
->
wb_flags
))
if
(
test_and_set_bit
(
PG_BUSY
,
&
req
->
wb_flags
))
return
0
;
return
0
;
atomic_inc
(
&
req
->
wb_count
);
kref_get
(
&
req
->
wb_kref
);
return
1
;
return
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment