diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2010-06-17 19:16:12 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-01 23:11:40 -0400 |
commit | 37151668bad3fd058368752bee476f2ba3645596 (patch) | |
tree | 6eeae77dfa1c758ff03659b5677f474a72fbe7c0 /fs/ceph/mds_client.c | |
parent | 0deb01c9998f8112c5e478e3fe3a930131abbc0a (diff) |
ceph: do caps accounting per mds_client
Caps related accounting is now being done per mds client instead
of just being global. This prepares ground work for a later revision
of the caps preallocated reservation list.
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 6e40db2a0014..641a8a37e7b3 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -449,7 +449,7 @@ void ceph_mdsc_release_request(struct kref *kref) | |||
449 | kfree(req->r_path1); | 449 | kfree(req->r_path1); |
450 | kfree(req->r_path2); | 450 | kfree(req->r_path2); |
451 | put_request_session(req); | 451 | put_request_session(req); |
452 | ceph_unreserve_caps(&req->r_caps_reservation); | 452 | ceph_unreserve_caps(req->r_mdsc, &req->r_caps_reservation); |
453 | kfree(req); | 453 | kfree(req); |
454 | } | 454 | } |
455 | 455 | ||
@@ -512,7 +512,8 @@ static void __register_request(struct ceph_mds_client *mdsc, | |||
512 | { | 512 | { |
513 | req->r_tid = ++mdsc->last_tid; | 513 | req->r_tid = ++mdsc->last_tid; |
514 | if (req->r_num_caps) | 514 | if (req->r_num_caps) |
515 | ceph_reserve_caps(&req->r_caps_reservation, req->r_num_caps); | 515 | ceph_reserve_caps(mdsc, &req->r_caps_reservation, |
516 | req->r_num_caps); | ||
516 | dout("__register_request %p tid %lld\n", req, req->r_tid); | 517 | dout("__register_request %p tid %lld\n", req, req->r_tid); |
517 | ceph_mdsc_get_request(req); | 518 | ceph_mdsc_get_request(req); |
518 | __insert_request(mdsc, req); | 519 | __insert_request(mdsc, req); |
@@ -764,7 +765,7 @@ static int iterate_session_caps(struct ceph_mds_session *session, | |||
764 | last_inode = NULL; | 765 | last_inode = NULL; |
765 | } | 766 | } |
766 | if (old_cap) { | 767 | if (old_cap) { |
767 | ceph_put_cap(old_cap); | 768 | ceph_put_cap(session->s_mdsc, old_cap); |
768 | old_cap = NULL; | 769 | old_cap = NULL; |
769 | } | 770 | } |
770 | 771 | ||
@@ -793,7 +794,7 @@ out: | |||
793 | if (last_inode) | 794 | if (last_inode) |
794 | iput(last_inode); | 795 | iput(last_inode); |
795 | if (old_cap) | 796 | if (old_cap) |
796 | ceph_put_cap(old_cap); | 797 | ceph_put_cap(session->s_mdsc, old_cap); |
797 | 798 | ||
798 | return ret; | 799 | return ret; |
799 | } | 800 | } |
@@ -1251,6 +1252,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode) | |||
1251 | return ERR_PTR(-ENOMEM); | 1252 | return ERR_PTR(-ENOMEM); |
1252 | 1253 | ||
1253 | mutex_init(&req->r_fill_mutex); | 1254 | mutex_init(&req->r_fill_mutex); |
1255 | req->r_mdsc = mdsc; | ||
1254 | req->r_started = jiffies; | 1256 | req->r_started = jiffies; |
1255 | req->r_resend_mds = -1; | 1257 | req->r_resend_mds = -1; |
1256 | INIT_LIST_HEAD(&req->r_unsafe_dir_item); | 1258 | INIT_LIST_HEAD(&req->r_unsafe_dir_item); |
@@ -1986,7 +1988,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) | |||
1986 | if (err == 0) { | 1988 | if (err == 0) { |
1987 | if (result == 0 && rinfo->dir_nr) | 1989 | if (result == 0 && rinfo->dir_nr) |
1988 | ceph_readdir_prepopulate(req, req->r_session); | 1990 | ceph_readdir_prepopulate(req, req->r_session); |
1989 | ceph_unreserve_caps(&req->r_caps_reservation); | 1991 | ceph_unreserve_caps(mdsc, &req->r_caps_reservation); |
1990 | } | 1992 | } |
1991 | mutex_unlock(&req->r_fill_mutex); | 1993 | mutex_unlock(&req->r_fill_mutex); |
1992 | 1994 | ||
@@ -2767,6 +2769,9 @@ int ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client) | |||
2767 | spin_lock_init(&mdsc->dentry_lru_lock); | 2769 | spin_lock_init(&mdsc->dentry_lru_lock); |
2768 | INIT_LIST_HEAD(&mdsc->dentry_lru); | 2770 | INIT_LIST_HEAD(&mdsc->dentry_lru); |
2769 | 2771 | ||
2772 | ceph_caps_init(mdsc); | ||
2773 | ceph_adjust_min_caps(mdsc, client->min_caps); | ||
2774 | |||
2770 | return 0; | 2775 | return 0; |
2771 | } | 2776 | } |
2772 | 2777 | ||
@@ -2962,6 +2967,7 @@ void ceph_mdsc_stop(struct ceph_mds_client *mdsc) | |||
2962 | if (mdsc->mdsmap) | 2967 | if (mdsc->mdsmap) |
2963 | ceph_mdsmap_destroy(mdsc->mdsmap); | 2968 | ceph_mdsmap_destroy(mdsc->mdsmap); |
2964 | kfree(mdsc->sessions); | 2969 | kfree(mdsc->sessions); |
2970 | ceph_caps_finalize(mdsc); | ||
2965 | } | 2971 | } |
2966 | 2972 | ||
2967 | 2973 | ||