diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2019-02-22 01:26:35 +0100 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-02-25 18:04:31 +0100 |
commit | affe250a085d8230fa44fee1a0b7929a986e7580 (patch) | |
tree | 8c52954fe36046274579c7109a5968a5277d712d /fs/xfs/xfs_iomap.c | |
parent | xfs: fix uninitialized error variable (diff) | |
download | linux-affe250a085d8230fa44fee1a0b7929a986e7580.tar.xz linux-affe250a085d8230fa44fee1a0b7929a986e7580.zip |
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>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 01210eae8bf3..fa6621448d5e 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -983,6 +983,7 @@ xfs_file_iomap_begin( */ if (xfs_is_cow_inode(ip)) { struct xfs_bmbt_irec orig = imap; + bool directio = (flags & IOMAP_DIRECT); /* if zeroing doesn't need COW allocation, then we are done. */ if ((flags & IOMAP_ZERO) && @@ -991,19 +992,19 @@ xfs_file_iomap_begin( /* may drop and re-acquire the ilock */ error = xfs_reflink_allocate_cow(ip, &imap, &shared, &lockmode, - flags); + directio); if (error) goto out_unlock; /* * For buffered writes we need to report the address of the * previous block (if there was any) so that the higher level - * write code can perform read-modify-write operations. For - * direct I/O code, which must be block aligned we need to - * report the newly allocated address. + * write code can perform read-modify-write operations; we + * won't need the CoW fork mapping until writeback. For direct + * I/O, which must be block aligned, we need to report the + * newly allocated address. */ - if (!(flags & IOMAP_DIRECT) && - orig.br_startblock != HOLESTARTBLOCK) + if (!directio && orig.br_startblock != HOLESTARTBLOCK) imap = orig; end_fsb = imap.br_startoff + imap.br_blockcount; |