Commit b53beffb authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] fat: fix writev(), add aio support

With Christoph Hellwig <hch@lst.de>

These patches adds the `-o sync' and `-o dirsync' supports to fatfs.  If user
specified that option, the fatfs does traditional ordered updates by using
synchronous writes.  If compared to before, these patches will show a
improvement of robustness I think.

`-o sync'    - writes all buffers out before returning from syscall.
`-o dirsync' - writes the directory's metadata, and unreferencing
               operations of data block.

    remaining to be done
         fat_generic_ioctl(), fat_notify_change(),
	 ATTR_ARCH of fat_xxx_write[v],
	 and probably, filling hole in cont_prepare_write(),

NOTE: Since fatfs doesn't have link-count, unfortunately ->rename() is
not safe order at all.  It may make the shared blocks, but user
shouldn't lose the data by ->rename().

If you test this, please use the dosfstools at

	http://www.zip.com.au/~akpm/linux/patches/stuff/fatfsprogs.tar.bz2

This is fixing several bugs of dosfstools.  And "2/29" patch from hpa adds new
ioctl, the attached archive is also including the commands for testing it.


This patch fixes vectored write support on fat to do the nessecary
non-standard action done in write() aswell.

Also adds aio support and makes read/write wrappers around the aio
version.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f18ceec7
......@@ -12,13 +12,28 @@
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
static ssize_t fat_file_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
static ssize_t fat_file_aio_write(struct kiocb *iocb, const char __user *buf,
size_t count, loff_t pos)
{
struct inode *inode = iocb->ki_filp->f_dentry->d_inode;
int retval;
retval = generic_file_aio_write(iocb, buf, count, pos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
}
return retval;
}
static ssize_t fat_file_writev(struct file *filp, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
int retval;
retval = generic_file_write(filp, buf, count, ppos);
retval = generic_file_writev(filp, iov, nr_segs, ppos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
......@@ -29,12 +44,14 @@ static ssize_t fat_file_write(struct file *filp, const char __user *buf,
struct file_operations fat_file_operations = {
.llseek = generic_file_llseek,
.read = generic_file_read,
.write = fat_file_write,
.read = do_sync_read,
.write = do_sync_write,
.readv = generic_file_readv,
.writev = fat_file_writev,
.aio_read = generic_file_aio_read,
.aio_write = fat_file_aio_write,
.mmap = generic_file_mmap,
.fsync = file_fsync,
.readv = generic_file_readv,
.writev = generic_file_writev,
.sendfile = generic_file_sendfile,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment