diff options
author | Shan Hai <shan.hai@oracle.com> | 2018-01-23 16:56:11 -0500 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-29 10:27:22 -0500 |
commit | 6ca30729c206d62d88730a904af7d543a56273d8 (patch) | |
tree | b094bdea6121381dd71acff4e7563b7f3ab4ea3d | |
parent | 643c8c05e75d978c55ceb584f21a16de5431c17d (diff) |
xfs: bmap code cleanup
Remove the extent size hint and realtime inode relevant code from
the xfs_bmapi_reserve_delalloc since it is not called on the inode
with extent size hint set or on a realtime inode.
Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 6e6f3cb88cc2..0c9c9cdd532a 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -3876,8 +3876,6 @@ xfs_bmapi_reserve_delalloc( | |||
3876 | struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); | 3876 | struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, whichfork); |
3877 | xfs_extlen_t alen; | 3877 | xfs_extlen_t alen; |
3878 | xfs_extlen_t indlen; | 3878 | xfs_extlen_t indlen; |
3879 | char rt = XFS_IS_REALTIME_INODE(ip); | ||
3880 | xfs_extlen_t extsz; | ||
3881 | int error; | 3879 | int error; |
3882 | xfs_fileoff_t aoff = off; | 3880 | xfs_fileoff_t aoff = off; |
3883 | 3881 | ||
@@ -3892,31 +3890,25 @@ xfs_bmapi_reserve_delalloc( | |||
3892 | prealloc = alen - len; | 3890 | prealloc = alen - len; |
3893 | 3891 | ||
3894 | /* Figure out the extent size, adjust alen */ | 3892 | /* Figure out the extent size, adjust alen */ |
3895 | if (whichfork == XFS_COW_FORK) | 3893 | if (whichfork == XFS_COW_FORK) { |
3896 | extsz = xfs_get_cowextsz_hint(ip); | ||
3897 | else | ||
3898 | extsz = xfs_get_extsz_hint(ip); | ||
3899 | if (extsz) { | ||
3900 | struct xfs_bmbt_irec prev; | 3894 | struct xfs_bmbt_irec prev; |
3895 | xfs_extlen_t extsz = xfs_get_cowextsz_hint(ip); | ||
3901 | 3896 | ||
3902 | if (!xfs_iext_peek_prev_extent(ifp, icur, &prev)) | 3897 | if (!xfs_iext_peek_prev_extent(ifp, icur, &prev)) |
3903 | prev.br_startoff = NULLFILEOFF; | 3898 | prev.br_startoff = NULLFILEOFF; |
3904 | 3899 | ||
3905 | error = xfs_bmap_extsize_align(mp, got, &prev, extsz, rt, eof, | 3900 | error = xfs_bmap_extsize_align(mp, got, &prev, extsz, 0, eof, |
3906 | 1, 0, &aoff, &alen); | 3901 | 1, 0, &aoff, &alen); |
3907 | ASSERT(!error); | 3902 | ASSERT(!error); |
3908 | } | 3903 | } |
3909 | 3904 | ||
3910 | if (rt) | ||
3911 | extsz = alen / mp->m_sb.sb_rextsize; | ||
3912 | |||
3913 | /* | 3905 | /* |
3914 | * Make a transaction-less quota reservation for delayed allocation | 3906 | * Make a transaction-less quota reservation for delayed allocation |
3915 | * blocks. This number gets adjusted later. We return if we haven't | 3907 | * blocks. This number gets adjusted later. We return if we haven't |
3916 | * allocated blocks already inside this loop. | 3908 | * allocated blocks already inside this loop. |
3917 | */ | 3909 | */ |
3918 | error = xfs_trans_reserve_quota_nblks(NULL, ip, (long)alen, 0, | 3910 | error = xfs_trans_reserve_quota_nblks(NULL, ip, (long)alen, 0, |
3919 | rt ? XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS); | 3911 | XFS_QMOPT_RES_REGBLKS); |
3920 | if (error) | 3912 | if (error) |
3921 | return error; | 3913 | return error; |
3922 | 3914 | ||
@@ -3927,12 +3919,7 @@ xfs_bmapi_reserve_delalloc( | |||
3927 | indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen); | 3919 | indlen = (xfs_extlen_t)xfs_bmap_worst_indlen(ip, alen); |
3928 | ASSERT(indlen > 0); | 3920 | ASSERT(indlen > 0); |
3929 | 3921 | ||
3930 | if (rt) { | 3922 | error = xfs_mod_fdblocks(mp, -((int64_t)alen), false); |
3931 | error = xfs_mod_frextents(mp, -((int64_t)extsz)); | ||
3932 | } else { | ||
3933 | error = xfs_mod_fdblocks(mp, -((int64_t)alen), false); | ||
3934 | } | ||
3935 | |||
3936 | if (error) | 3923 | if (error) |
3937 | goto out_unreserve_quota; | 3924 | goto out_unreserve_quota; |
3938 | 3925 | ||
@@ -3963,14 +3950,11 @@ xfs_bmapi_reserve_delalloc( | |||
3963 | return 0; | 3950 | return 0; |
3964 | 3951 | ||
3965 | out_unreserve_blocks: | 3952 | out_unreserve_blocks: |
3966 | if (rt) | 3953 | xfs_mod_fdblocks(mp, alen, false); |
3967 | xfs_mod_frextents(mp, extsz); | ||
3968 | else | ||
3969 | xfs_mod_fdblocks(mp, alen, false); | ||
3970 | out_unreserve_quota: | 3954 | out_unreserve_quota: |
3971 | if (XFS_IS_QUOTA_ON(mp)) | 3955 | if (XFS_IS_QUOTA_ON(mp)) |
3972 | xfs_trans_unreserve_quota_nblks(NULL, ip, (long)alen, 0, rt ? | 3956 | xfs_trans_unreserve_quota_nblks(NULL, ip, (long)alen, 0, |
3973 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS); | 3957 | XFS_QMOPT_RES_REGBLKS); |
3974 | return error; | 3958 | return error; |
3975 | } | 3959 | } |
3976 | 3960 | ||