Commit 8a749386 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong

xfs: cow unwritten conversion uses uninitialized dfops

A couple COW fork unwritten extent conversion helpers pass an
uninitialized dfops pointer to xfs_bmapi_write(). This does not
cause problems because conversion does not use a transaction or the
dfops structure for the COW fork.  Drop the uninitialized usage of
dfops in these codepaths and pass NULL along to xfs_bmapi_write()
instead.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 98c1a7c0
...@@ -312,8 +312,7 @@ xfs_reflink_convert_cow_extent( ...@@ -312,8 +312,7 @@ xfs_reflink_convert_cow_extent(
struct xfs_inode *ip, struct xfs_inode *ip,
struct xfs_bmbt_irec *imap, struct xfs_bmbt_irec *imap,
xfs_fileoff_t offset_fsb, xfs_fileoff_t offset_fsb,
xfs_filblks_t count_fsb, xfs_filblks_t count_fsb)
struct xfs_defer_ops *dfops)
{ {
xfs_fsblock_t first_block = NULLFSBLOCK; xfs_fsblock_t first_block = NULLFSBLOCK;
int nimaps = 1; int nimaps = 1;
...@@ -327,7 +326,7 @@ xfs_reflink_convert_cow_extent( ...@@ -327,7 +326,7 @@ xfs_reflink_convert_cow_extent(
return 0; return 0;
return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount, return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, &first_block, XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, &first_block,
0, imap, &nimaps, dfops); 0, imap, &nimaps, NULL);
} }
/* Convert all of the unwritten CoW extents in a file's range to real ones. */ /* Convert all of the unwritten CoW extents in a file's range to real ones. */
...@@ -342,7 +341,6 @@ xfs_reflink_convert_cow( ...@@ -342,7 +341,6 @@ xfs_reflink_convert_cow(
xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count); xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count);
xfs_filblks_t count_fsb = end_fsb - offset_fsb; xfs_filblks_t count_fsb = end_fsb - offset_fsb;
struct xfs_bmbt_irec imap; struct xfs_bmbt_irec imap;
struct xfs_defer_ops dfops;
xfs_fsblock_t first_block = NULLFSBLOCK; xfs_fsblock_t first_block = NULLFSBLOCK;
int nimaps = 1, error = 0; int nimaps = 1, error = 0;
...@@ -352,7 +350,7 @@ xfs_reflink_convert_cow( ...@@ -352,7 +350,7 @@ xfs_reflink_convert_cow(
error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb, error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT | XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
XFS_BMAPI_CONVERT_ONLY, &first_block, 0, &imap, &nimaps, XFS_BMAPI_CONVERT_ONLY, &first_block, 0, &imap, &nimaps,
&dfops); NULL);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
return error; return error;
} }
...@@ -458,8 +456,7 @@ xfs_reflink_allocate_cow( ...@@ -458,8 +456,7 @@ xfs_reflink_allocate_cow(
if (nimaps == 0) if (nimaps == 0)
return -ENOSPC; return -ENOSPC;
convert: convert:
return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb, return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
&dfops);
out_bmap_cancel: out_bmap_cancel:
xfs_defer_cancel(&dfops); xfs_defer_cancel(&dfops);
xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0, xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment