Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208830
b: refs/heads/master
c: 38e8883
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Aug 2, 2010
1 parent 35f592a commit b12b85e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee6b272b9c3447a78fa831e37b925aefd5587ec9
refs/heads/master: 38e8883ee31667d901feb9106f4863af35948c91
35 changes: 19 additions & 16 deletions trunk/fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,14 @@ static int trim_caps(struct ceph_mds_client *mdsc,
int ceph_add_cap_releases(struct ceph_mds_client *mdsc,
struct ceph_mds_session *session)
{
struct ceph_msg *msg;
struct ceph_msg *msg, *partial = NULL;
struct ceph_mds_cap_release *head;
int err = -ENOMEM;
int extra = mdsc->client->mount_args->cap_release_safety;
int num;

dout("add_cap_releases %p mds%d extra %d\n", session, session->s_mds,
extra);

spin_lock(&session->s_cap_lock);

Expand All @@ -1082,9 +1085,14 @@ int ceph_add_cap_releases(struct ceph_mds_client *mdsc,
struct ceph_msg,
list_head);
head = msg->front.iov_base;
extra += CEPH_CAPS_PER_RELEASE - le32_to_cpu(head->num);
num = le32_to_cpu(head->num);
if (num) {
dout(" partial %p with (%d/%d)\n", msg, num,
(int)CEPH_CAPS_PER_RELEASE);
extra += CEPH_CAPS_PER_RELEASE - num;
partial = msg;
}
}

while (session->s_num_cap_releases < session->s_nr_caps + extra) {
spin_unlock(&session->s_cap_lock);
msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPRELEASE, PAGE_CACHE_SIZE,
Expand All @@ -1101,19 +1109,14 @@ int ceph_add_cap_releases(struct ceph_mds_client *mdsc,
session->s_num_cap_releases += CEPH_CAPS_PER_RELEASE;
}

if (!list_empty(&session->s_cap_releases)) {
msg = list_first_entry(&session->s_cap_releases,
struct ceph_msg,
list_head);
head = msg->front.iov_base;
if (head->num) {
dout(" queueing non-full %p (%d)\n", msg,
le32_to_cpu(head->num));
list_move_tail(&msg->list_head,
&session->s_cap_releases_done);
session->s_num_cap_releases -=
CEPH_CAPS_PER_RELEASE - le32_to_cpu(head->num);
}
if (partial) {
head = partial->front.iov_base;
num = le32_to_cpu(head->num);
dout(" queueing partial %p with %d/%d\n", partial, num,
(int)CEPH_CAPS_PER_RELEASE);
list_move_tail(&partial->list_head,
&session->s_cap_releases_done);
session->s_num_cap_releases -= CEPH_CAPS_PER_RELEASE - num;
}
err = 0;
spin_unlock(&session->s_cap_lock);
Expand Down

0 comments on commit b12b85e

Please sign in to comment.