Skip to content

Commit 472c6e4

Browse files
Dave ChinnerDarrick J. Wong
authored andcommitted
xfs: remove XFS_PREALLOC_SYNC
Callers can acheive the same thing by calling xfs_log_force_inode() after making their modifications. There is no need for xfs_update_prealloc_flags() to do this. Signed-off-by: Dave Chinner <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 29d650f commit 472c6e4

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

fs/xfs/xfs_file.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ xfs_update_prealloc_flags(
9595
ip->i_diflags &= ~XFS_DIFLAG_PREALLOC;
9696

9797
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
98-
if (flags & XFS_PREALLOC_SYNC)
99-
xfs_trans_set_sync(tp);
10098
return xfs_trans_commit(tp);
10199
}
102100

@@ -1057,9 +1055,6 @@ xfs_file_fallocate(
10571055
}
10581056
}
10591057

1060-
if (file->f_flags & O_DSYNC)
1061-
flags |= XFS_PREALLOC_SYNC;
1062-
10631058
error = xfs_update_prealloc_flags(ip, flags);
10641059
if (error)
10651060
goto out_unlock;
@@ -1082,8 +1077,14 @@ xfs_file_fallocate(
10821077
* leave shifted extents past EOF and hence losing access to
10831078
* the data that is contained within them.
10841079
*/
1085-
if (do_file_insert)
1080+
if (do_file_insert) {
10861081
error = xfs_insert_file_space(ip, offset, len);
1082+
if (error)
1083+
goto out_unlock;
1084+
}
1085+
1086+
if (file->f_flags & O_DSYNC)
1087+
error = xfs_log_force_inode(ip);
10871088

10881089
out_unlock:
10891090
xfs_iunlock(ip, iolock);

fs/xfs/xfs_inode.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,7 @@ xfs_itruncate_extents(
465465
enum xfs_prealloc_flags {
466466
XFS_PREALLOC_SET = (1 << 1),
467467
XFS_PREALLOC_CLEAR = (1 << 2),
468-
XFS_PREALLOC_SYNC = (1 << 3),
469-
XFS_PREALLOC_INVISIBLE = (1 << 4),
468+
XFS_PREALLOC_INVISIBLE = (1 << 3),
470469
};
471470

472471
int xfs_update_prealloc_flags(struct xfs_inode *ip,

fs/xfs/xfs_pnfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ xfs_fs_map_blocks(
164164
* that the blocks allocated and handed out to the client are
165165
* guaranteed to be present even after a server crash.
166166
*/
167-
error = xfs_update_prealloc_flags(ip,
168-
XFS_PREALLOC_SET | XFS_PREALLOC_SYNC);
167+
error = xfs_update_prealloc_flags(ip, XFS_PREALLOC_SET);
168+
if (!error)
169+
error = xfs_log_force_inode(ip);
169170
if (error)
170171
goto out_unlock;
172+
171173
} else {
172174
xfs_iunlock(ip, lock_flags);
173175
}

0 commit comments

Comments
 (0)