diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2008-11-26 08:30:49 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-01-05 02:39:12 -0500 |
commit | 2bfb6449b7a1f29a2a63e1d869103b5811c3b69f (patch) | |
tree | e4f8f51cf7346ec239ebd0b9ac9ddc2580c706e2 /fs/gfs2/super.c | |
parent | b52896813c2f16bcc5c5b67bb3c3f75bc084439b (diff) |
GFS2: Move four functions from super.c
The functions which are being moved can all be marked
static in their new locations, since they only have
a single caller each. Their new locations are more
logical than before and some of the functions are
small enough that the compiler might well inline them.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 3dd9f5788cb0..141b781f2fcc 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -96,39 +96,6 @@ struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid) | |||
96 | return jd; | 96 | return jd; |
97 | } | 97 | } |
98 | 98 | ||
99 | void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid) | ||
100 | { | ||
101 | struct gfs2_jdesc *jd; | ||
102 | |||
103 | spin_lock(&sdp->sd_jindex_spin); | ||
104 | jd = jdesc_find_i(&sdp->sd_jindex_list, jid); | ||
105 | if (jd) | ||
106 | jd->jd_dirty = 1; | ||
107 | spin_unlock(&sdp->sd_jindex_spin); | ||
108 | } | ||
109 | |||
110 | struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp) | ||
111 | { | ||
112 | struct gfs2_jdesc *jd; | ||
113 | int found = 0; | ||
114 | |||
115 | spin_lock(&sdp->sd_jindex_spin); | ||
116 | |||
117 | list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { | ||
118 | if (jd->jd_dirty) { | ||
119 | jd->jd_dirty = 0; | ||
120 | found = 1; | ||
121 | break; | ||
122 | } | ||
123 | } | ||
124 | spin_unlock(&sdp->sd_jindex_spin); | ||
125 | |||
126 | if (!found) | ||
127 | jd = NULL; | ||
128 | |||
129 | return jd; | ||
130 | } | ||
131 | |||
132 | int gfs2_jdesc_check(struct gfs2_jdesc *jd) | 99 | int gfs2_jdesc_check(struct gfs2_jdesc *jd) |
133 | { | 100 | { |
134 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); | 101 | struct gfs2_inode *ip = GFS2_I(jd->jd_inode); |
@@ -353,137 +320,6 @@ out: | |||
353 | return error; | 320 | return error; |
354 | } | 321 | } |
355 | 322 | ||
356 | /** | ||
357 | * gfs2_statfs_i - Do a statfs | ||
358 | * @sdp: the filesystem | ||
359 | * @sg: the sg structure | ||
360 | * | ||
361 | * Returns: errno | ||
362 | */ | ||
363 | |||
364 | int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc) | ||
365 | { | ||
366 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; | ||
367 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; | ||
368 | |||
369 | spin_lock(&sdp->sd_statfs_spin); | ||
370 | |||
371 | *sc = *m_sc; | ||
372 | sc->sc_total += l_sc->sc_total; | ||
373 | sc->sc_free += l_sc->sc_free; | ||
374 | sc->sc_dinodes += l_sc->sc_dinodes; | ||
375 | |||
376 | spin_unlock(&sdp->sd_statfs_spin); | ||
377 | |||
378 | if (sc->sc_free < 0) | ||
379 | sc->sc_free = 0; | ||
380 | if (sc->sc_free > sc->sc_total) | ||
381 | sc->sc_free = sc->sc_total; | ||
382 | if (sc->sc_dinodes < 0) | ||
383 | sc->sc_dinodes = 0; | ||
384 | |||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | /** | ||
389 | * statfs_fill - fill in the sg for a given RG | ||
390 | * @rgd: the RG | ||
391 | * @sc: the sc structure | ||
392 | * | ||
393 | * Returns: 0 on success, -ESTALE if the LVB is invalid | ||
394 | */ | ||
395 | |||
396 | static int statfs_slow_fill(struct gfs2_rgrpd *rgd, | ||
397 | struct gfs2_statfs_change_host *sc) | ||
398 | { | ||
399 | gfs2_rgrp_verify(rgd); | ||
400 | sc->sc_total += rgd->rd_data; | ||
401 | sc->sc_free += rgd->rd_free; | ||
402 | sc->sc_dinodes += rgd->rd_dinodes; | ||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | /** | ||
407 | * gfs2_statfs_slow - Stat a filesystem using asynchronous locking | ||
408 | * @sdp: the filesystem | ||
409 | * @sc: the sc info that will be returned | ||
410 | * | ||
411 | * Any error (other than a signal) will cause this routine to fall back | ||
412 | * to the synchronous version. | ||
413 | * | ||
414 | * FIXME: This really shouldn't busy wait like this. | ||
415 | * | ||
416 | * Returns: errno | ||
417 | */ | ||
418 | |||
419 | int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc) | ||
420 | { | ||
421 | struct gfs2_holder ri_gh; | ||
422 | struct gfs2_rgrpd *rgd_next; | ||
423 | struct gfs2_holder *gha, *gh; | ||
424 | unsigned int slots = 64; | ||
425 | unsigned int x; | ||
426 | int done; | ||
427 | int error = 0, err; | ||
428 | |||
429 | memset(sc, 0, sizeof(struct gfs2_statfs_change_host)); | ||
430 | gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL); | ||
431 | if (!gha) | ||
432 | return -ENOMEM; | ||
433 | |||
434 | error = gfs2_rindex_hold(sdp, &ri_gh); | ||
435 | if (error) | ||
436 | goto out; | ||
437 | |||
438 | rgd_next = gfs2_rgrpd_get_first(sdp); | ||
439 | |||
440 | for (;;) { | ||
441 | done = 1; | ||
442 | |||
443 | for (x = 0; x < slots; x++) { | ||
444 | gh = gha + x; | ||
445 | |||
446 | if (gh->gh_gl && gfs2_glock_poll(gh)) { | ||
447 | err = gfs2_glock_wait(gh); | ||
448 | if (err) { | ||
449 | gfs2_holder_uninit(gh); | ||
450 | error = err; | ||
451 | } else { | ||
452 | if (!error) | ||
453 | error = statfs_slow_fill( | ||
454 | gh->gh_gl->gl_object, sc); | ||
455 | gfs2_glock_dq_uninit(gh); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | if (gh->gh_gl) | ||
460 | done = 0; | ||
461 | else if (rgd_next && !error) { | ||
462 | error = gfs2_glock_nq_init(rgd_next->rd_gl, | ||
463 | LM_ST_SHARED, | ||
464 | GL_ASYNC, | ||
465 | gh); | ||
466 | rgd_next = gfs2_rgrpd_get_next(rgd_next); | ||
467 | done = 0; | ||
468 | } | ||
469 | |||
470 | if (signal_pending(current)) | ||
471 | error = -ERESTARTSYS; | ||
472 | } | ||
473 | |||
474 | if (done) | ||
475 | break; | ||
476 | |||
477 | yield(); | ||
478 | } | ||
479 | |||
480 | gfs2_glock_dq_uninit(&ri_gh); | ||
481 | |||
482 | out: | ||
483 | kfree(gha); | ||
484 | return error; | ||
485 | } | ||
486 | |||
487 | struct lfcc { | 323 | struct lfcc { |
488 | struct list_head list; | 324 | struct list_head list; |
489 | struct gfs2_holder gh; | 325 | struct gfs2_holder gh; |