USB Takes long time to unmount

Sebastian M=?ISO-8859-1?B?/A==?=sch sebastian at sebastian-muesch.de
Thu Sep 8 14:17:10 UTC 2005


Hi,

Once upon a time Matt Patterson wrote:
> I would much rather have a realistic measurement of the drives speed so
> that when I am dropping files onto it and leaving I can predict when
> things will finish instead of waiting an unkown time for unmount ot happen.

The problem of disabling asynchronous writes is that your cpu will use it's
calculation-cycles for active waiting until the i/o is finished. This can be
really anoying if you write to more than one file parallel the device (more
than on write-thread/process), as most modern applications do.

Let's take a "simple" example on working on a device, while copying files to
a fat32-partition ... Let's say each i/o-step takes one second and the cache
is big enough to hold the complete i/o, only for simplicity ...

Without any cache:
==================

1. Read the File-Allocation-Table (FAT)
2. Add an entry for the first file and write the new FAT to the device
3. Copy the data for file 1 to the device
4. Read the File-Allocation-Table (FAT)
5. Add an entry for the second file and write the new FAT to the device
6. Copy the data for file 2 to the device
7. Read the File-Allocation-Table (FAT)
8. Add an entry for the third file and write the new FAT to the device
9. Copy the data for file 3 to the device
10. ...

With read-cache:
================

1. Read the FAT
2. Add an entry for the first file
3. Write the new FAT to the device
4. Copy the data for file 1 to the device
(New FAT is already in the cache)
5. Add an entry for the second file and write the new FAT to the device
6. Copy the data for file 2 to the device
7. Add an entry for the second file and write the new FAT to the device
8. Copy the data for file 3 to the device
9. ...

With read-write-cache:
======================

1. Read the FAT
(every i/o is done in memory and nothing is written until the
"flush-buffers" or a "sync" is recieved)
2. Write the new FAT
3. Copy data for file 1
4. Copy data for file 2
5. Copy data for file 3
6. ...

You may see, there is a real perfomance-benefit using any buffers.

A note: I just took a look at the man-page of mount, and it seems like vfat
(fat12/16/32) does not honor the sync-option ... So maybe the option has no
effect at all, or the man page of mount is some kind of outdated.

An advisory at last: Please do some checking on the files written to the
device while using the sync-option. Maybe there are some bugs in conjunction
with this option and specific fs-modules.

Cu
Sebastian
 
-- 
        .:'
     _ :'_
   .`_`-'_`.     Sebastian Müsch
  :__|\ /|__:      sebastian at sebastian-muesch.de
  :__| S |__:
  :__|   |__:     iTunes ist aus :-(
   `._.-._.'






More information about the ubuntu-users mailing list