xfs: don't pass iomap flags to xfs_reflink_allocate_cow
Don't pass raw iomap flags to xfs_reflink_allocate_cow; signal our intention with a boolean argument. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>hifive-unleashed-5.1
parent
081a8ae2a5
commit
affe250a08
|
@ -983,6 +983,7 @@ xfs_file_iomap_begin(
|
||||||
*/
|
*/
|
||||||
if (xfs_is_cow_inode(ip)) {
|
if (xfs_is_cow_inode(ip)) {
|
||||||
struct xfs_bmbt_irec orig = imap;
|
struct xfs_bmbt_irec orig = imap;
|
||||||
|
bool directio = (flags & IOMAP_DIRECT);
|
||||||
|
|
||||||
/* if zeroing doesn't need COW allocation, then we are done. */
|
/* if zeroing doesn't need COW allocation, then we are done. */
|
||||||
if ((flags & IOMAP_ZERO) &&
|
if ((flags & IOMAP_ZERO) &&
|
||||||
|
@ -991,19 +992,19 @@ xfs_file_iomap_begin(
|
||||||
|
|
||||||
/* may drop and re-acquire the ilock */
|
/* may drop and re-acquire the ilock */
|
||||||
error = xfs_reflink_allocate_cow(ip, &imap, &shared, &lockmode,
|
error = xfs_reflink_allocate_cow(ip, &imap, &shared, &lockmode,
|
||||||
flags);
|
directio);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For buffered writes we need to report the address of the
|
* For buffered writes we need to report the address of the
|
||||||
* previous block (if there was any) so that the higher level
|
* previous block (if there was any) so that the higher level
|
||||||
* write code can perform read-modify-write operations. For
|
* write code can perform read-modify-write operations; we
|
||||||
* direct I/O code, which must be block aligned we need to
|
* won't need the CoW fork mapping until writeback. For direct
|
||||||
* report the newly allocated address.
|
* I/O, which must be block aligned, we need to report the
|
||||||
|
* newly allocated address.
|
||||||
*/
|
*/
|
||||||
if (!(flags & IOMAP_DIRECT) &&
|
if (!directio && orig.br_startblock != HOLESTARTBLOCK)
|
||||||
orig.br_startblock != HOLESTARTBLOCK)
|
|
||||||
imap = orig;
|
imap = orig;
|
||||||
|
|
||||||
end_fsb = imap.br_startoff + imap.br_blockcount;
|
end_fsb = imap.br_startoff + imap.br_blockcount;
|
||||||
|
|
|
@ -361,7 +361,7 @@ xfs_reflink_allocate_cow(
|
||||||
struct xfs_bmbt_irec *imap,
|
struct xfs_bmbt_irec *imap,
|
||||||
bool *shared,
|
bool *shared,
|
||||||
uint *lockmode,
|
uint *lockmode,
|
||||||
unsigned iomap_flags)
|
bool convert_now)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = ip->i_mount;
|
struct xfs_mount *mp = ip->i_mount;
|
||||||
xfs_fileoff_t offset_fsb = imap->br_startoff;
|
xfs_fileoff_t offset_fsb = imap->br_startoff;
|
||||||
|
@ -444,7 +444,7 @@ convert:
|
||||||
* to initiate a disk write. For direct I/O we are going to write the
|
* to initiate a disk write. For direct I/O we are going to write the
|
||||||
* data and need the conversion, but for buffered writes we're done.
|
* data and need the conversion, but for buffered writes we're done.
|
||||||
*/
|
*/
|
||||||
if (!(iomap_flags & IOMAP_DIRECT) || imap->br_state == XFS_EXT_NORM)
|
if (!convert_now || imap->br_state == XFS_EXT_NORM)
|
||||||
return 0;
|
return 0;
|
||||||
trace_xfs_reflink_convert_cow(ip, imap);
|
trace_xfs_reflink_convert_cow(ip, imap);
|
||||||
return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
|
return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool xfs_inode_need_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,
|
||||||
|
|
||||||
extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
|
extern int xfs_reflink_allocate_cow(struct xfs_inode *ip,
|
||||||
struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode,
|
struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode,
|
||||||
unsigned iomap_flags);
|
bool convert_now);
|
||||||
extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
|
extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset,
|
||||||
xfs_off_t count);
|
xfs_off_t count);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue