Commit Graph

12 Commits

Author SHA1 Message Date
David Anderson ce135a67af storaged: lower capabilities in init
Lower storaged's capabilities to DAC_READ_SEARCH as an initial step
toward running it non-root.

Bug: 77634061
Test: storaged still runs and its /proc/pid/status has lower CapPrms
Exempt-From-Owner-Approval: stale OWNERS no longer in org
Change-Id: Ibfe0349fc059e2f37efba33f587176e8ce6be9fe
Merged-In: Ibfe0349fc059e2f37efba33f587176e8ce6be9fe
2018-04-13 11:27:48 -07:00
Jin Qian 6df3bc6301 storaged: split proto file into multiple CE areas
Use user_id (from app uid) to determine file location.
/data/misc_ce/<user_id>/storaged/storaged.proto

Vold notifies storaged when a user's CE area becomes available.
Then storaged restores data from the proto in that area and
combines them into IO history.

Vold also notifies storaged when the CE area is being deleted.
Storaged clears internal history about this user and deletes the
proto file.

IO perf is stored in user_0 area since it's not user related.

Test: dumpsys storaged before/after multiple users' unlock
Bug: 63740245
Change-Id: I39f923f6b09e9f2a29e9286ce02b3b3bcbfb9f94
2017-10-31 14:31:13 -07:00
Jin Qian a8533325d5 storaged: move proto file to /data/misc_ce/0/storaged
Use proto_stat to indicate status of CE area. Before user_0 unlocks,
storaged detects CE NOT_AVAILABLE when attempting to read the proto
file. It then skips reading/writting the proto.

When user_0 logs in, vold calls onUserStart in storaged, which sets
proto_stat to AVAILABLE. At next event, storaged tries to read the
proto. If it's a success, proto_stat is changed to LOADED. After that,
storaged reads and writes proto normally.

Test: adb shell storaged -u -p
Bug: 63740245
Change-Id: I1fdd42c430e91682f6cc07497fcad5be52489b4e
2017-10-18 13:50:03 -07:00
Jin Qian ebf031be98 storaged: store io_history as protobuf file on userdata
Convert storaged internal io_history to protobuf format and serialize
it to userdata partition. Also load this file during storaged startup
to reconstruct io history.

Bug: 63740245
Change-Id: I0697525df1c31fdec20f5ed4e3e9363e2dde244f
2017-08-15 17:00:19 -07:00
Jin Qian f97e6e7dd4 storaged: reduce storaged privilege
Remove storaged from system group.
Let init set priority based on rc file.

Test: adb shell dumpsys storaged --force
Bug: 35323867
Change-Id: I9d893ec69d9cc34a9e24f47166384efd7ef4d9d2
2017-02-27 12:52:04 -08:00
Jin Qian 821eb0d007 storaged: fix selinux dac_override denial
Bug: 35250057
Bug: 34198239
Change-Id: I18592d298765dc46ab05f25ae2ced0a5eddacc8b
2017-02-10 18:33:13 -08:00
Jin Qian 88ad33eff1 storaged: remove task io code
Bug: 34612499
Change-Id: Id0599ee2ae025a186259e95363c1ddd0feae8079
2017-01-24 14:45:50 -08:00
Jin Qian eabad63def Revert "Revert "storaged: assign to system-background cpuset""
This reverts commit b7ef979639.

Change-Id: Ib9478701c67dbddf2f76480ae6ca6e0a9145a778
2017-01-20 10:08:53 +00:00
Jin Qian b7ef979639 Revert "storaged: assign to system-background cpuset"
This reverts commit e1d4b072ff.

Change-Id: I6be0af0e85efff672ea95e9a05c33618cd994dd5
2017-01-20 07:23:48 +00:00
Jin Qian e1d4b072ff storaged: assign to system-background cpuset
Bug: 34388593
Change-Id: I11d904cade1d67e54b5e651b6fc1ad34d365690e
2017-01-18 13:12:33 -08:00
Jin Qian 535ddbe2c9 storaged: replace kmsg with LOG macros
Also convert android_log_event to C++ style calls.

Change-Id: I7d62c81789fe7925fe9cae3e2a798b6af8c8be9d
2017-01-13 19:02:23 +00:00
ynwang 62cb372279 storaged: add storaged native daemon
Storaged periodically checks the devices' disk stats and eMMC lifetime.
This information is logged to both the kernel and event log. By event
logging, the data can be aggregated by the checkin service and then
sent to Sawmill.

It also periodically traverses /proc/[pid], maintaining the I/O usage of
all tasks (all sampled tasks). The task I/O data can be reported using
the --dump option.

Storaged is booted when the device boots up and requires the permission
for reading /proc/diskstats, /proc/[pid]/io and debugfs(eMMC ext_csd).
For detailed description, please refer to go/storaged.

Bug: 28826771
Change-Id: I774b1a44cc30092bac1bfcbc08bf487295e7cfed
2016-12-15 15:56:33 -08:00