Skip to contentSkip to conversation

Syncing single filesystem (slow USB writing)

DISCUSSION Andrey Borzenkov 4 participants 9 messages Jul 29, 2005

lore
Share & tools
lore
#0 lore raw

Mandrake always mounted USB sticks with sync option; it was effectively noop except for a patch that implemented limited dsync semantic.

Now, when full sync support for FATis in kernel, moutning with sync became real pain. Writing speed dropped from 3MB/s to 30KB/s in my case (and I am not alone).

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

TIA

-andrey

#1 lore raw
Quoted 7 lines · Andrey Borzenkov

Mandrake always mounted USB sticks with sync option; it was effectively noop except for a patch that implemented limited dsync semantic.

Now, when full sync support for FATis in kernel, moutning with sync became real pain. Writing speed dropped from 3MB/s to 30KB/s in my case (and I am not alone).

Unfortunately I think we're just going to have to live with that. It is right that fatfs behaves as it does, and unfortunate that some distros will operate slowly.

For reference: how does mandrake implement this? Just in /etc/fstab? How should we tell other people to fix this?

Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

#2 lore raw
Quoted 4 lines · Andrew Morton
Quoted 3 lines · Andrey Borzenkov

Mandrake always mounted USB sticks with sync option; it was effectively noop except for a patch that implemented limited dsync semantic.

Quoted 8 lines
Quoted 3 lines

Now, when full sync support for FATis in kernel, moutning with sync became real pain. Writing speed dropped from 3MB/s to 30KB/s in my case (and I am not alone).

Unfortunately I think we're just going to have to live with that. It is right that fatfs behaves as it does, and unfortunate that some distros will operate slowly.

Well, I was not going to suggest killing sync support in FAT :)

Quoted 3 lines

For reference: how does mandrake implement this? Just in /etc/fstab? How should we tell other people to fix this?

Yes, just fstab option. It has been "fixed" a couple of days ago by removing sync but I am going to test effect of dsync; it should behave more or less as before and provide at least some level of fs consistency.

Quoted 8 lines
Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

Oh well, let's do it in kernel to check if it is worth hassle.

Thanks

#3 lore raw
In reply to Andrew Morton
Quoted 8 lines · Andrew Morton
Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

apparently one should not ask such a question at 7 am. Any reason why BLKFLSBUF does not suite?

#4 lore raw
Quoted 8 lines · Andrey Borzenkov
Quoted 6 lines · Andrew Morton
Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

Quoted 5 lines
Quoted 2 lines

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

apparently one should not ask such a question at 7 am. Any reason why BLKFLSBUF does not suite?

That'll only write back data associated with /dev/hdXX (ie: filesystem metadata) and not the data associated with all the files in the filesystem which is mounted on /dev/hdXX.

#5 lore raw
Quoted 11 lines · Andrew Morton
Quoted 10 lines · Andrey Borzenkov
Quoted 8 lines · Andrew Morton
Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

Quoted 6 lines
Quoted 2 lines

apparently one should not ask such a question at 7 am. Any reason why BLKFLSBUF does not suite?

That'll only write back data associated with /dev/hdXX (ie: filesystem metadata) and not the data associated with all the files in the filesystem which is mounted on /dev/hdXX.

I am confused. BKLFLSBUF boils down to sync_inodes_sb for mounted device, and that appears to write out direty inode pages?

What should be used for in-kernel implementation then? I was going to use the same frankly speaking :)

#6 lore raw
Quoted 16 lines · Andrey Borzenkov
Quoted 14 lines · Andrew Morton
Quoted 12 lines · Andrey Borzenkov
Quoted 8 lines · Andrew Morton
Quoted 5 lines

One idea how to improve situation - continue to mount with dsync (having basically old case) and do frequent sync of filesystem (this culd be started as HAL callout or whatever). Unfortunately, I could not find a way to request a sync (flush) of single mount point or block device. Have I missed something?

It's trivial to do in-kernel but no, I'm afraid there isn't a userspace interface for this.

apparently one should not ask such a question at 7 am. Any reason why BLKFLSBUF does not suite?

Quoted 6 lines
Quoted 3 lines

That'll only write back data associated with /dev/hdXX (ie: filesystem metadata) and not the data associated with all the files in the filesystem which is mounted on /dev/hdXX.

I am confused. BKLFLSBUF boils down to sync_inodes_sb for mounted device, and that appears to write out direty inode pages?

Oh, you're right. How cunning. Yes, `blockdev --flushbufs /dev/hda1' would indeed appear to sync all data associated with that device.

#7 lore raw
In reply to Andrey Borzenkov
Quoted 4 lines

Now, when full sync support for FATis in kernel, moutning with sync became real pain. Writing speed dropped from 3MB/s to 30KB/s in my case (and I am not alone).

Interesting. I mount all my USB drives and players with async option - and they do use vfat. There is no problem on unmount, they complete the sync. (Though btw, the drive's led still flashes after umount has returned.) For USB 1.1 devices, it takes a little longer since the buffer cache or something like that is so big.

Jan Engelhardt

Signature · 1 line
| Alphagate Systems, http://alphagate.hopto.org/
#8 lore raw
In reply to Andrey Borzenkov
Quoted 3 lines · Andrey Borzenkov

Mandrake always mounted USB sticks with sync option; it was effectively noop except for a patch that implemented limited dsync semantic.

fwiw; various people have reported using flash block devices with 'sync' ruins them as there can be many more (and very frequent) updates to the device