Commit graph

17 commits

Author SHA1 Message Date
JP Abgrall
0b9489b027 fstrim: Don't double trim mountpoints with alternative fs types.
Now we skip mountpoints that are repeated.

Bug: 19744511
Change-Id: Iff1618274a07180e62a01c3e2479dc1d52baf267
Signed-off-by: JP Abgrall <jpa@google.com>
2015-03-16 15:07:59 -07:00
JP Abgrall
6bbb3906d0 fstrim: don't trim mount points flagged as notrim
Bug: 19624276
Change-Id: I84eeb029114d6ba2a26a53d4155d123d8acd7502
2015-03-05 17:30:20 -08:00
Nick Kralevich
24751743d7 fstrim.c: use open(O_DIRECTORY) instead of stat
open(O_DIRECTORY) returns an error if the open attempt
is against anything other than a directory. This basically
duplicates the check that the stat() call was trying to do.
Eliminate the unnecessary stat() call and use O_DIRECTORY
instead.

Change-Id: I1821abbed325f29a7214fdc41ed27cd9e26817d0
2015-03-05 12:50:23 -08:00
Young-ho Cha
e72cd592b3 vold: acquire wakelock on fstrim thread
If fstrim thread creation or detachment is failed, wakelock can be leaked.
So move wakelock acquire to do_fstrim_filesystems function

Change-Id: I4da3164343af83fae3e5b01700f43d1752661276
Signed-off-by: Young-ho Cha <ganadist@gmail.com>
2015-02-26 18:45:52 +00:00
Elliott Hughes
721c3d0fa9 Fix missing #includes in system/vold.
Change-Id: I53611cf8373daf638b0cc45b7b3d17e4d3e7247e
2014-12-29 14:09:42 -08:00
JP Abgrall
0cd6cfcf3a fstrim: Use a local definition of the IOCTL FIDTRIM number
As it is not upstream, it doesn't belong in the external/kernel-headers
... or in bionic's cleaned up copy.

It matches what is in common/android-3.10.

Bug: 15593563
Change-Id: I6fa22cd823a88805ec57f973813ac69291069c7d
2014-08-07 18:44:37 -07:00
JP Abgrall
55cdafdf27 fstrim: fix typo in log message for FIDTRIM case
Bug: 15593563
Change-Id: I2b5fbbfb694e1b87de6c14ab63f1a5f803bbbc36
2014-08-07 16:50:44 -07:00
JP Abgrall
422bdb7e49 fstrim: prep for supporting a deep trim ioctl
This adds an "fstrim dodtrim" command which will attempt to use
the FIDTRIM ioctl() if FIDTRIM is defined in the uapi/linux/fs.h.
If not, it will fail with EINVAL.

If no FIDTRIM is defined, it does not affect the "fstrim dotrim".

Change-Id: Icbfd621abb592b170db06f749e5eedfd1175f723
2014-07-29 15:39:06 -07:00
Mark Salyzyn
3e971277db vold: suppress unused argument warning messages
Change-Id: Ic1ab533f756fbd44b1f2e5ae12e2f5736ace7740
2014-02-12 20:18:28 +00:00
Colin Cross
346c5b20cb vold: fix warnings for 64-bit
Replace MINOR(dev_t) and MAJOR(dev_t) with minor and major,
which cast to int.
Cast int to uintptr_t before casting to pointer

Change-Id: I59375518f15d27f400fcd4f8a8dfe5ebdd8350e6
2014-01-24 10:42:27 -08:00
Ken Sumrall
1ede90d504 am bc7d5088: vold: Have the fstrim log start and finish times in the event log
* commit 'bc7d5088f7f7cbd097f99d2f6d015e2c0a73cacb':
  vold: Have the fstrim log start and finish times in the event log
2013-05-08 15:03:52 -07:00
Ken Sumrall
bc7d5088f7 vold: Have the fstrim log start and finish times in the event log
bug: 8688454

Change-Id: I5540ab27d3ade2c42ee8fd0de6fbfc1d1e19e36f
2013-05-07 17:29:12 -07:00
Ken Sumrall
924d9defc6 am e78cd4f3: Grab a partial wakelock when doing fstrim
* commit 'e78cd4f33d2b7969f1baca2b274740e1b53b3121':
  Grab a partial wakelock when doing fstrim
2013-05-02 11:36:02 -07:00
Ken Sumrall
e78cd4f33d Grab a partial wakelock when doing fstrim
Fstrim can take a while, so grab a wakelock so it finishes now,
not when the user picks up the device and wakes it back up.

This change does not protect against multiple calls to fstrim
before the first one completes.  When the first one completes, it
will release the wakelock, and the device will go to sleep.
However, normal usage is this will not be invoked by the framework
more than once a day, so this should not be an issue.

Bug: 8781133

Change-Id: I8065d1380eaf52ca8a7ca308af66fb6e86d60a66
2013-05-01 23:37:45 -07:00
Ken Sumrall
2c4b563b3d vold: Do not print fstrim amount if ioctl returns an error
Change-Id: I8620ea67a774ead51bd6bd9b6e737bf3d634470b
2013-04-29 19:17:56 -07:00
Ken Sumrall
743a5ec96c vold: Perform fstrim work in a separate thread.
Some devices can take up to a few minutes to do fstrim.  If done
in the same thread as the rest of the vold command listener, then
vold is blocked from responding to any other commands until the
trim is done.  So create a thread to do the work, and return
immediately.

bug: 8688454

Change-Id: I780baae03ba7de2d3e805c3e9f103ec03be84c47
2013-04-22 19:21:07 -07:00
Ken Sumrall
b87937cdea Vold: Add the fstrim subsystem to vold
The fstrim subsystem implements the dotrim command, which goes
through all the writable filesystems on the device, and invokes
the FITRIM ioctl() on them.  This marks all the unused blocks on
the underlying flash device as unused, so the device performs better.

Change-Id: I5fc8c2f60e0bc823f162d0f89580fb288ecb2160
2013-03-22 02:19:15 -07:00