?

Log in

No account? Create an account
memory stick unmount on capacitance sensor press - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

memory stick unmount on capacitance sensor press [Mar. 15th, 2007|09:58 am]
Brad Fitzpatrick
[Tags|]

I think memory sticks should have capacitance touch sensors. So when you go to grab them to pull them out, they send some "holy shit I'm being grabbed!" message over USB, which the host can then use to quickly unmount it, flushing buffers, etc.

Yeah, it's kinda a shitty idea for a number of reasons, but it'd still be neat.

My bigger beef is why all OSes/distros don't just automount removable flash as sync, so there's never unflushed data in the kernel.

Who gives a shit about the "you pulled this out without ejecting it!" messages. I don't, and I know what's going on under the hood. I can't believe regular users give half a shit.
LinkReply

Comments:
(Deleted comment)
[User Picture]From: brad
2007-03-15 05:39 pm (UTC)
The SuSE kernel had a patch a while back that added a mount option just for use with usb keys etc, that iirc wrote back data a little more often than regular mounts whilst still keeping it async. Not sure what became of it.

That sounds good.

Any way to push "mount is dirty" vs "mount is clean" events to userspace? I'd love to click "Places" in Gnome, or see the icon on my desktop, and see the USB memory stick mount icon, but with a spinning little something indicating it was dirty and actively flushing shit, and then when it goes away, I know I can yank it.

Does sysfs support inotify? Or does it depends on which "directory"? An inotifiable-sysfs property on a device/mount that says this "shit is unflushed" flag would be nice.
(Reply) (Parent) (Thread)
[User Picture]From: robflynn
2007-03-16 12:47 am (UTC)
"Places" in Gnome, or see the icon on my desktop, and see the USB memory stick mount icon, but with a spinning little something indicating it was dirty and actively flushing shit

That would be great...
(Reply) (Parent) (Thread)
[User Picture]From: shmivejournal
2007-03-15 05:30 pm (UTC)
Who gives a shit about the "you pulled this out without ejecting it!" messages.

Christians, mostly.
(Reply) (Thread)
[User Picture]From: way2tired
2007-03-15 06:30 pm (UTC)
that is one of the funniest things I've read all day. Heh.
(Reply) (Parent) (Thread)
[User Picture]From: brad
2007-03-15 06:31 pm (UTC)
That took me a minute to understand. Heh. :-)
(Reply) (Parent) (Thread)
[User Picture]From: robflynn
2007-03-16 12:47 am (UTC)
hahaha
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]From: brad
2007-03-15 05:40 pm (UTC)
Does that fucking terrible drag-to-trash-to-eject "metaphor" still exist in OS X?
(Reply) (Parent) (Thread)
[User Picture]From: kniedzw
2007-03-15 05:45 pm (UTC)
Yep. Likewise for the mounted "filesystems" in compressed archives.
(Reply) (Parent) (Thread)
[User Picture]From: detritus
2007-03-15 05:52 pm (UTC)
Yes.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]From: jope
2007-03-15 06:09 pm (UTC)
Performance, yes, but maybe also longevity of the hardware. Flash starts dying after a certain number of writes. To mitigate this, drivers rotate around through the flash such that over time writes are distributed across it evenly. Of course, this only an issue if there's a substantial amount of write-then-delete/overwrite happening, which I wouldn't expect to apply in any of the common-case usages. One example that does run into this: Flash-based appliances I've worked on where configs are kept in sync, which includes writing a timestamp of the last config-sync. If that timestamp is in the larger main config file, then the entire file gets written out every few seconds; six months later the appliance horks. Sticking the timestamp (and other frequently changing data) in a smaller separate file reduced the overall amount of writing. Not really applicable to thumb drives, just sayin'.
(Reply) (Thread)
[User Picture]From: ydna
2007-03-15 06:32 pm (UTC)
I thought modern flash drives did zone remapping/rotation internally kinda like ATA sector remapping so there was no need to teach the drivers about the issue.
(Reply) (Parent) (Thread)
[User Picture]From: jope
2007-03-15 06:43 pm (UTC)
Wouldn't surprise me. This is based on several years ago. Also entirely possible our hardware guys cheaped out on the flash component and used one that didn't do this internally. Doesn't change the underlying concept I was demonstrating though. Whic wasn't particularly pertinent to begin with... =/
(Reply) (Parent) (Thread)
[User Picture]From: feignedapathy
2007-03-15 08:49 pm (UTC)
You got it. Most consumer level flash hardware (in cf, sd, etc) since the late 90's or so support that, so you can match it to any filesystem. It was pretty much a necessity, since everyone was choosing FAT/FAT32 to stick on there.
(Reply) (Parent) (Thread)
[User Picture]From: ydna
2007-03-15 06:34 pm (UTC)
"holy shit I'm being grabbed!" ... then use to quickly unmount it, flushing buffers, etc.

Sounds like what happens when you walk down the wrong dark alley.
(Reply) (Thread)
[User Picture]From: boggyb
2007-03-15 07:24 pm (UTC)
It varies from OS to OS - Windows 2000 gets very unhappy if you pull a flash drive without stopping it, whereas XP merely goes "oh, I suppose I'd better remove the mapping for that drive letter then". Under XP write caching on anything removeable is also disabled by default.

No idea about Linux, other than the automounter seems to refresh floppy drives only when the moon is blue :)
(Reply) (Thread)