|
@@ -2487,13 +2487,25 @@ extern int filemap_fdatawrite_range(struct address_space *mapping,
|
|
extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
|
|
extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
|
|
int datasync);
|
|
int datasync);
|
|
extern int vfs_fsync(struct file *file, int datasync);
|
|
extern int vfs_fsync(struct file *file, int datasync);
|
|
-static inline int generic_write_sync(struct kiocb *iocb, loff_t pos, loff_t count)
|
|
|
|
-{
|
|
|
|
- if (!(iocb->ki_flags & IOCB_DSYNC))
|
|
|
|
- return 0;
|
|
|
|
- return vfs_fsync_range(iocb->ki_filp, pos, pos + count - 1,
|
|
|
|
- (iocb->ki_flags & IOCB_SYNC) ? 0 : 1);
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Sync the bytes written if this was a synchronous write. Expect ki_pos
|
|
|
|
+ * to already be updated for the write, and will return either the amount
|
|
|
|
+ * of bytes passed in, or an error if syncing the file failed.
|
|
|
|
+ */
|
|
|
|
+static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count)
|
|
|
|
+{
|
|
|
|
+ if (iocb->ki_flags & IOCB_DSYNC) {
|
|
|
|
+ int ret = vfs_fsync_range(iocb->ki_filp,
|
|
|
|
+ iocb->ki_pos - count, iocb->ki_pos - 1,
|
|
|
|
+ (iocb->ki_flags & IOCB_SYNC) ? 0 : 1);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
|
|
+
|
|
extern void emergency_sync(void);
|
|
extern void emergency_sync(void);
|
|
extern void emergency_remount(void);
|
|
extern void emergency_remount(void);
|
|
#ifdef CONFIG_BLOCK
|
|
#ifdef CONFIG_BLOCK
|