File tree Expand file tree Collapse file tree 2 files changed +8
-21
lines changed
Expand file tree Collapse file tree 2 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -848,6 +848,14 @@ xfs_free_file_space(
848848 if (len <= 0 ) /* if nothing being freed */
849849 return 0 ;
850850
851+ /*
852+ * Now AIO and DIO has drained we flush and (if necessary) invalidate
853+ * the cached range over the first operation we are about to run.
854+ */
855+ error = xfs_flush_unmap_range (ip , offset , len );
856+ if (error )
857+ return error ;
858+
851859 startoffset_fsb = XFS_B_TO_FSB (mp , offset );
852860 endoffset_fsb = XFS_B_TO_FSBT (mp , offset + len );
853861
Original file line number Diff line number Diff line change @@ -890,27 +890,6 @@ xfs_file_fallocate(
890890 */
891891 inode_dio_wait (inode );
892892
893- /*
894- * Now AIO and DIO has drained we flush and (if necessary) invalidate
895- * the cached range over the first operation we are about to run.
896- *
897- * We care about zero and collapse here because they both run a hole
898- * punch over the range first. Because that can zero data, and the range
899- * of invalidation for the shift operations is much larger, we still do
900- * the required flush for collapse in xfs_prepare_shift().
901- *
902- * Insert has the same range requirements as collapse, and we extend the
903- * file first which can zero data. Hence insert has the same
904- * flush/invalidate requirements as collapse and so they are both
905- * handled at the right time by xfs_prepare_shift().
906- */
907- if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE |
908- FALLOC_FL_COLLAPSE_RANGE )) {
909- error = xfs_flush_unmap_range (ip , offset , len );
910- if (error )
911- goto out_unlock ;
912- }
913-
914893 error = file_modified (file );
915894 if (error )
916895 goto out_unlock ;
You can’t perform that action at this time.
0 commit comments