Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58582
b: refs/heads/master
c: eaf5bd3
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Jul 9, 2007
1 parent 5ec35e5 commit 3e1c405
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 52 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: 2332c4435bb733b5cd4f612ee57532bd8fde4c1c
refs/heads/master: eaf5bd3cac92126e5825c6ebc10bee0fba35d555
64 changes: 13 additions & 51 deletions trunk/fs/gfs2/glock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,73 +1327,35 @@ static int nq_m_sync(unsigned int num_gh, struct gfs2_holder *ghs,
* @num_gh: the number of structures
* @ghs: an array of struct gfs2_holder structures
*
* Figure out how big an impact this function has. Either:
* 1) Replace this code with code that calls gfs2_glock_prefetch()
* 2) Forget async stuff and just call nq_m_sync()
* 3) Leave it like it is
*
* Returns: 0 on success (all glocks acquired),
* errno on failure (no glocks acquired)
*/

int gfs2_glock_nq_m(unsigned int num_gh, struct gfs2_holder *ghs)
{
int *e;
unsigned int x;
int borked = 0, serious = 0;
struct gfs2_holder *tmp[4];
struct gfs2_holder **pph = tmp;
int error = 0;

if (!num_gh)
switch(num_gh) {
case 0:
return 0;

if (num_gh == 1) {
case 1:
ghs->gh_flags &= ~(LM_FLAG_TRY | GL_ASYNC);
return gfs2_glock_nq(ghs);
}

e = kcalloc(num_gh, sizeof(struct gfs2_holder *), GFP_KERNEL);
if (!e)
return -ENOMEM;

for (x = 0; x < num_gh; x++) {
ghs[x].gh_flags |= LM_FLAG_TRY | GL_ASYNC;
error = gfs2_glock_nq(&ghs[x]);
if (error) {
borked = 1;
serious = error;
num_gh = x;
default:
if (num_gh <= 4)
break;
}
pph = kmalloc(num_gh * sizeof(struct gfs2_holder *), GFP_NOFS);
if (!pph)
return -ENOMEM;
}

for (x = 0; x < num_gh; x++) {
error = e[x] = glock_wait_internal(&ghs[x]);
if (error) {
borked = 1;
if (error != GLR_TRYFAILED && error != GLR_CANCELED)
serious = error;
}
}

if (!borked) {
kfree(e);
return 0;
}

for (x = 0; x < num_gh; x++)
if (!e[x])
gfs2_glock_dq(&ghs[x]);

if (serious)
error = serious;
else {
for (x = 0; x < num_gh; x++)
gfs2_holder_reinit(ghs[x].gh_state, ghs[x].gh_flags,
&ghs[x]);
error = nq_m_sync(num_gh, ghs, (struct gfs2_holder **)e);
}
error = nq_m_sync(num_gh, ghs, pph);

kfree(e);
if (pph != tmp)
kfree(pph);

return error;
}
Expand Down

0 comments on commit 3e1c405

Please sign in to comment.