xfs: remove prev argument to xfs_bmapi_reserve_delalloc
authorChristoph Hellwig <hch@lst.de>
Thu, 24 Nov 2016 00:39:44 +0000 (11:39 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 24 Nov 2016 00:39:44 +0000 (11:39 +1100)
We can easily lookup the previous extent for the cases where we need it,
which saves the callers from looking it up for us later in the series.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap.h
fs/xfs/xfs_iomap.c
fs/xfs/xfs_reflink.c

index 05608faa28ce2556f284e8fcab508c16f3a005e3..6af34b734ce874d74d2fa48dca119ff903b4c2e3 100644 (file)
@@ -4235,7 +4235,6 @@ xfs_bmapi_reserve_delalloc(
        xfs_fileoff_t           aoff,
        xfs_filblks_t           len,
        struct xfs_bmbt_irec    *got,
-       struct xfs_bmbt_irec    *prev,
        xfs_extnum_t            *lastx,
        int                     eof)
 {
@@ -4257,7 +4256,12 @@ xfs_bmapi_reserve_delalloc(
        else
                extsz = xfs_get_extsz_hint(ip);
        if (extsz) {
-               error = xfs_bmap_extsize_align(mp, got, prev, extsz, rt, eof,
+               struct xfs_bmbt_irec    prev;
+
+               if (!xfs_iext_get_extent(ifp, *lastx - 1, &prev))
+                       prev.br_startoff = NULLFILEOFF;
+
+               error = xfs_bmap_extsize_align(mp, got, &prev, extsz, rt, eof,
                                               1, 0, &aoff, &alen);
                ASSERT(!error);
        }
index 7cae6ec27fa6b26a84984fddb3dc35d6556e2122..e3c2b5adf505300a1115317b0014d5995081d51c 100644 (file)
@@ -243,8 +243,7 @@ struct xfs_bmbt_rec_host *
                struct xfs_bmbt_irec *gotp, struct xfs_bmbt_irec *prevp);
 int    xfs_bmapi_reserve_delalloc(struct xfs_inode *ip, int whichfork,
                xfs_fileoff_t aoff, xfs_filblks_t len,
-               struct xfs_bmbt_irec *got, struct xfs_bmbt_irec *prev,
-               xfs_extnum_t *lastx, int eof);
+               struct xfs_bmbt_irec *got, xfs_extnum_t *lastx, int eof);
 
 enum xfs_bmap_intent_type {
        XFS_BMAP_MAP = 1,
index 436e109bb01e59d32bda87e9dd43ab3229cba509..59ffcac8a47df8c07795f137b6b6f4810d2d2b50 100644 (file)
@@ -622,8 +622,7 @@ xfs_file_iomap_begin_delay(
 
 retry:
        error = xfs_bmapi_reserve_delalloc(ip, XFS_DATA_FORK, offset_fsb,
-                       end_fsb - offset_fsb, &got,
-                       &prev, &idx, eof);
+                       end_fsb - offset_fsb, &got, &idx, eof);
        switch (error) {
        case 0:
                break;
index 0edf835af32dff589992ce9beee65fde7508279d..52cdfbaca30d142af963e584b4fa8faf683fe1f3 100644 (file)
@@ -293,7 +293,7 @@ xfs_reflink_reserve_cow(
 
 retry:
        error = xfs_bmapi_reserve_delalloc(ip, XFS_COW_FORK, imap->br_startoff,
-                       end_fsb - imap->br_startoff, &got, &prev, &idx, eof);
+                       end_fsb - imap->br_startoff, &got, &idx, eof);
        switch (error) {
        case 0:
                break;