summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-02-15 08:02:49 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-17 11:55:54 -0800
commit4ad765edb02a5333ce2fade642f116a67a3370ca (patch)
treef05f756dd7f11aba4a52217965895a0581528d2d /fs/xfs/xfs_iomap.c
parent125851ac92d62b966df851c6f34147121020af2f (diff)
xfs: move xfs_iomap_write_allocate to xfs_aops.c
This function is a small wrapper only used by the writeback code, so move it together with the writeback code and simplify it down to the glorified do { } while loop that is now is. A few bits intentionally got lost here: no need to call xfs_qm_dqattach because quotas are always attached when we create the delalloc reservation, and no need for the imap->br_startblock == 0 check given that xfs_bmapi_convert_delalloc already has a WARN_ON_ONCE for exactly that condition. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 15da53b5fb53..361dfe7af783 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -665,87 +665,6 @@ out_unlock:
return error;
}
-/*
- * Pass in a delayed allocate extent, convert it to real extents;
- * return to the caller the extent we create which maps on top of
- * the originating callers request.
- *
- * Called without a lock on the inode.
- *
- * We no longer bother to look at the incoming map - all we have to
- * guarantee is that whatever we allocate fills the required range.
- */
-int
-xfs_iomap_write_allocate(
- struct xfs_inode *ip,
- int whichfork,
- xfs_off_t offset,
- struct xfs_bmbt_irec *imap,
- unsigned int *seq)
-{
- struct xfs_mount *mp = ip->i_mount;
- xfs_fileoff_t offset_fsb;
- xfs_fileoff_t map_start_fsb;
- xfs_extlen_t map_count_fsb;
- int error = 0;
-
- /*
- * Make sure that the dquots are there.
- */
- error = xfs_qm_dqattach(ip);
- if (error)
- return error;
-
- /*
- * Store the file range the caller is interested in because it encodes
- * state such as potential overlap with COW fork blocks. We must trim
- * the allocated extent down to this range to maintain consistency with
- * what the caller expects. Revalidation of the range itself is the
- * responsibility of the caller.
- */
- offset_fsb = XFS_B_TO_FSBT(mp, offset);
- map_start_fsb = imap->br_startoff;
- map_count_fsb = imap->br_blockcount;
-
- while (true) {
- /*
- * Allocate in a loop because it may take several attempts to
- * allocate real blocks for a contiguous delalloc extent if free
- * space is sufficiently fragmented.
- */
-
- /*
- * ilock was dropped since imap was populated which means it
- * might no longer be valid. The current page is held locked so
- * nothing could have removed the block backing offset_fsb.
- * Attempt to allocate whatever delalloc extent currently backs
- * offset_fsb and put the result in the imap pointer from the
- * caller. We'll trim it down to the caller's most recently
- * validated range before we return.
- */
- error = xfs_bmapi_convert_delalloc(ip, whichfork, offset_fsb,
- imap, seq);
- if (error)
- return error;
-
- /*
- * See if we were able to allocate an extent that covers at
- * least part of the callers request.
- */
- if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip)))
- return xfs_alert_fsblock_zero(ip, imap);
-
- if ((offset_fsb >= imap->br_startoff) &&
- (offset_fsb < (imap->br_startoff +
- imap->br_blockcount))) {
- xfs_trim_extent(imap, map_start_fsb, map_count_fsb);
- ASSERT(offset_fsb >= imap->br_startoff &&
- offset_fsb < imap->br_startoff + imap->br_blockcount);
- return 0;
- }
- }
-}
-
int
xfs_iomap_write_unwritten(
xfs_inode_t *ip,