From: Colin Leroy <colin@colino.net>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] let fat handle MS_SYNCHRONOUS flag
Date: Wed, 24 Nov 2004 21:28:11 +0100 [thread overview]
Message-ID: <20041124212811.4d8b121e@jack.colino.net> (raw)
In-Reply-To: <87d5y3w21j.fsf@devron.myhome.or.jp>
On 25 Nov 2004 at 03h11, OGAWA Hirofumi wrote:
Hi,
> int fat_sync_inode(struct inode *inode)
> {
> return fat_write_inode(inode, 1);
> }
Thanks for the hint. Here's a third patch.
Signed-off-by: Colin Leroy <colin@colino.net>
--- a/fs/fat/dir.c 2004-11-24 15:57:17.000000000 +0100
+++ fs/fat/dir.c 2004-11-24 21:21:51.783396408 +0100
@@ -760,10 +760,16 @@
de[1].start = cpu_to_le16(MSDOS_I(parent)->i_logstart);
de[1].starthi = cpu_to_le16(MSDOS_I(parent)->i_logstart>>16);
mark_buffer_dirty(bh);
- brelse(bh);
dir->i_atime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
mark_inode_dirty(dir);
+ if (dir->i_sb->s_flags & MS_SYNCHRONOUS) {
+ sync_dirty_buffer(bh);
+ fat_sync_inode(dir);
+ }
+
+ brelse(bh);
+
return 0;
}
--- a/fs/fat/fatfs_syms.c 2004-11-24 15:57:17.000000000 +0100
+++ fs/fat/fatfs_syms.c 2004-11-24 21:05:18.665605752 +0100
@@ -19,6 +19,7 @@
EXPORT_SYMBOL(fat_detach);
EXPORT_SYMBOL(fat_build_inode);
EXPORT_SYMBOL(fat_fill_super);
+EXPORT_SYMBOL(fat_sync_inode);
EXPORT_SYMBOL(fat_search_long);
EXPORT_SYMBOL(fat_scan);
EXPORT_SYMBOL(fat_add_entries);
--- a/fs/fat/file.c 2004-10-18 23:53:44.000000000 +0200
+++ fs/fat/file.c 2004-11-24 21:06:56.271767360 +0100
@@ -74,18 +74,22 @@
{
struct inode *inode = filp->f_dentry->d_inode;
int retval;
+ struct super_block *sb = inode->i_sb;
retval = generic_file_write(filp, buf, count, ppos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
+ if (sb->s_flags & MS_SYNCHRONOUS)
+ fat_sync_inode(inode);
}
return retval;
}
void fat_truncate(struct inode *inode)
{
+ struct super_block *sb = inode->i_sb;
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
const unsigned int cluster_size = sbi->cluster_size;
int nr_clusters;
@@ -105,4 +109,6 @@
unlock_kernel();
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
mark_inode_dirty(inode);
+ if (sb->s_flags & MS_SYNCHRONOUS)
+ fat_sync_inode(inode);
}
--- a/fs/fat/inode.c 2004-11-24 15:57:17.000000000 +0100
+++ fs/fat/inode.c 2004-11-24 21:04:23.031063488 +0100
@@ -1224,6 +1224,11 @@
return 0;
}
+int fat_sync_inode(struct inode *inode)
+{
+ return fat_write_inode(inode, 1);
+}
+
static int fat_write_inode(struct inode *inode, int wait)
{
struct super_block *sb = inode->i_sb;
@@ -1273,8 +1278,12 @@
}
spin_unlock(&sbi->inode_hash_lock);
mark_buffer_dirty(bh);
- brelse(bh);
unlock_kernel();
+
+ if (sb->s_flags & MS_SYNCHRONOUS)
+ sync_dirty_buffer(bh);
+ brelse(bh);
+
return 0;
}
--- a/include/linux/msdos_fs.h 2004-11-24 15:57:20.000000000 +0100
+++ b/include/linux/msdos_fs.h 2004-11-24 21:06:17.858607048 +0100
@@ -266,6 +266,7 @@
struct msdos_dir_entry *de, loff_t i_pos, int
*res); int fat_fill_super(struct super_block *sb, void *data, int
silent, struct inode_operations *fs_dir_inode_ops,
int isvfat);+int fat_sync_inode(struct inode *inode);
extern int fat_notify_change(struct dentry * dentry, struct iattr *
attr);
/* fat/misc.c */
--
Colin
"That's the difference between me and the rest of the world!
Happiness isn't good enough for me! I demand euphoria!"
-- Calvin
next prev parent reply other threads:[~2004-11-25 0:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-18 18:49 [PATCH] let fat handle MS_SYNCHRONOUS flag Colin Leroy
2004-11-18 18:51 ` [PATCH] let vfat " Colin Leroy
2004-11-23 19:32 ` [PATCH] let fat " Colin Leroy
2004-11-23 20:24 ` OGAWA Hirofumi
2004-11-24 3:20 ` Matt Mackall
2004-11-24 5:00 ` OGAWA Hirofumi
2004-11-24 5:35 ` Matt Mackall
2004-11-24 6:26 ` OGAWA Hirofumi
2004-11-24 6:40 ` Andrew Morton
2004-11-24 6:49 ` Matt Mackall
2004-11-24 6:57 ` Andrew Morton
2004-11-24 13:26 ` OGAWA Hirofumi
2004-11-24 5:41 ` Bernd Eckenfels
2004-11-24 7:30 ` Colin Leroy
2004-11-24 3:17 ` Matt Mackall
2004-11-24 7:34 ` Colin Leroy
2004-11-24 7:50 ` Matt Mackall
2004-11-24 8:40 ` Colin Leroy
2004-11-24 14:02 ` OGAWA Hirofumi
2004-11-24 14:25 ` Colin Leroy
2004-11-24 15:02 ` Colin Leroy
2004-11-24 18:10 ` OGAWA Hirofumi
2004-11-24 20:28 ` Colin Leroy [this message]
[not found] ` <87k6saunwl.fsf@devron.myhome.or.jp>
2004-11-25 12:47 ` Colin Leroy
[not found] ` <87act6ulc5.fsf@devron.myhome.or.jp>
2004-11-25 13:11 ` Colin Leroy
2004-12-29 19:33 ` Robert Hardy
2004-12-30 3:02 ` 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=20041124212811.4d8b121e@jack.colino.net \
--to=colin@colino.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox