Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
OpenBMC Firmware
talos-obmc-linux
Commits
153c8e6b
Commit
153c8e6b
authored
15 years ago
by
Sage Weil
Browse files
Options
Download
Email Patches
Plain Diff
ceph: use kref for struct ceph_mds_request
Signed-off-by:
Sage Weil
<
sage@newdream.net
>
parent
b6c1d5b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
38 deletions
+42
-38
fs/ceph/mds_client.c
fs/ceph/mds_client.c
+34
-35
fs/ceph/mds_client.h
fs/ceph/mds_client.h
+8
-3
No files found.
fs/ceph/mds_client.c
View file @
153c8e6b
...
...
@@ -400,41 +400,40 @@ static void put_request_session(struct ceph_mds_request *req)
}
}
void ceph_mdsc_put_request(struct ceph_mds_request *req)
{
dout("mdsc put_request %p %d -> %d\n", req,
atomic_read(&req->r_ref), atomic_read(&req->r_ref)-1);
if (atomic_dec_and_test(&req->r_ref)) {
if (req->r_request)
ceph_msg_put(req->r_request);
if (req->r_reply) {
ceph_msg_put(req->r_reply);
destroy_reply_info(&req->r_reply_info);
}
if (req->r_inode) {
ceph_put_cap_refs(ceph_inode(req->r_inode),
CEPH_CAP_PIN);
iput(req->r_inode);
}
if (req->r_locked_dir)
ceph_put_cap_refs(ceph_inode(req->r_locked_dir),
CEPH_CAP_PIN);
if (req->r_target_inode)
iput(req->r_target_inode);
if (req->r_dentry)
dput(req->r_dentry);
if (req->r_old_dentry) {
ceph_put_cap_refs(
ceph_inode(req->r_old_dentry->d_parent->d_inode),
CEPH_CAP_PIN);
dput(req->r_old_dentry);
}
kfree(req->r_path1);
kfree(req->r_path2);
put_request_session(req);
ceph_unreserve_caps(&req->r_caps_reservation);
kfree(req);
void ceph_mdsc_release_request(struct kref *kref)
{
struct ceph_mds_request *req = container_of(kref,
struct ceph_mds_request,
r_kref);
if (req->r_request)
ceph_msg_put(req->r_request);
if (req->r_reply) {
ceph_msg_put(req->r_reply);
destroy_reply_info(&req->r_reply_info);
}
if (req->r_inode) {
ceph_put_cap_refs(ceph_inode(req->r_inode),
CEPH_CAP_PIN);
iput(req->r_inode);
}
if (req->r_locked_dir)
ceph_put_cap_refs(ceph_inode(req->r_locked_dir),
CEPH_CAP_PIN);
if (req->r_target_inode)
iput(req->r_target_inode);
if (req->r_dentry)
dput(req->r_dentry);
if (req->r_old_dentry) {
ceph_put_cap_refs(
ceph_inode(req->r_old_dentry->d_parent->d_inode),
CEPH_CAP_PIN);
dput(req->r_old_dentry);
}
kfree(req->r_path1);
kfree(req->r_path2);
put_request_session(req);
ceph_unreserve_caps(&req->r_caps_reservation);
kfree(req);
}
/*
...
...
@@ -1097,7 +1096,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
req->r_resend_mds = -1;
INIT_LIST_HEAD(&req->r_unsafe_dir_item);
req->r_fmode = -1;
atomic_se
t(&req->r_ref
, 1); /* one for request_tree, one for caller */
kref_ini
t(&req->r_
k
ref
);
INIT_LIST_HEAD(&req->r_wait);
init_completion(&req->r_completion);
init_completion(&req->r_safe_completion);
...
...
This diff is collapsed.
Click to expand it.
fs/ceph/mds_client.h
View file @
153c8e6b
...
...
@@ -2,6 +2,7 @@
#define _FS_CEPH_MDS_CLIENT_H
#include <linux/completion.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/radix-tree.h>
...
...
@@ -203,7 +204,7 @@ struct ceph_mds_request {
int
r_num_stale
;
int
r_resend_mds
;
/* mds to resend to next, if any*/
atomic_t
r_ref
;
struct
kref
r_
k
ref
;
struct
list_head
r_wait
;
struct
completion
r_completion
;
struct
completion
r_safe_completion
;
...
...
@@ -306,9 +307,13 @@ extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
struct
ceph_mds_request
*
req
);
static
inline
void
ceph_mdsc_get_request
(
struct
ceph_mds_request
*
req
)
{
atomic_inc
(
&
req
->
r_ref
);
kref_get
(
&
req
->
r_kref
);
}
extern
void
ceph_mdsc_release_request
(
struct
kref
*
kref
);
static
inline
void
ceph_mdsc_put_request
(
struct
ceph_mds_request
*
req
)
{
kref_put
(
&
req
->
r_kref
,
ceph_mdsc_release_request
);
}
extern
void
ceph_mdsc_put_request
(
struct
ceph_mds_request
*
req
);
extern
void
ceph_mdsc_pre_umount
(
struct
ceph_mds_client
*
mdsc
);
...
...
This diff is collapsed.
Click to expand it.
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