sys_sync_file_range()
Subsystems (4)
PATCH 1/1 sys_sync_file_range()
From: Andrew Morton <[email protected]>
Remove the recently-added LINUX_FADV_ASYNC_WRITE and LINUX_FADV_WRITE_WAIT fadvise() additions, do it in a new sys_sync_file_range() syscall instead. Reasons:
- It's more flexible. Things which would require two or three syscalls with fadvise() can be done in a single syscall.
- Using fadvise() in this manner is something not covered by POSIX.
The patch wires up the syscall for x86.
The sycall is implemented in the new fs/sync.c. The intention is that we can move sys_fsync(), sys_fdatasync() and perhaps sys_sync() into there later.
Documentation for the syscall is in fs/sync.c.
A test app (sync_file_range.c) is in
http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz.
Note: the `async' writeout mode SYNC_FILE_RANGE_WRITE will turn synchronous if the queue is congested. This is trivial to fix: add a new flag bit, set wbc->nonblocking. But I'm not sure that we want to expose implementation details down to that level.
Note: it's notable that we can sync an fd which wasn't opened for writing. Same with fsync() and fdatasync()).
Note: the code takes some care to handle attempts to sync file contents outside the 16TB offset on 32-bit machines. It makes such attempts appears to succeed, for best 32-bit/64-bit compatibility. Perhaps it should make such requests fail...
---
arch/i386/kernel/syscall_table.S | 1 fs/Makefile | 2 fs/sync.c | 147 +++++++++++++++++++++++++++++ include/asm-i386/unistd.h | 3 include/linux/fadvise.h | 6 - include/linux/fs.h | 5 include/linux/syscalls.h | 2 mm/fadvise.c | 20 --- 8 files changed, 158 insertions(+), 28 deletions(-)
mm/fadvise.c renamed from mm/fadvise.c~sys_sync_file_range +0 -20
@@ -35,17 +35,6 @@* * LINUX_FADV_ASYNC_WRITE: push some or all of the dirty pages at the disk. * -* LINUX_FADV_WRITE_WAIT, LINUX_FADV_ASYNC_WRITE: push all of the currently -* dirty pages at the disk. -* -* LINUX_FADV_WRITE_WAIT, LINUX_FADV_ASYNC_WRITE, LINUX_FADV_WRITE_WAIT: push -* all of the currently dirty pages at the disk, wait until they have been -* written. -* -* It should be noted that none of these operations write out the file's -* metadata. So unless the application is strictly performing overwrites of -* already-instantiated disk blocks, there are no guarantees here that the data -* will be available after a crash. */ asmlinkage long sys_fadvise64_64 (int fd,loff_t offset,loff_t len,int advice) {
@@ -129,15 +118,6 @@ asmlinkage long sys_fadvise64_64(int fd,invalidate_mapping_pages (mapping, start_index, end_index);break ; -case LINUX_FADV_ASYNC_WRITE : - ret =__filemap_fdatawrite_range (mapping, offset, endbyte, -WB_SYNC_NONE ); -break ; -case LINUX_FADV_WRITE_WAIT : - ret =wait_on_page_writeback_range (mapping, - offset >>PAGE_CACHE_SHIFT , - endbyte >>PAGE_CACHE_SHIFT ); -break ;default : ret = -EINVAL ; }
include/linux/fadvise.h renamed from include/linux/fadvise.h~sys_sync_file_range +0 -6
@@ -18,10 +18,4 @@#define POSIX_FADV_NOREUSE 5/* Data will be accessed once. */ #endif -/* -* Linux-specific fadvise() extensions: -*/ -#define LINUX_FADV_ASYNC_WRITE 32/* Start writeout on range */ -#define LINUX_FADV_WRITE_WAIT 33/* Wait upon writeout to range */ -#endif /* FADVISE_H_INCLUDED */
fs/sync.c new file +147 -0
147 lines not on this page · raw message
include/linux/syscalls.h renamed from include/linux/syscalls.h~sys_sync_file_range +2 -0
@@ -569,5 +569,7 @@ asmlinkage long compat_sys_newfstatat(unasmlinkage long compat_sys_openat (unsigned int dfd,const char __user *filename,int flags,int mode);asmlinkage long sys_unshare (unsigned long unshare_flags); +asmlinkage long sys_sync_file_range (int fd,loff_t offset,loff_t nbytes, +int flags);#endif
include/linux/fs.h renamed from include/linux/fs.h~sys_sync_file_range +5 -0
@@ -757,6 +757,11 @@ extern void send_sigio(struct fown_strucextern int fcntl_setlease (unsigned int fd,struct file *filp,long arg);extern int fcntl_getlease (struct file *filp); +/* fs/sync.c */ +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 +/* fs/locks.c */ extern void locks_init_lock (struct file_lock *);extern void locks_copy_lock (struct file_lock *,struct file_lock *);
fs/Makefile renamed from fs/Makefile~sys_sync_file_range +1 -1
@@ -10,7 +10,7 @@ obj-y := open.o read_write.o file_table. ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \ - ioprio.o pnode.o drop_caches.o + ioprio.o pnode.o drop_caches.o sync.o obj-$(CONFIG_INOTIFY) += inotify.o obj-$(CONFIG_EPOLL) += eventpoll.o
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h~sys_sync_file_range +2 -1
@@ -318,8 +318,9 @@#define __NR_unshare 310#define __NR_set_robust_list 311#define __NR_get_robust_list 312 +#define __NR_sys_sync_file_range 313 -#define NR_syscalls 313 +#define NR_syscalls 314/* * user-visible error numbers are in the range -1 - -128: see
arch/i386/kernel/syscall_table.S renamed from arch/i386/kernel/syscall_table.S~sys_sync_file_range +1 -0
@@ -312,3 +312,4 @@ ENTRY(sys_call_table) .long sys_unshare /* 310 */ .long sys_set_robust_list .long sys_get_robust_list + .long sys_sync_file_range
_
Quoted 6 lines · On Wednesday March 29, [email protected] wrote:
From: Andrew Morton <[email protected]>
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.
Hmmm... any chance this could be split into a sys_sync_file_range and a vfs_sync_file_range which takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?
Currently I implement COMMIT (which has a range) with a by messing around with filemap_fdatawrite and filemap_fdatawait (ignoring the range) and I'd rather than a vfs helper.
And in nfsd I call filp->f_op->fsync between the two. Doesn't sys_sync_file_range need to call into the filesystem at all?
NeilBrown
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
From: Andrew Morton <[email protected]>
Quoted 7 lines
Quoted 3 lines
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?
Coming right up. (Will switch it to fget_light() too)
Quoted 6 lines
Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.And in nfsd I call
filp->f_op->fsyncbetween the two. Doesn'tsys_sync_file_rangeneed to call into the filesystem at all?
Interesting question. sync_file_range() is purely a pagecache (ie: file contents) operation. It doesn't touch metadata at all.
So if it's being used for data-integrity purposes then it really only makes sense when it's doing file overwrites.
It does call into the filesystem of course - a_ops.writepages() and perhaps a_ops.writepage().
Quoted 4 lines · Neil Brown
Hmmm... any chance this could be split into a
sys_sync_file_rangeand
avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?
Problem is, we don't appear to have a way of syncing the file's metadata without also syncing all of its pagecache.
For example, ext3_sync_file() will run a commit, which will sync all data and metadata.
ext2_sync_file() will also sync all pagecache as well as metadata. Even though do_fsync() already synced the file data (!).
Is the below still useful?
mm/fadvise.c renamed from mm/fadvise.c~sys_sync_file_range +0 -20
@@ -35,17 +35,6 @@* * LINUX_FADV_ASYNC_WRITE: push some or all of the dirty pages at the disk. * -* LINUX_FADV_WRITE_WAIT, LINUX_FADV_ASYNC_WRITE: push all of the currently -* dirty pages at the disk. -* -* LINUX_FADV_WRITE_WAIT, LINUX_FADV_ASYNC_WRITE, LINUX_FADV_WRITE_WAIT: push -* all of the currently dirty pages at the disk, wait until they have been -* written. -* -* It should be noted that none of these operations write out the file's -* metadata. So unless the application is strictly performing overwrites of -* already-instantiated disk blocks, there are no guarantees here that the data -* will be available after a crash. */ asmlinkage long sys_fadvise64_64 (int fd,loff_t offset,loff_t len,int advice) {
@@ -129,15 +118,6 @@ asmlinkage long sys_fadvise64_64(int fd,invalidate_mapping_pages (mapping, start_index, end_index);break ; -case LINUX_FADV_ASYNC_WRITE : - ret =__filemap_fdatawrite_range (mapping, offset, endbyte, -WB_SYNC_NONE ); -break ; -case LINUX_FADV_WRITE_WAIT : - ret =wait_on_page_writeback_range (mapping, - offset >>PAGE_CACHE_SHIFT , - endbyte >>PAGE_CACHE_SHIFT ); -break ;default : ret = -EINVAL ; }
include/linux/fadvise.h renamed from include/linux/fadvise.h~sys_sync_file_range +0 -6
@@ -18,10 +18,4 @@#define POSIX_FADV_NOREUSE 5/* Data will be accessed once. */ #endif -/* -* Linux-specific fadvise() extensions: -*/ -#define LINUX_FADV_ASYNC_WRITE 32/* Start writeout on range */ -#define LINUX_FADV_WRITE_WAIT 33/* Wait upon writeout to range */ -#endif /* FADVISE_H_INCLUDED */
fs/sync.c new file +163 -0
163 lines not on this page · raw message
include/linux/syscalls.h renamed from include/linux/syscalls.h~sys_sync_file_range +2 -0
@@ -569,5 +569,7 @@ asmlinkage long compat_sys_newfstatat(unasmlinkage long compat_sys_openat (unsigned int dfd,const char __user *filename,int flags,int mode);asmlinkage long sys_unshare (unsigned long unshare_flags); +asmlinkage long sys_sync_file_range (int fd,loff_t offset,loff_t nbytes, +int flags);#endif
include/linux/fs.h renamed from include/linux/fs.h~sys_sync_file_range +7 -0
@@ -757,6 +757,13 @@ extern void send_sigio(struct fown_strucextern int fcntl_setlease (unsigned int fd,struct file *filp,long arg);extern int fcntl_getlease (struct file *filp); +/* fs/sync.c */ +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 +#define SYNC_FILE_RANGE_WRITE 2 +#define SYNC_FILE_RANGE_WAIT_AFTER 4 +extern int do_sync_file_range (struct file *file,loff_t offset,loff_t endbyte, +int flags); +/* fs/locks.c */ extern void locks_init_lock (struct file_lock *);extern void locks_copy_lock (struct file_lock *,struct file_lock *);
fs/Makefile renamed from fs/Makefile~sys_sync_file_range +1 -1
@@ -10,7 +10,7 @@ obj-y := open.o read_write.o file_table. ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \ - ioprio.o pnode.o drop_caches.o + ioprio.o pnode.o drop_caches.o sync.o obj-$(CONFIG_INOTIFY) += inotify.o obj-$(CONFIG_EPOLL) += eventpoll.o
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h~sys_sync_file_range +2 -1
@@ -318,8 +318,9 @@#define __NR_unshare 310#define __NR_set_robust_list 311#define __NR_get_robust_list 312 +#define __NR_sys_sync_file_range 313 -#define NR_syscalls 313 +#define NR_syscalls 314/* * user-visible error numbers are in the range -1 - -128: see
arch/i386/kernel/syscall_table.S renamed from arch/i386/kernel/syscall_table.S~sys_sync_file_range +1 -0
@@ -312,3 +312,4 @@ ENTRY(sys_call_table) .long sys_unshare /* 310 */ .long sys_set_robust_list .long sys_get_robust_list + .long sys_sync_file_range
_
Quoted 9 lines · On Thursday March 30, [email protected] wrote:
Quoted 4 lines · Neil Brown
Hmmm... any chance this could be split into a
sys_sync_file_rangeand
avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Problem is, we don't appear to have a way of syncing the file's metadata without also syncing all of its pagecache.
Quoted 8 lines
For example,
ext3_sync_file()will run a commit, which will sync all data and metadata.
ext2_sync_file()will also sync all pagecache as well as metadata. Even thoughdo_fsync()already synced the file data (!).Is the below still useful?
Yes. A COMMIT can say NFS_DATA_SYNC or NFS_FILE_SYNC. I can skip the ->fsync call for NFS_DATA_SYNC which is hopefully the more common. I didn't before because when I was righting that (2.4 days) there were a lot fewer options on how to sync things.
So yes, that will be perfect, thanks.
NeilBrown
fs/sync.c line 80
Quoted 4 lines · Andrew Morton
fs/sync.c new file +4
-0+if ((s64 )offset <0 ) + goto out; +if ((s64 )endbyte <0 ) + goto out;
loff_t is long long on all arch. This is not need?
fs/sync.c line 115
Quoted 4 lines
fs/sync.c new file +4
-0+if (S_ISFIFO (file->f_dentry->d_inode->i_mode)) { + ret = -ESPIPE ; + goto out_put; + }
How about to check "if (!file->f_op || !file->f_op->fsync)" or something?
For chrdev is also strange, and in the case of fsync(), it returns -EINVAL. IMHO it seems there is consistency.
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 9 lines · OGAWA Hirofumi
fs/sync.c line 80
Quoted 4 lines · Andrew Morton
fs/sync.c new file +4
-0+if ((s64 )offset <0 ) + goto out; +if ((s64 )endbyte <0 ) + goto out;
loff_tis long long on all arch. This is not need?
True, the casts happen to be unneeded. But they do set the reader's mind at ease.
Quoted 6 lines
fs/sync.c line 115
Quoted 4 lines
fs/sync.c new file +4
-0+if (S_ISFIFO (file->f_dentry->d_inode->i_mode)) { + ret = -ESPIPE ; + goto out_put; + }How about to check "if (!file->f_op || !file->f_op->fsync)" or something?
This syscall won't call ->fsync.
Quoted 3 lines
For chrdev is also strange, and in the case of
fsync(), it returns-EINVAL. IMHO it seems there is consistency.
I guess so. Perhaps it should be S_ISREG|S_ISBLK|S_ISDIR|S_ISLNK.
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.
Quoted 7 lines
Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.
I'm not 100% sure, but it looks like the PF_SYNCWRITE process flag should be set on the nfsd's while they're doing that, which doesn't seem to be happening atm. Looks like a couple of the IO schedulers will make use of that knowledge now. All the more reason for a VFS helper here I guess. ;)
cheers.
Signature · 21 lines
Nathan Index: 2.6.x-xfs/fs/nfsd/vfs.c =================================================================== --- 2.6.x-xfs.orig/fs/nfsd/vfs.c +++ 2.6.x-xfs/fs/nfsd/vfs.c @@ -712,11 +712,13 @@ static inline int nfsd_dosync(struct fil int (*fsync) (struct file *, struct dentry *, int); int err; + current->flags |= PF_SYNCWRITE; err = filemap_fdatawrite(inode->i_mapping); if (err == 0 && fop && (fsync = fop->fsync)) err = fsync(filp, dp, 0); if (err == 0) err = filemap_fdatawait(inode->i_mapping); + current->flags &= ~PF_SYNCWRITE; return err; }
Quoted 14 lines · On Friday March 31, [email protected] wrote:
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.Quoted 7 lines
Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.
Quoted 5 lines
I'm not 100% sure, but it looks like the
PF_SYNCWRITEprocess flag should be set on the nfsd's while they're doing that, which doesn't seem to be happening atm. Looks like a couple of the IO schedulers will make use of that knowledge now. All the more reason for a VFS helper here I guess. ;)
PF_SYNCWRITE? What's that???
(find | xargs grep ...)
Oh. The block device schedulers like to know if a request is sync or async (and all reads are assumed to be sync) - which is reasonable - and so have a per-task flag to tell them - which isn't (IMO).
md/raid (particularly raid5) often does the write from a different process than generated the original request, so that will break completely.
What is wrong with a bio flag I wonder....
Hopefully this will get wrapped up in a do_X helper so nfsd won't need to know about it.
Thanks for the heads-up.
NeilBrown
Quoted 23 lines · Neil Brown
Quoted 14 lines · On Friday March 31, [email protected] wrote:
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.Quoted 7 lines
Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.Quoted 5 lines
I'm not 100% sure, but it looks like the
PF_SYNCWRITEprocess flag should be set on the nfsd's while they're doing that, which doesn't seem to be happening atm. Looks like a couple of the IO schedulers will make use of that knowledge now. All the more reason for a VFS helper here I guess. ;)
PF_SYNCWRITE? What's that???
Quoted 8 lines
(find | xargs grep ...)
Oh. The block device schedulers like to know if a request is sync or async (and all reads are assumed to be sync) - which is reasonable - and so have a per-task flag to tell them - which isn't (IMO).md/raid (particularly raid5) often does the write from a different process than generated the original request, so that will break completely.
I don't think any disagrees with you, the sync-write process flag is indeed an atrocious beast...
Quoted 1 line
What is wrong with a bio flag I wonder....
Nothing, in fact I would love for it to be changed. I'm sure such a patch would be accepted with open arms! :-)
Signature · 1 line
Jens Axboe
Quoted 30 lines · Jens Axboe
Quoted 28 lines · Neil Brown
Quoted 14 lines · On Friday March 31, [email protected] wrote:
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.Quoted 7 lines
Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.Quoted 5 lines
I'm not 100% sure, but it looks like the
PF_SYNCWRITEprocess flag should be set on the nfsd's while they're doing that, which doesn't seem to be happening atm. Looks like a couple of the IO schedulers will make use of that knowledge now. All the more reason for a VFS helper here I guess. ;)
PF_SYNCWRITE? What's that???(find | xargs grep ...)
Oh. The block device schedulers like to know if a request is sync or async (and all reads are assumed to be sync) - which is reasonable - and so have a per-task flag to tell them - which isn't (IMO).
Quoted 6 lines
Quoted 3 lines
md/raid (particularly raid5) often does the write from a different process than generated the original request, so that will break completely.
I don't think any disagrees with you, the sync-write process flag is indeed an atrocious beast...
Yeah. PF_SYNCWRITE was a performance tweak for the anticipatory scheduler. As cfq is using it as well now (hopefully to good effect) I guess it could be formalised more.
Quoted 4 lines
Quoted 1 line
What is wrong with a bio flag I wonder....
Nothing, in fact I would love for it to be changed. I'm sure such a patch would be accepted with open arms! :-)
I think once someone starts coding it, they'll become a big fan of PF_SYNCWRITE...
For the page writeback functions it's probably possible to use writeback_control.sync_mode=WB_SYNC_ALL as a trigger, propagate that into the IO layer. Maybe that'll always be sufficient - it's hard to tell. The writeback paths are twisty and deep...
Then again, using WB_SYNC_ALL as a hint that this process will be waiting for this writeout to complete is a bit hacky too - it doesn't _really_ mean that - it just means that I/O should be _started_ against all relevant dirty data.
Good luck ;)
Quoted 35 lines · Andrew Morton
Quoted 34 lines · Jens Axboe
Quoted 31 lines · Neil Brown
Quoted 14 lines · On Friday March 31, [email protected] wrote:
Quoted 5 lines · Neil Brown
Quoted 3 lines · On Wednesday March 29, [email protected] wrote:
Remove the recently-added
LINUX_FADV_ASYNC_WRITEandLINUX_FADV_WRITE_WAITfadvise()additions, do it in a newsys_sync_file_range()syscall instead.Quoted 7 lines
Hmmm... any chance this could be split into a
sys_sync_file_rangeand avfs_sync_file_rangewhich takes a 'struct file*' and does less (or no) sanity checking, so I can call it from nfsd?Currently I implement COMMIT (which has a range) with a by messing around with
filemap_fdatawriteandfilemap_fdatawait(ignoring the range) and I'd rather than a vfs helper.Quoted 5 lines
I'm not 100% sure, but it looks like the
PF_SYNCWRITEprocess flag should be set on the nfsd's while they're doing that, which doesn't seem to be happening atm. Looks like a couple of the IO schedulers will make use of that knowledge now. All the more reason for a VFS helper here I guess. ;)
PF_SYNCWRITE? What's that???(find | xargs grep ...)
Oh. The block device schedulers like to know if a request is sync or async (and all reads are assumed to be sync) - which is reasonable - and so have a per-task flag to tell them - which isn't (IMO).md/raid (particularly raid5) often does the write from a different process than generated the original request, so that will break completely.
Quoted 6 lines
Quoted 2 lines
I don't think any disagrees with you, the sync-write process flag is indeed an atrocious beast...
Yeah.
PF_SYNCWRITEwas a performance tweak for the anticipatory scheduler. As cfq is using it as well now (hopefully to good effect) I guess it could be formalised more.
Yup, both 'as' and 'cfq' would prefer to just look at a SYNC bio flag instead. But the logic itself is definitely needed.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
What is wrong with a bio flag I wonder....
Nothing, in fact I would love for it to be changed. I'm sure such a patch would be accepted with open arms! :-)
I think once someone starts coding it, they'll become a big fan of
PF_SYNCWRITE...
They might not become a big fan, but they'll surely appreciate the simplicity of it :-)
Quoted 11 lines
For the page writeback functions it's probably possible to use writeback_control.sync_mode=WB_SYNC_ALL as a trigger, propagate that into the IO layer. Maybe that'll always be sufficient - it's hard to tell. The writeback paths are twisty and deep...
Then again, using
WB_SYNC_ALLas a hint that this process will be waiting for this writeout to complete is a bit hacky too - it doesn't _really_ mean that - it just means that I/O should be _started_ against all relevant dirty data.Good luck ;)
It's not a hard problem, but it will definitely cost a little sweat to go through. I'm sure Neil could pull it off, the question is more if he wants to :-)
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 7 lines
Quoted 3 lines
I don't think any disagrees with you, the sync-write process flag is indeed an atrocious beast...
Yeah.
PF_SYNCWRITEwas a performance tweak for the anticipatory scheduler. As cfq is using it as well now (hopefully to good effect) I guess it could be formalised more.Yup, both 'as' and 'cfq' would prefer to just look at a SYNC bio flag instead. But the logic itself is definitely needed.
hm. I actually thought we were already doing that. We should at least tranfer PF_SYNCWRITE into bi_flags at the point where we start to construct the BIO.
That might well fix RAID, too. If it's handing work off to another thread via BIOs.
include/asm-i386/unistd.h line 321
Quoted 5 lines · On Wed, Mar 29, 2006 at 11:41:11PM -0800, [email protected] wrote:
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h~sys_sync_file_range +1
-0@@ -318,8 +318,9 @@#define __NR_unshare 310#define __NR_set_robust_list 311#define __NR_get_robust_list 312 +#define __NR_sys_sync_file_range 313
What's up with the __NR_sys_yada_yada? Except for recent entries (kexec, splice, and now sync_file_range) all of the other names in here have dropped the "sys_".
Is it too late to fix __NR_sys_kexec_load (since it is out in the wild now?)
-Tony
Quoted 11 lines · Tony
Review line 321
Quoted 5 lines · On Wed, Mar 29, 2006 at 11:41:11PM -0800, [email protected] wrote:
(quoted diff) +1
-0@@ -318,8 +318,9 @@ #define __NR_unshare 310 #define __NR_set_robust_list 311 #define __NR_get_robust_list 312 +#define __NR_sys_sync_file_range 313What's up with the
__NR_sys_yada_yada? Except for recent entries (kexec, splice, and nowsync_file_range) all of the other names in here have dropped the "sys_".
Quoted 2 lines
Is it too late to fix
__NR_sys_kexec_load(since it is out in the wild now?)
already been done: (copy-n-paste warning here:)
~~~~~
On i386, we don't use sys_ prefix for __NR_*. This patch removes it. [FWIW, _syscall*() macros will generate foo() instead of sys_foo().]
---
include/asm-i386/unistd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h~remove-sys_-prefix +2 -2
@@ -318,8 +318,8 @@#define __NR_unshare 310#define __NR_set_robust_list 311#define __NR_get_robust_list 312 -#define __NR_sys_splice 313 -#define __NR_sys_sync_file_range 314 +#define __NR_splice 313 +#define __NR_sync_file_range 314#define NR_syscalls 315
---
~Randy
Quoted 9 lines · Tony
include/asm-i386/unistd.h line 321
Quoted 5 lines · On Wed, Mar 29, 2006 at 11:41:11PM -0800, [email protected] wrote:
include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h~sys_sync_file_range +1
-0@@ -318,8 +318,9 @@#define __NR_unshare 310#define __NR_set_robust_list 311#define __NR_get_robust_list 312 +#define __NR_sys_sync_file_range 313What's up with the
__NR_sys_yada_yada?
brainfart. sync_file_range() and splice() will get fixed once Linus resurfaces.
Quoted 6 lines
Except for recent entries (kexec,
splice, and nowsync_file_range) all of the other names in here have dropped the "sys_".Is it too late to fix
__NR_sys_kexec_load(since it is out in the wild now?)
It only affects users of the _syscallN macros in unistd.h. I don't expect that fixing kexec will break much.
Quoted 2 lines · Tony
Is it too late to fix
__NR_sys_kexec_load(since it is out in the wild now?)
It's not too late IMO. The only real users are the libcs. And in fact, I'm already checking for __NR_sync_file_range and not the sys_ variant.
Andrew, please change it.
Signature · 1 line
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖