let fat handle MS_SYNCHRONOUS flag
PATCH 1/1 let fat handle MS_SYNCHRONOUS flag
Hi,
this patch is an RFC patch not to be applied.
It adds MS_SYNCHRONOUS support to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.
Thanks,
fs/fat/dir.c +6 -0
@@ -736,6 +736,7 @@ {struct buffer_head *bh;struct msdos_dir_entry *de; +struct super_block *sb;__le16 date, time; bh =fat_extend_dir (dir);
@@ -764,6 +765,11 @@ dir->i_atime = dir->i_ctime = dir->i_mtime =CURRENT_TIME ;mark_inode_dirty (dir); + sb = dir->i_sb; + +if (sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (bh); +return 0 ; }
fs/fat/file.c +17 -0
@@ -74,21 +74,34 @@ {struct inode *inode = filp->f_dentry->d_inode;int retval; +struct super_block *sb = inode->i_sb; +struct buffer_head *bh =NULL ; 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 ) { + bh =sb_bread (sb,MSDOS_SB (sb)->fsinfo_sector); +if (bh !=NULL ) { +sync_dirty_buffer (bh); +brelse (bh); + }else { +BUG_ON (1 ); + } + } }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; +struct buffer_head *bh =NULL ;/* * This protects against truncating a file bigger than it was then
@@ -105,4 +118,8 @@unlock_kernel (); inode->i_ctime = inode->i_mtime =CURRENT_TIME ;mark_inode_dirty (inode); +if (sb->s_flags &MS_SYNCHRONOUS ) { + bh =sb_bread (sb, sbi->fsinfo_sector); +sync_dirty_buffer (bh); + } }
fs/fat/inode.c +5 -1
@@ -1273,8 +1273,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 ; }
PATCH 1/1 let vfat handle MS_SYNCHRONOUS flag
On 18 Nov 2004 at 19h11, Colin Leroy wrote:
Hi,
Same patch for vfat.
fs/vfat/namei.c +18 -4
@@ -743,6 +743,8 @@ (*de)->adate = (*de)->cdate = (*de)->date;mark_buffer_dirty (*bh); +if (dir->i_sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (*bh);/* slots can't be less than 1 */ sinfo_out->long_slots = slots -1 ;
@@ -844,7 +846,6 @@if (res <0 ) goto out; inode =fat_build_inode (sb, de, sinfo.i_pos, &res); -brelse (bh);if (!inode) goto out; res =0 ;
@@ -854,7 +855,10 @@ dir->i_version++; dentry->d_time = dentry->d_parent->d_inode->i_version;d_instantiate (dentry,inode); +if (sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (bh); out: +brelse (bh);unlock_kernel ();return res; }
@@ -871,6 +875,7 @@mark_inode_dirty (dir); de->name[0 ] =DELETED_FLAG ;mark_buffer_dirty (bh); +/* remove the longname */ offset = sinfo->longname_offset; de =NULL ;for (i = sinfo->long_slots; i >0 ; --i) {
@@ -880,6 +885,9 @@ de->attr =ATTR_NONE ;mark_buffer_dirty (bh); } +if (dir->i_sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (bh); +brelse (bh); }
@@ -903,7 +911,7 @@ dentry->d_inode->i_mtime = dentry->d_inode->i_atime =CURRENT_TIME ;fat_detach (dentry->d_inode);mark_inode_dirty (dentry->d_inode); -/* releases bh */ +/* releases bh and syncs it if necessary */ vfat_remove_entry (dir,&sinfo,bh,de); dir->i_nlink--; out:
@@ -926,7 +934,7 @@ dentry->d_inode->i_mtime = dentry->d_inode->i_atime =CURRENT_TIME ;fat_detach (dentry->d_inode);mark_inode_dirty (dentry->d_inode); -/* releases bh */ +/* releases bh and syncs it if necessary */ vfat_remove_entry (dir,&sinfo,bh,de); out:unlock_kernel ();
@@ -956,6 +964,10 @@ dir->i_version++; dir->i_nlink++; inode->i_nlink =2 ;/* no need to mark them dirty */ + +if (sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (bh); + res =fat_new_dir (inode, dir,1 );if (res <0 ) goto mkdir_failed;
@@ -972,7 +984,7 @@ inode->i_mtime = inode->i_atime =CURRENT_TIME ;fat_detach (inode);mark_inode_dirty (inode); -/* releases bh */ +/* releases bh ands syncs if necessary */ vfat_remove_entry (dir,&sinfo,bh,de);iput (inode); dir->i_nlink--;
@@ -1057,6 +1069,8 @@ new_dir->i_nlink++;mark_inode_dirty (new_dir); } +if (new_dir->i_sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (dotdot_bh); } rename_done:
On 18 Nov 2004 at 19h11, Colin Leroy wrote:
Hi,
Quoted 1 line
this patch is an RFC patch not to be applied.
no one has any comments ? Is it so broken ? ;)
Signature · 5 lines
Colin 6a65 206e 2761 7272 6976 6520 7061 7320 e020 6372 6f69 7265 2071 7527 696c 2079 2065 6e20 6169 7420 756e 2071 7569 2061 2072 6567 6172 64e9 20e7 6120 5c21 0a00
OGAWA Hirofumi
maintainerQuoted 5 lines · Colin Leroy
It adds
MS_SYNCHRONOUSsupport to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.
What cases should these patches guarantee that users can unplug the USB key? And can we guarantee the same cases by improving autofs or the similar stuff?
I'm not sure sync-mode is proper for it...
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 11 lines · OGAWA Hirofumi
Quoted 5 lines · Colin Leroy
It adds
MS_SYNCHRONOUSsupport to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.What cases should these patches guarantee that users can unplug the USB key? And can we guarantee the same cases by improving autofs or the similar stuff?
Well there can be no guarantees - there will always be a race between flush and hot unplug. If we're careful with write ordering, we can perhaps arrange to avoid the worst sorts of corruption, provided the device does the right thing when it's in the middle of an IO.
But generally I think this is a good idea as it shrinks the window.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
OGAWA Hirofumi
maintainerQuoted 13 lines · Matt Mackall
Quoted 11 lines · OGAWA Hirofumi
Quoted 5 lines · Colin Leroy
It adds
MS_SYNCHRONOUSsupport to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.What cases should these patches guarantee that users can unplug the USB key? And can we guarantee the same cases by improving autofs or the similar stuff?
Quoted 6 lines
Well there can be no guarantees - there will always be a race between flush and hot unplug. If we're careful with write ordering, we can perhaps arrange to avoid the worst sorts of corruption, provided the device does the right thing when it's in the middle of an IO.
But generally I think this is a good idea as it shrinks the window.
Things which I want to say here - do we really need the bogus sync-mode?
Current fatfs is not keeping the consistency of data on the disk at all. So, after all, the data on a disk is corrupting until all syscalls finish, right?
If so, isn't this too slow? I doubt this is good solution for this problem (USB key unplugging)...
Well, it seems good as start of sync-mode though.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 20 lines · OGAWA Hirofumi
Quoted 18 lines · Matt Mackall
Quoted 11 lines · OGAWA Hirofumi
Quoted 5 lines · Colin Leroy
It adds
MS_SYNCHRONOUSsupport to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.What cases should these patches guarantee that users can unplug the USB key? And can we guarantee the same cases by improving autofs or the similar stuff?
Well there can be no guarantees - there will always be a race between flush and hot unplug. If we're careful with write ordering, we can perhaps arrange to avoid the worst sorts of corruption, provided the device does the right thing when it's in the middle of an IO.
Quoted 4 lines
Quoted 1 line
But generally I think this is a good idea as it shrinks the window.
Things which I want to say here - do we really need the bogus sync-mode?
I'm not sure why you say it's bogus. Ext2 for instance has long had a mount option similar to this and it makes sense in volatile environments. Having the flag in the superblock seems a sensible way of doing it as well.
Quoted 3 lines
Current fatfs is not keeping the consistency of data on the disk at all. So, after all, the data on a disk is corrupting until all syscalls finish, right?
This is to protect against usage patters like mv a b, oh look, it's done, unplug. Not lots of active readers/writers.
Quoted 2 lines
If so, isn't this too slow? I doubt this is good solution for this problem (USB key unplugging)...
Perhaps. I think the behavior should be to honor the superblock flag by default, overridable with -o sync|async at mount.
Quoted 3 lines
Well, it seems good as start of sync-mode though.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
OGAWA Hirofumi
maintainerQuoted 7 lines · Matt Mackall
Quoted 2 lines
Things which I want to say here - do we really need the bogus sync-mode?
I'm not sure why you say it's bogus. Ext2 for instance has long had a mount option similar to this and it makes sense in volatile environments. Having the flag in the superblock seems a sensible way of doing it as well.
AFAIK, EXT2 doesn't update all metadata synchronously in sync-mode.
Quoted 6 lines
Quoted 3 lines
Current fatfs is not keeping the consistency of data on the disk at all. So, after all, the data on a disk is corrupting until all syscalls finish, right?
This is to protect against usage patters like mv a b, oh look, it's done, unplug. Not lots of active readers/writers.
I think we don't need synchronous update for it, probably we just need to flush the buffers on each operations.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 2 lines · OGAWA Hirofumi
AFAIK, EXT2 doesn't update all metadata synchronously in sync-mode.
It does.
I'm actually surprised to discover that [v]fat doesn't support `-o sync'. It's probably a quite practical way of handling these various hotpluggable gadgets and would be a popular addition.
It does have the downside that it'll teach our users bad practices....
Quoted 11 lines · Andrew Morton
Quoted 2 lines · OGAWA Hirofumi
AFAIK, EXT2 doesn't update all metadata synchronously in sync-mode.
It does.
I'm actually surprised to discover that [v]fat doesn't support `-o sync'. It's probably a quite practical way of handling these various hotpluggable gadgets and would be a popular addition.
It does have the downside that it'll teach our users bad practices....
Dunno. Right now they'll still probably have an occassional kernel crash to contend with from device disappearing from under an fs, but at least they won't have lost all the photos on their camera...
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Quoted 6 lines · Matt Mackall
Quoted 2 lines
It does have the downside that it'll teach our users bad practices....
Dunno. Right now they'll still probably have an occassional kernel crash to contend with from device disappearing from under an fs, but at least they won't have lost all the photos on their camera...
Yes, but after a fisaco like that, they'll remember to type `umount'!
Maybe I wasn't cut out for a career as an educator.
OGAWA Hirofumi
maintainerQuoted 5 lines · Andrew Morton
Quoted 2 lines · OGAWA Hirofumi
AFAIK, EXT2 doesn't update all metadata synchronously in sync-mode.
It does.
Umm... I was thinking that ext2 is using the delayed-write if it can keep the consistency of metadata on-disk.
Quoted 3 lines
I'm actually surprised to discover that [v]fat doesn't support `-o sync'. It's probably a quite practical way of handling these various hotpluggable gadgets and would be a popular addition.
OK. If peoples really want this, I don't have objections. I'll check the patch.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
Quoted 3 lines · In article <[email protected]> you wrote:
Current fatfs is not keeping the consistency of data on the disk at all. So, after all, the data on a disk is corrupting until all syscalls finish, right?
Me thinks, fat is pretty robust, and with the small window it improves, because most users will wait until the operation finished and unplug then. Which is enough delay for scheduled sync, but not for delayed flushed blocks.
Quoted 2 lines
If so, isn't this too slow? I doubt this is good solution for this problem (USB key unplugging)...
Hmm... Actually a "better" solution which involves a journalling filesystem is not an option for most fat users becaue they need the interoperability.
So the only real solutions you have (beside educating the user to wait for sync) is to make the corruption window smaller and perhaps do some reordering on meta data changed to lower the dangers of corruptions.
Quoted 1 line
Well, it seems good as start of sync-mode though.
You mean, to build sync writes at the right places in the fatfs? I guess yes that would be even better, so you have kind of soft updates for fat :) However dont know how reliable the flash controllers are with reordering (if they are somewhat smart)
How about having configurable sync intervalls per fs/device and default them to 0 for removeable media?
Greetings
Bernd
On 24 Nov 2004 at 06h11, Bernd Eckenfels wrote:
Hi,
Quoted 2 lines
Hmm... Actually a "better" solution which involves a journalling filesystem is not an option for most fat users becaue they need the interoperability.
Yes, an usb key with ext2 fs is quite useless when you have to tell your friends they can't give you this or that file because they run windows :)
Signature · 1 line
Colin
Quoted 10 lines · Colin Leroy
Hi,
this patch is an RFC patch not to be applied.
It addsMS_SYNCHRONOUSsupport to FAT filesystem, so that less filesystem breakage happen when disconnecting an USB key, for example. I'd like to have comments about it, because as it seems to work fine here, I'm not used to fs drivers and could have made mistakes.
Thanks,
fs/fat/file.c line 91
Quoted 5 lines
fs/fat/file.c +5
-0+if (bh !=NULL ) { +sync_dirty_buffer (bh); +brelse (bh); + }else { +BUG_ON (1 );
This construct is really weird.
How about:
BUG_ON(!bh);sync_dirty_buffer(bh);
brelse(bh);
Concept seems good, and the implementation otherwise looks good at first glance.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
On 23 Nov 2004 at 19h11, Matt Mackall wrote:
Hi,
Quoted 3 lines
BUG_ON(!bh);sync_dirty_buffer(bh);
brelse(bh);
I wasn't sure sync_dirty_buffer and brelse checked for nullity :)
Quoted 2 lines
Concept seems good, and the implementation otherwise looks good at first glance.
Cool :) Should I submit an updated patch to Andrew for -mm ?
Thanks for all the comments. I agree with what most people said, sync mode is not a guarantee that everything will be fine, but it helps in most cases.
As for the speed, from what I checked it slows down IO a bit, of course, but that is within tolerable bounds imho.
Signature · 1 line
Colin
Quoted 9 lines · Colin Leroy
On 23 Nov 2004 at 19h11, Matt Mackall wrote:
Hi,
Quoted 3 lines
BUG_ON(!bh);sync_dirty_buffer(bh);
brelse(bh);I wasn't sure
sync_dirty_bufferand brelse checked for nullity :)
It may, that wasn't my point. Your original patch had BUG_ON(1) which by itself was weird (use BUG() instead). But then it was in the else part of an if statement. So it read like:
if (bh) {
...
} else {
if (1)
BUG(); /* stop kernel */ }
BUG is for reporting things that should never happen (otherwise you'd actually handle them) and so should be used in such a way that they don't complicate the code flow.
Quoted 4 lines
Quoted 2 lines
Concept seems good, and the implementation otherwise looks good at first glance.
Cool :) Should I submit an updated patch to Andrew for -mm ?
Probably ought to go through Ogawa, if he can be convinced to take it. Please take a look at adding -o sync and -o async options to override the superblock flag first.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
On 23 Nov 2004 at 23h11, Matt Mackall wrote:
Hi,
Quoted 3 lines
Probably ought to go through Ogawa, if he can be convinced to take it. Please take a look at adding -o sync and -o async options to override the superblock flag first.
Isn't it this option that sets the superblock flag ? I didn't look at mount's source, but according from ext2 source and fs/namespace.c, this is it...
Signature · 1 line
Colin
OGAWA Hirofumi
maintainerfs/fat/dir.c line 772
Quoted 9 lines · Colin Leroy
fs/fat/dir.c +5
-0@@ -764,6 +765,11 @@ dir->i_atime = dir->i_ctime = dir->i_mtime =CURRENT_TIME ;mark_inode_dirty (dir); + sb = dir->i_sb; + +if (sb->s_flags &MS_SYNCHRONOUS ) +sync_dirty_buffer (bh); +
This bh is already released.
Quoted 4 lines
fs/fat/file.c +0
-0retval =generic_file_write (filp, buf, count, ppos);if (retval >0 ) { inode->i_mtime = inode->i_ctime =CURRENT_TIME ;fs/fat/file.c +0
-0MSDOS_I (inode)->i_attrs |=ATTR_ARCH ;
fs/fat/file.c line 93
Quoted 10 lines
fs/fat/file.c +9
-0mark_inode_dirty (inode); +if (sb->s_flags &MS_SYNCHRONOUS ) { + bh =sb_bread (sb,MSDOS_SB (sb)->fsinfo_sector); +if (bh !=NULL ) { +sync_dirty_buffer (bh); +brelse (bh); + }else { +BUG_ON (1 ); + } + }
FAT12/16 doesn't have FSINFO sector. And if sb_bread() returns NULL, we should return the valid error.
fs/fat/file.c line 124
Quoted 8 lines
fs/fat/file.c +4
-0@@ -105,4 +118,8 @@unlock_kernel (); inode->i_ctime = inode->i_mtime =CURRENT_TIME ;mark_inode_dirty (inode); +if (sb->s_flags &MS_SYNCHRONOUS ) { + bh =sb_bread (sb, sbi->fsinfo_sector); +sync_dirty_buffer (bh); + }
Ditto.
Aren't you forgetting to update the inode and various metadata (e.g. FAT)?
Signature · 1 line
OGAWA Hirofumi <[email protected]>
On 24 Nov 2004 at 23h11, OGAWA Hirofumi wrote:
Hi,
Quoted 11 lines
fs/fat/file.c line 93
Quoted 8 lines
fs/fat/file.c +8
-0+ bh =sb_bread (sb,MSDOS_SB (sb)->fsinfo_sector); +if (bh !=NULL ) { +sync_dirty_buffer (bh); +brelse (bh); + }else { +BUG_ON (1 ); + } + }FAT12/16 doesn't have FSINFO sector. And if
sb_bread()returns NULL, we should return the valid error.
ok, this is probably not the correct way to get the buffer_head for a given inode... Do you know what I should use?
Signature · 1 line
Colin
On 24 Nov 2004 at 23h11, OGAWA Hirofumi wrote:
Hi,
Quoted 1 line
Aren't you forgetting to update the inode and various metadata (e.g. FAT)?
Don't really know what to do about this one; where should I look ?
this second patch seems a step in the right direction to me, based off your previous comments:
fat/dir.c renamed from tmp/linux-2.6.9/fs/fat/dir.c +5 -1
@@ -760,10 +760,14 @@ 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); + +brelse (bh); +return 0 ; }
fat/file.c renamed from tmp/linux-2.6.9/fs/fat/file.c +21 -0
@@ -74,18 +74,30 @@ {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 ) { +struct buffer_head *bh; +loff_t i_pos =MSDOS_I (inode)->i_pos; + bh =sb_bread (sb, + i_pos >>MSDOS_SB (sb)->dir_per_block_bits); +if (!bh) +return -EIO ; +sync_dirty_buffer (bh); +brelse (bh); + } }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 +117,13 @@unlock_kernel (); inode->i_ctime = inode->i_mtime =CURRENT_TIME ;mark_inode_dirty (inode); +if (sb->s_flags &MS_SYNCHRONOUS ) { +struct buffer_head *bh; +loff_t i_pos =MSDOS_I (inode)->i_pos; + bh =sb_bread (sb, i_pos >>MSDOS_SB (sb)->dir_per_block_bits); +if (!bh) +return ; +sync_dirty_buffer (bh); +brelse (bh); + } }
fat/inode.c renamed from tmp/linux-2.6.9/fs/fat/inode.c +5 -1
@@ -1273,8 +1273,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 ; }
OGAWA Hirofumi
maintainerQuoted 10 lines · Colin Leroy
On 24 Nov 2004 at 23h11, OGAWA Hirofumi wrote:
Hi,
Quoted 1 line
Aren't you forgetting to update the inode and various metadata (e.g. FAT)?
Don't really know what to do about this one; where should I look ?
this second patch seems a step in the right direction to me, based off your previous comments:
Ah, I understood the intention of that code now. Probably we would need the following for writing inode.
int fat_sync_inode(struct inode *inode)
{
return fat_write_inode(inode, 1);
}Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>
On 25 Nov 2004 at 03h11, OGAWA Hirofumi wrote:
Hi,
Quoted 4 lines
int
fat_sync_inode(struct inode *inode){ return fat_write_inode(inode, 1); }
Thanks for the hint. Here's a third patch.
fat/dir.c renamed from fs/fat/dir.c +7 -1
@@ -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 ; }
fat/fatfs_syms.c renamed from fs/fat/fatfs_syms.c +1 -0
@@ -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);
fat/file.c renamed from fs/fat/file.c +6 -0
@@ -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); }
fat/inode.c renamed from fs/fat/inode.c +10 -1
@@ -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 ; }
include/linux/msdos_fs.h +0 -0
@@ -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 */
Signature · 4 lines
Colin "That's the difference between me and the rest of the world! Happiness isn't good enough for me! I demand euphoria!" -- Calvin
A message that is not in the archive (sent off-list or not yet received): [email protected]
On 25 Nov 2004 at 21h11, OGAWA Hirofumi wrote:
Hi,
Quoted 3 lines
Quoted 1 line
Thanks for the hint. Here's a third patch.
Looks good as start. Thanks.
Thank you for your help. Do I push to Andrew?
Signature · 1 line
Colin
A message that is not in the archive (sent off-list or not yet received): [email protected]
On 25 Nov 2004 at 22h11, OGAWA Hirofumi wrote:
Hi,
Quoted 4 lines
Quoted 1 line
Thank you for your help. Do I push to Andrew?
I have some patches which conflict with this patch. So, I'll submit the patches after fixing it.
Ok. I suppose you'll handle the vfat one too?
Signature · 1 line
Colin
Quoted 5 lines · Colin Leroy
Quoted 3 lines · OGAWA Hirofumi
Quoted 1 line
Thank you for your help. Do I push to Andrew?
I have some patches which conflict with this patch. So, I'll submit the patches after fixing it.
Ok. I suppose you'll handle the vfat one too?
I am very interested in seeing this sync vfat patch committed.
Can you please provide current status on vfat sync support?
Also are there newer patches for the vfat support?
Regards,
Rob
Signature · 3 lines
---------------------"Happiness is understanding."---------------------- Robert Hardy, B.Eng Computer Systems C.E.O. Webcon Inc. rhardy <at> webcon <dot> ca GPG Key available
OGAWA Hirofumi
maintainerQuoted 5 lines · Robert Hardy
Quoted 4 lines · Colin Leroy
Quoted 3 lines · OGAWA Hirofumi
Quoted 1 line
Thank you for your help. Do I push to Andrew?
I have some patches which conflict with this patch. So, I'll submit the patches after fixing it.
Quoted 7 lines
Quoted 1 line
Ok. I suppose you'll handle the vfat one too?
I am very interested in seeing this sync vfat patch committed.
Can you please provide current status on vfat sync support?
Also are there newer patches for the vfat support?
Currently, the many buffers is still not writing synchronously. And I'm rewriting the update-path for an update dependency and some optimization, now.
Current patches is here.
[I'm offline from today to January 2 or 3.]
Thanks.
Signature · 1 line
OGAWA Hirofumi <[email protected]>