fs: handle FIEMAP_FLAG_SYNC in fiemap_prep

By moving FIEMAP_FLAG_SYNC handling to fiemap_prep we ensure it is
handled once instead of duplicated, but can still be done under fs locks,
like xfs/iomap intended with its duplicate handling.  Also make sure the
error value of filemap_write_and_wait is propagated to user space.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Link: https://lore.kernel.org/r/20200523073016.2944131-8-hch@lst.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Šī revīzija ir iekļauta:
Christoph Hellwig
2020-05-23 09:30:14 +02:00
revīziju iesūtīja Theodore Ts'o
vecāks cddf8a2c4a
revīzija 45dd052e67
10 mainīti faili ar 13 papildinājumiem un 31 dzēšanām

Parādīt failu

@@ -1006,7 +1006,7 @@ int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
unsigned int blkbits = inode->i_blkbits;
int ret, n;
ret = fiemap_prep(inode, fieinfo, start, &len, FIEMAP_FLAG_SYNC);
ret = fiemap_prep(inode, fieinfo, start, &len, 0);
if (ret)
return ret;