Lines Matching +full:sync +full:- +full:flag
1 // SPDX-License-Identifier: GPL-2.0
3 * High-level sync()-related operations
19 #include <linux/backing-dev.h>
38 WARN_ON(!rwsem_is_locked(&sb->s_umount)); in sync_filesystem()
41 * No point in syncing out anything if the filesystem is read-only. in sync_filesystem()
55 if (sb->s_op->sync_fs) { in sync_filesystem()
56 ret = sb->s_op->sync_fs(sb, 0); in sync_filesystem()
60 ret = sync_blockdev_nowait(sb->s_bdev); in sync_filesystem()
65 if (sb->s_op->sync_fs) { in sync_filesystem()
66 ret = sb->s_op->sync_fs(sb, 1); in sync_filesystem()
70 return sync_blockdev(sb->s_bdev); in sync_filesystem()
82 if (!sb_rdonly(sb) && !(sb->s_iflags & SB_I_SKIP_SYNC) && in sync_fs_one_sb()
83 sb->s_op->sync_fs) in sync_fs_one_sb()
84 sb->s_op->sync_fs(sb, *(int *)arg); in sync_fs_one_sb()
88 * Sync everything. We start by waking flusher threads so that most of
89 * writeback runs on all devices in parallel. Then we sync all inodes reliably
92 * and we tell filesystems to sync their metadata via ->sync_fs() calls.
95 * and do not sync it on their own in ->sync_fs().
111 SYSCALL_DEFINE0(sync) in SYSCALL_DEFINE0() argument
122 * Sync twice to reduce the possibility we skipped some inodes / pages in do_sync_work()
131 printk("Emergency Sync complete\n"); in do_sync_work()
147 * sync a single super
156 return -EBADF; in SYSCALL_DEFINE1()
157 sb = fd_file(f)->f_path.dentry->d_sb; in SYSCALL_DEFINE1()
159 down_read(&sb->s_umount); in SYSCALL_DEFINE1()
161 up_read(&sb->s_umount); in SYSCALL_DEFINE1()
163 ret2 = errseq_check_and_advance(&sb->s_wb_err, &fd_file(f)->f_sb_err); in SYSCALL_DEFINE1()
170 * vfs_fsync_range - helper to sync a range of data & metadata to disk
171 * @file: file to sync
172 * @start: offset in bytes of the beginning of data range to sync
182 struct inode *inode = file->f_mapping->host; in vfs_fsync_range()
184 if (!file->f_op->fsync) in vfs_fsync_range()
185 return -EINVAL; in vfs_fsync_range()
186 if (!datasync && (inode->i_state & I_DIRTY_TIME)) in vfs_fsync_range()
188 return file->f_op->fsync(file, start, end, datasync); in vfs_fsync_range()
193 * vfs_fsync - perform a fsync or fdatasync on a file
194 * @file: file to sync
209 int ret = -EBADF; in do_fsync()
236 ret = -EINVAL; in sync_file_range()
269 endbyte--; /* inclusive */ in sync_file_range()
271 i_mode = file_inode(file)->i_mode; in sync_file_range()
272 ret = -ESPIPE; in sync_file_range()
277 mapping = file->f_mapping; in sync_file_range()
307 * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is
310 * The flag bits are:
322 * Useful combinations of the flag bits are:
326 * under writeout. This is a start-write-for-data-integrity operation.
329 * are not presently under writeout. This is an asynchronous flush-to-disk
339 * a traditional sync() operation. This is a write-for-data-integrity operation
352 * already-instantiated disk blocks, there are no guarantees here that the data
361 ret = -EBADF; in ksys_sync_file_range()