maemo.org Bugzilla – Bug 3543
/media/mmc[12] is mounted atime leading to additional wear on flash
Last modified: 2008-12-06 16:49:14 UTC
You need to log in before you can comment on or make changes to this bug.
The vfat filesystems mounted under /media are not mounted with the noatime flag. ~ $ ./test_atime.py /var/tmp atime is NOT being updated, this is good ~ $ ./test_atime.py /media/mmc1/ atime is being updated, this is bad ~ $ ./test_atime.py /media/mmc2 atime is being updated, this is bad ~ $ sudo gainroot Root shell enabled BusyBox v1.6.1 (2008-05-22 10:32:35 EEST) Built-in shell (ash) Enter 'help' for a list of built-in commands. /home/user # mount -o remount,noatime /media/mmc1 /home/user # mount -o remount,noatime /media/mmc2 /home/user # exit ~ $ ./test_atime.py /media/mmc1/ atime is NOT being updated, this is good ~ $ ./test_atime.py /media/mmc2 atime is NOT being updated, this is good ~ $ This is a rather trivial fix to /usr/sbin/mmc-mount #!/bin/sh mount -t vfat -o rw,noauto,noatime,nodev,noexec,nosuid,utf8,uid=29999,shortname=mixed,dmask=000,fmask=0133 "$1" "$2" > /dev/null
Created an attachment (id=860) [details] script to test for atime updates.
Keywords
*** This bug has been confirmed by popular vote. ***
This is marked as performance. Is there some use-case where this is actually measured to slow things down (and does VFAT implement atime)?
I will try to find a use case where this can be measured. The problem is that there must be both IO and CPU activity to really see the issue. I would expect to see the most difference on things like an initial media scan. Either way it will reduce the wear and tear on flash drives as well. I will flash back to stock kernel and attempt to find a situation where the effect can be measured.
I could not, reproducibly, demonstrate a performance drag despite my understanding of atime. I have removed the keyword and changes the title since atime will create wear and tear on the mount point over time.
(In reply to comment #6) > I could not, reproducibly, demonstrate a performance drag despite my > understanding of atime. I have removed the keyword and changes the title since > atime will create wear and tear on the mount point over time. Do FAT file system disk structures support atime (i.e. there anything kernel could even write to card)? I think it only has create/last modification time...
vfat contains a adate field. This means when loading or saving the inode the precision is cut down to ~1day. It is wildly inaccurate, but is kept up-to-date in the vfs inode. See fs/fat/inode.c Since atime and inode dirty setting are part of the stock vfs the kernel will happily continue to update atime and mark the inode dirty for writing on access no matter if the atime change will actually result in an on device change to the vfat structure. see include/linux/fs.h ( file_accessed ) fs/inode.c ( touch_atime ) These will touch the inode atime and mark the inode dirty despite the inaccurate vfat atime field and the kernel will attempt to flush in good time. So not only are there write cycles to the block device. Fat block semantics also appear to require a 1-at-a-time inode write with kernel lock and sync write ( fs/fat/inode.c ).
Thanks for checking this! Additional writes could conceivably be also one reason why the FAT seems sometimes to corrupt (e.g. as a result of crawler media file reading causing card adate writes and user taking the card out while the writes are in progress).
Will be fixed in next release (noatime+nodiratime). As you've looked in to the kernel side, does the kernel still provide with these option atime information to user-space while the media is mounted (although the information then doesn't get stored on the media)?
As it is marked solved/fixed this is just for additional information (In reply to comment #4) > This is marked as performance. Is there some use-case where this is > actually measured to slow things down This is just a feeling without any measurement and it could be even caused by something else but if you open 'file open' dialog and open memory card view (even just its root directory) with many directories with many files inside it seems to scans directories recursively (just to display '+' overlay over folder icon) and dialog gets unresponsive for some time at the beginning, then it is OK and then it is again unresponsive after few seconds. Just try to quickly open card and navigate 2 or 3 folders inside some tree hierarchy. You can sometimes manage to do it quickly but if you are not fast enough you must wait for next window of opportunity. Such scanning may cause lot of atime updates so disabling it may cause dialog to be a bit more responsive. One can guess it is atime updates by monitoring mmcqd kernel thread. It seems to get pretty busy when writing but not when reading. So if one is just scanning card and mmcqd gets busy something is not right. Also start from this post http://www.internettablettalk.com/forums/showthread.php?p=210260#post210260 to see other performance issues, remounting with noatime helped Another use case is metalayer-crawler, it touches a lot of files. > (and does VFAT implement atime)? > Yes people claim it does. Check some links in http://www.internettablettalk.com/forums/showthread.php?p=210676#post210676
I think the nodiratime option is redundant (see http://thread.gmane.org/gmane.linux.kernel/565148 and/or http://lwn.net/Articles/244941/).
(In reply to comment #11) > As it is marked solved/fixed this is just for additional information You would be surprised how hard it is to quantify the problem in terms of real world issues. I even tried writing a mock file scanner and could not quantify a difference. It's possible that python is just not fast enough to quantify the problem. The benefits to wear and tear are the biggest, especially with the crawler scanning the media on every boot. There are probably subtle interactive issues as well ( media playback was my example on iTT ).
Fix included in today's 4.2008.36-5 update (ke-recv version 2.28-1). Please verify if you find some time.
Both cards are now mounted noatime,nodiratime according to mount(8), /proc/mounts & /etc/mtab: /dev/mmcblk0p1 on /media/mmc2 type vfat (rw,nosuid,nodev,noexec,noatime,nodiratime,uid=29999,fmask=0133,dmask=0000,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8) /dev/mmcblk1p1 on /media/mmc1 type vfat (rw,nosuid,nodev,noexec,noatime,nodiratime,uid=29999,fmask=0133,dmask=0000,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8) and the attached test_atime.py agrees: ~ $ ./test_atime.py /var/tmp/ atime is NOT being updated, this is good ~ $ ./test_atime.py /media/mmc1 atime is NOT being updated, this is good ~ $ ./test_atime.py /media/mmc2 atime is NOT being updated, this is good (I don't seem to have permission to change the status, sorry)