diff options
Diffstat (limited to 'fs/gfs2/super.c')
-rw-r--r-- | fs/gfs2/super.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 0a6801336470..552e321cee5e 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -353,7 +353,7 @@ fail: | |||
353 | return error; | 353 | return error; |
354 | } | 354 | } |
355 | 355 | ||
356 | static void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf) | 356 | void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf) |
357 | { | 357 | { |
358 | const struct gfs2_statfs_change *str = buf; | 358 | const struct gfs2_statfs_change *str = buf; |
359 | 359 | ||
@@ -441,6 +441,29 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free, | |||
441 | brelse(l_bh); | 441 | brelse(l_bh); |
442 | } | 442 | } |
443 | 443 | ||
444 | void update_statfs(struct gfs2_sbd *sdp, struct buffer_head *m_bh, | ||
445 | struct buffer_head *l_bh) | ||
446 | { | ||
447 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); | ||
448 | struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode); | ||
449 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; | ||
450 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; | ||
451 | |||
452 | gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1); | ||
453 | |||
454 | spin_lock(&sdp->sd_statfs_spin); | ||
455 | m_sc->sc_total += l_sc->sc_total; | ||
456 | m_sc->sc_free += l_sc->sc_free; | ||
457 | m_sc->sc_dinodes += l_sc->sc_dinodes; | ||
458 | memset(l_sc, 0, sizeof(struct gfs2_statfs_change)); | ||
459 | memset(l_bh->b_data + sizeof(struct gfs2_dinode), | ||
460 | 0, sizeof(struct gfs2_statfs_change)); | ||
461 | spin_unlock(&sdp->sd_statfs_spin); | ||
462 | |||
463 | gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1); | ||
464 | gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode)); | ||
465 | } | ||
466 | |||
444 | int gfs2_statfs_sync(struct gfs2_sbd *sdp) | 467 | int gfs2_statfs_sync(struct gfs2_sbd *sdp) |
445 | { | 468 | { |
446 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); | 469 | struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode); |
@@ -477,19 +500,7 @@ int gfs2_statfs_sync(struct gfs2_sbd *sdp) | |||
477 | if (error) | 500 | if (error) |
478 | goto out_bh2; | 501 | goto out_bh2; |
479 | 502 | ||
480 | gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1); | 503 | update_statfs(sdp, m_bh, l_bh); |
481 | |||
482 | spin_lock(&sdp->sd_statfs_spin); | ||
483 | m_sc->sc_total += l_sc->sc_total; | ||
484 | m_sc->sc_free += l_sc->sc_free; | ||
485 | m_sc->sc_dinodes += l_sc->sc_dinodes; | ||
486 | memset(l_sc, 0, sizeof(struct gfs2_statfs_change)); | ||
487 | memset(l_bh->b_data + sizeof(struct gfs2_dinode), | ||
488 | 0, sizeof(struct gfs2_statfs_change)); | ||
489 | spin_unlock(&sdp->sd_statfs_spin); | ||
490 | |||
491 | gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1); | ||
492 | gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode)); | ||
493 | 504 | ||
494 | gfs2_trans_end(sdp); | 505 | gfs2_trans_end(sdp); |
495 | 506 | ||