All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain.net>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Write the inode itself in block_fsync()
Date: Fri, 10 Mar 2006 14:05:53 +1300	[thread overview]
Message-ID: <4410D0F1.3030307@vilain.net> (raw)
In-Reply-To: <87bqwfzixu.fsf@duaron.myhome.or.jp>

OGAWA Hirofumi wrote:

>Hi,
>
>For block device's inode, we don't write a inode's meta data
>itself. But, I think we should write inode's meta data for fsync().
>  
>

Ouch... won't that halve performance of database transaction logs?

>Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
>---
>
> fs/block_dev.c |   16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
>diff -puN fs/block_dev.c~block_fsync-write-inode fs/block_dev.c
>--- linux-2.6/fs/block_dev.c~block_fsync-write-inode	2006-03-05 21:51:15.000000000 +0900
>+++ linux-2.6-hirofumi/fs/block_dev.c	2006-03-05 22:28:28.000000000 +0900
>@@ -19,6 +19,7 @@
> #include <linux/module.h>
> #include <linux/blkpg.h>
> #include <linux/buffer_head.h>
>+#include <linux/writeback.h>
> #include <linux/mpage.h>
> #include <linux/mount.h>
> #include <linux/uio.h>
>@@ -232,7 +233,20 @@ static loff_t block_llseek(struct file *
>  
> static int block_fsync(struct file *filp, struct dentry *dentry, int datasync)
> {
>-	return sync_blockdev(I_BDEV(filp->f_mapping->host));
>+	struct inode *inode = dentry->d_inode;
>+	int ret = 0, err;
>+
>+	if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) {
>+		struct writeback_control wbc = {
>+			.sync_mode = WB_SYNC_ALL,
>+			.nr_to_write = 0,	/* sys_fsync did this */
>+		};
>+		ret = sync_inode(inode, &wbc);
>+	}
>+	err = sync_blockdev(I_BDEV(filp->f_mapping->host));
>+	if (!ret)
>+		ret = err;
>+	return err;
> }
> 
> /*
>_
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>  
>


  reply	other threads:[~2006-03-10  1:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 16:22 [PATCH] Write the inode itself in block_fsync() OGAWA Hirofumi
2006-03-10  1:05 ` Sam Vilain [this message]
2006-03-10  4:10   ` Andrew Morton
2006-03-10 14:12     ` Bart Samwel
2006-03-10 15:18       ` OGAWA Hirofumi
2006-03-10 17:32         ` Bart Samwel

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=4410D0F1.3030307@vilain.net \
    --to=sam@vilain.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.