提交 405f8042 编写于 作者: C Christoph Hellwig 提交者: Alex Elder

xfs: cleanup the xfs_iomap_write_* helpers

Remove passing the BMAPI_* flags to these helpers, in
xfs_iomap_write_direct the check BMAPI_DIRECT was always true, and
in the xfs_iomap_write_delay path is was never checked at all.
Remove the nmap return value as we never make use of it.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 6ac7248e
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
#define XFS_WRITE_IMAPS XFS_BMAP_MAX_NMAP #define XFS_WRITE_IMAPS XFS_BMAP_MAX_NMAP
STATIC int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t, STATIC int xfs_iomap_write_direct(struct xfs_inode *, xfs_off_t, size_t,
int, struct xfs_bmbt_irec *, int *); struct xfs_bmbt_irec *, int);
STATIC int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t, int, STATIC int xfs_iomap_write_delay(struct xfs_inode *, xfs_off_t, size_t,
struct xfs_bmbt_irec *, int *); struct xfs_bmbt_irec *);
STATIC int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t, STATIC int xfs_iomap_write_allocate(struct xfs_inode *, xfs_off_t, size_t,
struct xfs_bmbt_irec *, int *); struct xfs_bmbt_irec *);
int int
xfs_iomap( xfs_iomap(
...@@ -134,12 +134,12 @@ xfs_iomap( ...@@ -134,12 +134,12 @@ xfs_iomap(
} }
if (flags & BMAPI_DIRECT) { if (flags & BMAPI_DIRECT) {
error = xfs_iomap_write_direct(ip, offset, count, flags, error = xfs_iomap_write_direct(ip, offset, count, imap,
imap, nimaps); *nimaps);
} else { } else {
error = xfs_iomap_write_delay(ip, offset, count, flags, error = xfs_iomap_write_delay(ip, offset, count, imap);
imap, nimaps);
} }
if (!error) { if (!error) {
trace_xfs_iomap_alloc(ip, offset, count, flags, imap); trace_xfs_iomap_alloc(ip, offset, count, flags, imap);
} }
...@@ -155,13 +155,10 @@ xfs_iomap( ...@@ -155,13 +155,10 @@ xfs_iomap(
break; break;
} }
error = xfs_iomap_write_allocate(ip, offset, count, error = xfs_iomap_write_allocate(ip, offset, count, imap);
imap, nimaps);
break; break;
} }
ASSERT(*nimaps <= 1);
out: out:
if (lockmode) if (lockmode)
xfs_iunlock(ip, lockmode); xfs_iunlock(ip, lockmode);
...@@ -241,9 +238,8 @@ xfs_iomap_write_direct( ...@@ -241,9 +238,8 @@ xfs_iomap_write_direct(
xfs_inode_t *ip, xfs_inode_t *ip,
xfs_off_t offset, xfs_off_t offset,
size_t count, size_t count,
int flags,
xfs_bmbt_irec_t *imap, xfs_bmbt_irec_t *imap,
int *nmaps) int nmaps)
{ {
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
xfs_fileoff_t offset_fsb; xfs_fileoff_t offset_fsb;
...@@ -279,7 +275,7 @@ xfs_iomap_write_direct( ...@@ -279,7 +275,7 @@ xfs_iomap_write_direct(
if (error) if (error)
goto error_out; goto error_out;
} else { } else {
if (*nmaps && (imap->br_startblock == HOLESTARTBLOCK)) if (nmaps && (imap->br_startblock == HOLESTARTBLOCK))
last_fsb = MIN(last_fsb, (xfs_fileoff_t) last_fsb = MIN(last_fsb, (xfs_fileoff_t)
imap->br_blockcount + imap->br_blockcount +
imap->br_startoff); imap->br_startoff);
...@@ -331,7 +327,7 @@ xfs_iomap_write_direct( ...@@ -331,7 +327,7 @@ xfs_iomap_write_direct(
xfs_trans_ijoin(tp, ip); xfs_trans_ijoin(tp, ip);
bmapi_flag = XFS_BMAPI_WRITE; bmapi_flag = XFS_BMAPI_WRITE;
if ((flags & BMAPI_DIRECT) && (offset < ip->i_size || extsz)) if (offset < ip->i_size || extsz)
bmapi_flag |= XFS_BMAPI_PREALLOC; bmapi_flag |= XFS_BMAPI_PREALLOC;
/* /*
...@@ -370,7 +366,6 @@ xfs_iomap_write_direct( ...@@ -370,7 +366,6 @@ xfs_iomap_write_direct(
goto error_out; goto error_out;
} }
*nmaps = 1;
return 0; return 0;
error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */
...@@ -379,7 +374,6 @@ xfs_iomap_write_direct( ...@@ -379,7 +374,6 @@ xfs_iomap_write_direct(
error1: /* Just cancel transaction */ error1: /* Just cancel transaction */
xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT);
*nmaps = 0; /* nothing set-up here */
error_out: error_out:
return XFS_ERROR(error); return XFS_ERROR(error);
...@@ -396,7 +390,6 @@ xfs_iomap_eof_want_preallocate( ...@@ -396,7 +390,6 @@ xfs_iomap_eof_want_preallocate(
xfs_inode_t *ip, xfs_inode_t *ip,
xfs_off_t offset, xfs_off_t offset,
size_t count, size_t count,
int ioflag,
xfs_bmbt_irec_t *imap, xfs_bmbt_irec_t *imap,
int nimaps, int nimaps,
int *prealloc) int *prealloc)
...@@ -440,9 +433,7 @@ xfs_iomap_write_delay( ...@@ -440,9 +433,7 @@ xfs_iomap_write_delay(
xfs_inode_t *ip, xfs_inode_t *ip,
xfs_off_t offset, xfs_off_t offset,
size_t count, size_t count,
int ioflag, xfs_bmbt_irec_t *ret_imap)
xfs_bmbt_irec_t *ret_imap,
int *nmaps)
{ {
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
xfs_fileoff_t offset_fsb; xfs_fileoff_t offset_fsb;
...@@ -470,7 +461,7 @@ xfs_iomap_write_delay( ...@@ -470,7 +461,7 @@ xfs_iomap_write_delay(
offset_fsb = XFS_B_TO_FSBT(mp, offset); offset_fsb = XFS_B_TO_FSBT(mp, offset);
error = xfs_iomap_eof_want_preallocate(mp, ip, offset, count, error = xfs_iomap_eof_want_preallocate(mp, ip, offset, count,
ioflag, imap, XFS_WRITE_IMAPS, &prealloc); imap, XFS_WRITE_IMAPS, &prealloc);
if (error) if (error)
return error; return error;
...@@ -523,8 +514,6 @@ xfs_iomap_write_delay( ...@@ -523,8 +514,6 @@ xfs_iomap_write_delay(
return xfs_cmn_err_fsblock_zero(ip, &imap[0]); return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
*ret_imap = imap[0]; *ret_imap = imap[0];
*nmaps = 1;
return 0; return 0;
} }
...@@ -543,8 +532,7 @@ xfs_iomap_write_allocate( ...@@ -543,8 +532,7 @@ xfs_iomap_write_allocate(
xfs_inode_t *ip, xfs_inode_t *ip,
xfs_off_t offset, xfs_off_t offset,
size_t count, size_t count,
xfs_bmbt_irec_t *imap, xfs_bmbt_irec_t *imap)
int *retmap)
{ {
xfs_mount_t *mp = ip->i_mount; xfs_mount_t *mp = ip->i_mount;
xfs_fileoff_t offset_fsb, last_block; xfs_fileoff_t offset_fsb, last_block;
...@@ -557,8 +545,6 @@ xfs_iomap_write_allocate( ...@@ -557,8 +545,6 @@ xfs_iomap_write_allocate(
int error = 0; int error = 0;
int nres; int nres;
*retmap = 0;
/* /*
* Make sure that the dquots are there. * Make sure that the dquots are there.
*/ */
...@@ -680,7 +666,6 @@ xfs_iomap_write_allocate( ...@@ -680,7 +666,6 @@ xfs_iomap_write_allocate(
if ((offset_fsb >= imap->br_startoff) && if ((offset_fsb >= imap->br_startoff) &&
(offset_fsb < (imap->br_startoff + (offset_fsb < (imap->br_startoff +
imap->br_blockcount))) { imap->br_blockcount))) {
*retmap = 1;
XFS_STATS_INC(xs_xstrat_quick); XFS_STATS_INC(xs_xstrat_quick);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册