mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Machida, Hiroyuki" <machida@sm.sony.co.jp>
To: hirofumi@mail.parknet.co.jp
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2][FAT] miss-sync issues on sync mount (miss-sync on write)
Date: Thu, 15 Sep 2005 05:34:44 +0900	[thread overview]
Message-ID: <43288964.7020307@sm.sony.co.jp> (raw)

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

This patch fixes miss-sync issue on write() system call.
This updates inode attrs flags, mtime and ctime on every
comit_write call, due to locking.

---
Hiroyuki Machida


[-- Attachment #2: fat-sync-write.patch --]
[-- Type: text/plain, Size: 2467 bytes --]

Signed-off-by: Hiroyuki Machida <machida@sm.sony.co.jp>
 ---

 file.c  |   20 +-------------------
 inode.c |   21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 20 deletions(-)


--- linux-2.6.13.org/fs/fat/inode.c	2005-08-29 08:41:01.000000000 +0900
+++ linux-2.6.13/fs/fat/inode.c	2005-09-09 17:22:44.305189111 +0900
@@ -107,12 +107,31 @@ static sector_t _fat_bmap(struct address
 	return generic_block_bmap(mapping, block, fat_get_block);
 }
 
+static int fat_commit_write(struct file *file, struct page *page,
+		unsigned from, unsigned to)
+{
+	struct inode *inode = page->mapping->host;
+	loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
+	block_commit_write(page,from,to);
+	/*
+	 * No need to use i_size_read() here, the i_size
+	 * cannot change under us because we hold i_sem.
+	 */
+	if (pos > inode->i_size) {
+		i_size_write(inode, pos);
+	}
+	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
+	mark_inode_dirty(inode);
+	return 0;
+}
+
 static struct address_space_operations fat_aops = {
 	.readpage	= fat_readpage,
 	.writepage	= fat_writepage,
 	.sync_page	= block_sync_page,
 	.prepare_write	= fat_prepare_write,
-	.commit_write	= generic_commit_write,
+	.commit_write	= fat_commit_write,
 	.bmap		= _fat_bmap
 };
 
--- linux-2.6.13.org/fs/fat/file.c	2005-08-29 08:41:01.000000000 +0900
+++ linux-2.6.13/fs/fat/file.c	2005-09-08 17:13:03.000000000 +0900
@@ -12,24 +12,6 @@
 #include <linux/smp_lock.h>
 #include <linux/buffer_head.h>
 
-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);
-//		check the locking rules
-//		if (IS_SYNC(inode))
-//			fat_sync_inode(inode);
-	}
-	return retval;
-}
-
 static ssize_t fat_file_writev(struct file *filp, const struct iovec *iov,
 			       unsigned long nr_segs, loff_t *ppos)
 {
@@ -150,7 +132,7 @@ struct file_operations fat_file_operatio
 	.readv		= generic_file_readv,
 	.writev		= fat_file_writev,
 	.aio_read	= generic_file_aio_read,
-	.aio_write	= fat_file_aio_write,
+	.aio_write	= generic_file_aio_write,
 	.mmap		= generic_file_mmap,
 	.ioctl		= fat_generic_ioctl,
 	.fsync		= file_fsync,

             reply	other threads:[~2005-09-14 20:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-14 20:34 Machida, Hiroyuki [this message]
2005-09-15  2:48 ` Andrew Morton
2005-09-15 12:43   ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43288964.7020307@sm.sony.co.jp \
    --to=machida@sm.sony.co.jp \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®