Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
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
Commits
415e49a9
Commit
415e49a9
authored
Dec 07, 2009
by
Sage Weil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ceph: use kref for ceph_osd_request
Signed-off-by:
Sage Weil
<
sage@newdream.net
>
parent
153c8e6b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
fs/ceph/osd_client.c
fs/ceph/osd_client.c
+18
-19
fs/ceph/osd_client.h
fs/ceph/osd_client.h
+8
-3
No files found.
fs/ceph/osd_client.c
View file @
415e49a9
...
...
@@ -77,12 +77,12 @@ static void calc_layout(struct ceph_osd_client *osdc,
/*
* requests
*/
void
ceph_osdc_
put_request
(
struct
ceph_osd_request
*
req
)
void
ceph_osdc_
release_request
(
struct
kref
*
kref
)
{
dout
(
"osdc put_request %p %d -> %d
\n
"
,
req
,
atomic_read
(
&
req
->
r_ref
)
,
atomic_read
(
&
req
->
r_ref
)
-
1
);
BUG_ON
(
atomic_read
(
&
req
->
r_ref
)
<=
0
);
if
(
atomic_dec_and_test
(
&
req
->
r_ref
))
{
struct
ceph_osd_request
*
req
=
container_of
(
kref
,
struct
ceph_osd_request
,
r_kref
);
if
(
req
->
r_request
)
ceph_msg_put
(
req
->
r_request
);
if
(
req
->
r_reply
)
...
...
@@ -95,7 +95,6 @@ void ceph_osdc_put_request(struct ceph_osd_request *req)
mempool_free
(
req
,
req
->
r_osdc
->
req_mempool
);
else
kfree
(
req
);
}
}
/*
...
...
@@ -149,7 +148,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
req
->
r_osdc
=
osdc
;
req
->
r_mempool
=
use_mempool
;
atomic_set
(
&
req
->
r_ref
,
1
);
kref_init
(
&
req
->
r_kref
);
init_completion
(
&
req
->
r_completion
);
init_completion
(
&
req
->
r_safe_completion
);
INIT_LIST_HEAD
(
&
req
->
r_unsafe_item
);
...
...
fs/ceph/osd_client.h
View file @
415e49a9
...
...
@@ -2,6 +2,7 @@
#define _FS_CEPH_OSD_CLIENT_H
#include <linux/completion.h>
#include <linux/kref.h>
#include <linux/mempool.h>
#include <linux/rbtree.h>
...
...
@@ -49,7 +50,7 @@ struct ceph_osd_request {
int
r_prepared_pages
,
r_got_reply
;
struct
ceph_osd_client
*
r_osdc
;
atomic_t
r_
ref
;
struct
kref
r_k
ref
;
bool
r_mempool
;
struct
completion
r_completion
,
r_safe_completion
;
ceph_osdc_callback_t
r_callback
,
r_safe_callback
;
...
...
@@ -118,9 +119,13 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
static
inline
void
ceph_osdc_get_request
(
struct
ceph_osd_request
*
req
)
{
atomic_inc
(
&
req
->
r_ref
);
kref_get
(
&
req
->
r_kref
);
}
extern
void
ceph_osdc_release_request
(
struct
kref
*
kref
);
static
inline
void
ceph_osdc_put_request
(
struct
ceph_osd_request
*
req
)
{
kref_put
(
&
req
->
r_kref
,
ceph_osdc_release_request
);
}
extern
void
ceph_osdc_put_request
(
struct
ceph_osd_request
*
req
);
extern
int
ceph_osdc_start_request
(
struct
ceph_osd_client
*
osdc
,
struct
ceph_osd_request
*
req
,
...
...
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