diff options
-rw-r--r-- | fs/gfs2/bmap.c | 20 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 34 | ||||
-rw-r--r-- | fs/gfs2/rgrp.h | 2 |
3 files changed, 48 insertions, 8 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 3c4039d5eef1..ef3dc4b9fae2 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "meta_io.h" | 21 | #include "meta_io.h" |
22 | #include "quota.h" | 22 | #include "quota.h" |
23 | #include "rgrp.h" | 23 | #include "rgrp.h" |
24 | #include "super.h" | ||
24 | #include "trans.h" | 25 | #include "trans.h" |
25 | #include "dir.h" | 26 | #include "dir.h" |
26 | #include "util.h" | 27 | #include "util.h" |
@@ -757,7 +758,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
757 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 758 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
758 | struct gfs2_rgrp_list rlist; | 759 | struct gfs2_rgrp_list rlist; |
759 | u64 bn, bstart; | 760 | u64 bn, bstart; |
760 | u32 blen; | 761 | u32 blen, btotal; |
761 | __be64 *p; | 762 | __be64 *p; |
762 | unsigned int rg_blocks = 0; | 763 | unsigned int rg_blocks = 0; |
763 | int metadata; | 764 | int metadata; |
@@ -839,6 +840,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
839 | 840 | ||
840 | bstart = 0; | 841 | bstart = 0; |
841 | blen = 0; | 842 | blen = 0; |
843 | btotal = 0; | ||
842 | 844 | ||
843 | for (p = top; p < bottom; p++) { | 845 | for (p = top; p < bottom; p++) { |
844 | if (!*p) | 846 | if (!*p) |
@@ -851,9 +853,11 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
851 | else { | 853 | else { |
852 | if (bstart) { | 854 | if (bstart) { |
853 | if (metadata) | 855 | if (metadata) |
854 | gfs2_free_meta(ip, bstart, blen); | 856 | __gfs2_free_meta(ip, bstart, blen); |
855 | else | 857 | else |
856 | gfs2_free_data(ip, bstart, blen); | 858 | __gfs2_free_data(ip, bstart, blen); |
859 | |||
860 | btotal += blen; | ||
857 | } | 861 | } |
858 | 862 | ||
859 | bstart = bn; | 863 | bstart = bn; |
@@ -865,11 +869,17 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
865 | } | 869 | } |
866 | if (bstart) { | 870 | if (bstart) { |
867 | if (metadata) | 871 | if (metadata) |
868 | gfs2_free_meta(ip, bstart, blen); | 872 | __gfs2_free_meta(ip, bstart, blen); |
869 | else | 873 | else |
870 | gfs2_free_data(ip, bstart, blen); | 874 | __gfs2_free_data(ip, bstart, blen); |
875 | |||
876 | btotal += blen; | ||
871 | } | 877 | } |
872 | 878 | ||
879 | gfs2_statfs_change(sdp, 0, +btotal, 0); | ||
880 | gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, | ||
881 | ip->i_inode.i_gid); | ||
882 | |||
873 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 883 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
874 | 884 | ||
875 | gfs2_dinode_out(ip, dibh->b_data); | 885 | gfs2_dinode_out(ip, dibh->b_data); |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 7293ea27020c..cf930cd9664a 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1602,7 +1602,7 @@ rgrp_error: | |||
1602 | * | 1602 | * |
1603 | */ | 1603 | */ |
1604 | 1604 | ||
1605 | void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) | 1605 | void __gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) |
1606 | { | 1606 | { |
1607 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1607 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1608 | struct gfs2_rgrpd *rgd; | 1608 | struct gfs2_rgrpd *rgd; |
@@ -1617,7 +1617,21 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) | |||
1617 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); | 1617 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1618 | 1618 | ||
1619 | gfs2_trans_add_rg(rgd); | 1619 | gfs2_trans_add_rg(rgd); |
1620 | } | ||
1620 | 1621 | ||
1622 | /** | ||
1623 | * gfs2_free_data - free a contiguous run of data block(s) | ||
1624 | * @ip: the inode these blocks are being freed from | ||
1625 | * @bstart: first block of a run of contiguous blocks | ||
1626 | * @blen: the length of the block run | ||
1627 | * | ||
1628 | */ | ||
1629 | |||
1630 | void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) | ||
1631 | { | ||
1632 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
1633 | |||
1634 | __gfs2_free_data(ip, bstart, blen); | ||
1621 | gfs2_statfs_change(sdp, 0, +blen, 0); | 1635 | gfs2_statfs_change(sdp, 0, +blen, 0); |
1622 | gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1636 | gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1623 | } | 1637 | } |
@@ -1630,7 +1644,7 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen) | |||
1630 | * | 1644 | * |
1631 | */ | 1645 | */ |
1632 | 1646 | ||
1633 | void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) | 1647 | void __gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) |
1634 | { | 1648 | { |
1635 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 1649 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
1636 | struct gfs2_rgrpd *rgd; | 1650 | struct gfs2_rgrpd *rgd; |
@@ -1645,10 +1659,24 @@ void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) | |||
1645 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); | 1659 | gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); |
1646 | 1660 | ||
1647 | gfs2_trans_add_rg(rgd); | 1661 | gfs2_trans_add_rg(rgd); |
1662 | gfs2_meta_wipe(ip, bstart, blen); | ||
1663 | } | ||
1648 | 1664 | ||
1665 | /** | ||
1666 | * gfs2_free_meta - free a contiguous run of data block(s) | ||
1667 | * @ip: the inode these blocks are being freed from | ||
1668 | * @bstart: first block of a run of contiguous blocks | ||
1669 | * @blen: the length of the block run | ||
1670 | * | ||
1671 | */ | ||
1672 | |||
1673 | void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen) | ||
1674 | { | ||
1675 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
1676 | |||
1677 | __gfs2_free_meta(ip, bstart, blen); | ||
1649 | gfs2_statfs_change(sdp, 0, +blen, 0); | 1678 | gfs2_statfs_change(sdp, 0, +blen, 0); |
1650 | gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid); | 1679 | gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid); |
1651 | gfs2_meta_wipe(ip, bstart, blen); | ||
1652 | } | 1680 | } |
1653 | 1681 | ||
1654 | void gfs2_unlink_di(struct inode *inode) | 1682 | void gfs2_unlink_di(struct inode *inode) |
diff --git a/fs/gfs2/rgrp.h b/fs/gfs2/rgrp.h index 50c2bb04369c..a80e3034ac47 100644 --- a/fs/gfs2/rgrp.h +++ b/fs/gfs2/rgrp.h | |||
@@ -52,7 +52,9 @@ extern int gfs2_ri_update(struct gfs2_inode *ip); | |||
52 | extern int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n); | 52 | extern int gfs2_alloc_block(struct gfs2_inode *ip, u64 *bn, unsigned int *n); |
53 | extern int gfs2_alloc_di(struct gfs2_inode *ip, u64 *bn, u64 *generation); | 53 | extern int gfs2_alloc_di(struct gfs2_inode *ip, u64 *bn, u64 *generation); |
54 | 54 | ||
55 | extern void __gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen); | ||
55 | extern void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen); | 56 | extern void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen); |
57 | extern void __gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen); | ||
56 | extern void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen); | 58 | extern void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen); |
57 | extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip); | 59 | extern void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip); |
58 | extern void gfs2_unlink_di(struct inode *inode); | 60 | extern void gfs2_unlink_di(struct inode *inode); |