Lines Matching +full:wait +full:- +full:on +full:- +full:write
1 // SPDX-License-Identifier: GPL-2.0
3 * High-level sync()-related operations
18 #include <linux/backing-dev.h>
25 * Write out and wait upon all dirty data associated with this
37 WARN_ON(!rwsem_is_locked(&sb->s_umount)); in sync_filesystem()
40 * No point in syncing out anything if the filesystem is read-only. in sync_filesystem()
49 * speeds up the wait == 1 case since in that case write_inode() in sync_filesystem()
50 * methods call sync_dirty_buffer() and thus effectively write one block in sync_filesystem()
54 if (sb->s_op->sync_fs) { in sync_filesystem()
55 ret = sb->s_op->sync_fs(sb, 0); in sync_filesystem()
59 ret = __sync_blockdev(sb->s_bdev, 0); in sync_filesystem()
64 if (sb->s_op->sync_fs) { in sync_filesystem()
65 ret = sb->s_op->sync_fs(sb, 1); in sync_filesystem()
69 return __sync_blockdev(sb->s_bdev, 1); in sync_filesystem()
81 if (!sb_rdonly(sb) && !(sb->s_iflags & SB_I_SKIP_SYNC) && in sync_fs_one_sb()
82 sb->s_op->sync_fs) in sync_fs_one_sb()
83 sb->s_op->sync_fs(sb, *(int *)arg); in sync_fs_one_sb()
88 filemap_fdatawrite(bdev->bd_inode->i_mapping); in fdatawrite_one_bdev()
98 filemap_fdatawait_keep_errors(bdev->bd_inode->i_mapping); in fdatawait_one_bdev()
103 * writeback runs on all devices in parallel. Then we sync all inodes reliably
105 * writeback. At this point all data is on disk so metadata should be stable
106 * and we tell filesystems to sync their metadata via ->sync_fs() calls.
108 * just write metadata (such as inodes or bitmaps) to block device page cache
109 * and do not sync it on their own in ->sync_fs().
113 int nowait = 0, wait = 1; in ksys_sync() local
118 iterate_supers(sync_fs_one_sb, &wait); in ksys_sync()
170 return -EBADF; in SYSCALL_DEFINE1()
171 sb = f.file->f_path.dentry->d_sb; in SYSCALL_DEFINE1()
173 down_read(&sb->s_umount); in SYSCALL_DEFINE1()
175 up_read(&sb->s_umount); in SYSCALL_DEFINE1()
177 ret2 = errseq_check_and_advance(&sb->s_wb_err, &f.file->f_sb_err); in SYSCALL_DEFINE1()
184 * vfs_fsync_range - helper to sync a range of data & metadata to disk
190 * Write back data in range @start..@end and metadata for @file to disk. If
196 struct inode *inode = file->f_mapping->host; in vfs_fsync_range()
198 if (!file->f_op->fsync) in vfs_fsync_range()
199 return -EINVAL; in vfs_fsync_range()
200 if (!datasync && (inode->i_state & I_DIRTY_TIME)) in vfs_fsync_range()
202 return file->f_op->fsync(file, start, end, datasync); in vfs_fsync_range()
207 * vfs_fsync - perform a fsync or fdatasync on a file
211 * Write back data and metadata for @file to disk. If @datasync is
223 int ret = -EBADF; in do_fsync()
250 ret = -EINVAL; in sync_file_range()
283 endbyte--; /* inclusive */ in sync_file_range()
285 i_mode = file_inode(file)->i_mode; in sync_file_range()
286 ret = -ESPIPE; in sync_file_range()
291 mapping = file->f_mapping; in sync_file_range()
321 * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is
326 * SYNC_FILE_RANGE_WAIT_BEFORE: wait upon writeout of all pages in the range
327 * before performing the write.
333 * SYNC_FILE_RANGE_WAIT_AFTER: wait upon writeout of all pages in the range
334 * after performing the write.
339 * in the range which were dirty on entry to ksys_sync_file_range() are placed
340 * under writeout. This is a start-write-for-data-integrity operation.
343 * are not presently under writeout. This is an asynchronous flush-to-disk
346 * SYNC_FILE_RANGE_WAIT_BEFORE (or SYNC_FILE_RANGE_WAIT_AFTER): wait for
348 * earlier SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE operation to wait
353 * a traditional sync() operation. This is a write-for-data-integrity operation
354 * which will ensure that all pages in the range which were dirty on entry to
357 * data will be available on disk after a crash.
364 * It should be noted that none of these operations write out the file's
366 * already-instantiated disk blocks, there are no guarantees here that the data
375 ret = -EBADF; in ksys_sync_file_range()