diff options
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r-- | fs/gfs2/ops_address.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 30c15622174f..846c0ff75cff 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 2 | * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
3 | * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. | 3 | * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. |
4 | * | 4 | * |
5 | * This copyrighted material is made available to anyone wishing to use, | 5 | * This copyrighted material is made available to anyone wishing to use, |
6 | * modify, copy, or redistribute it subject to the terms and conditions | 6 | * modify, copy, or redistribute it subject to the terms and conditions |
@@ -450,6 +450,30 @@ out_uninit: | |||
450 | } | 450 | } |
451 | 451 | ||
452 | /** | 452 | /** |
453 | * adjust_fs_space - Adjusts the free space available due to gfs2_grow | ||
454 | * @inode: the rindex inode | ||
455 | */ | ||
456 | static void adjust_fs_space(struct inode *inode) | ||
457 | { | ||
458 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; | ||
459 | struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master; | ||
460 | struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local; | ||
461 | u64 fs_total, new_free; | ||
462 | |||
463 | /* Total up the file system space, according to the latest rindex. */ | ||
464 | fs_total = gfs2_ri_total(sdp); | ||
465 | |||
466 | spin_lock(&sdp->sd_statfs_spin); | ||
467 | if (fs_total > (m_sc->sc_total + l_sc->sc_total)) | ||
468 | new_free = fs_total - (m_sc->sc_total + l_sc->sc_total); | ||
469 | else | ||
470 | new_free = 0; | ||
471 | spin_unlock(&sdp->sd_statfs_spin); | ||
472 | fs_warn(sdp, "File system extended by %llu blocks.\n", new_free); | ||
473 | gfs2_statfs_change(sdp, new_free, new_free, 0); | ||
474 | } | ||
475 | |||
476 | /** | ||
453 | * gfs2_commit_write - Commit write to a file | 477 | * gfs2_commit_write - Commit write to a file |
454 | * @file: The file to write to | 478 | * @file: The file to write to |
455 | * @page: The page containing the data | 479 | * @page: The page containing the data |
@@ -511,6 +535,9 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
511 | di->di_size = cpu_to_be64(inode->i_size); | 535 | di->di_size = cpu_to_be64(inode->i_size); |
512 | } | 536 | } |
513 | 537 | ||
538 | if (inode == sdp->sd_rindex) | ||
539 | adjust_fs_space(inode); | ||
540 | |||
514 | brelse(dibh); | 541 | brelse(dibh); |
515 | gfs2_trans_end(sdp); | 542 | gfs2_trans_end(sdp); |
516 | if (al->al_requested) { | 543 | if (al->al_requested) { |