Skip to contentSkip to conversation

fat: fix writev(), add aio support

PATCH In review Christoph Hellwig 3 participants 3 messages Jan 25, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fat: fix writev(), add aio support

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.

fs/fat/file.c +24 -7
@@ -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 @@
 
 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,
 };
 
maintainer
#1 lore raw
Quoted 5 lines · Christoph Hellwig

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.

The fatfs doesn't have the ->direct_IO(), so the AIO stuff seems to be not useful for now. However, patch itself looks good.

Thanks, I'll submit.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#2 lore raw
Quoted 10 lines · OGAWA Hirofumi
Quoted 5 lines · Christoph Hellwig

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.

The fatfs doesn't have the ->direct_IO(), so the AIO stuff seems to be not useful for now.

I kinda agree. It's usefull

a) to make aio actually work with the aio patch that Suparna keeps
b) make the methods and feature sets uniqueue over all intree filesystems