满血复活:安卓4.3为所有Nexus带来TRIM
  • 上方文Q
  • 2013年07月30日 10:12
  • 0

接触固态硬盘的应该都会关心耐用性、寿命这样的指标,这源于闪存存储的特质。现代智能手机、平板机使用的基本也是闪存,但因为日常负载都是轻量级的,所以很少碰到类似问题,但也有例外。

Nexus 7(旧版)就是比较突出的一个,它本身的存储I/O性能就不太够,影响系统流畅性,特别是随着时间的流逝、应用的增多,很容易会变得非常慢,大大影响了人们对这款平板的评价。

新版的Nexus 7大大提升了存储性能,而且借助新的安卓4.3,耐用性问题也得到了解决。事实上,所有的Nexus设备都能享受这种福利!

昨天对新Nexus 7的评测中我们就已经说过,安卓4.3开启了fstrim——其实就是我们常说的TRIM,只不过后者是Windows系统的,它则是Linux系统的。它们的原理是相同的:在主控和闪存之间建立一个通信通道,操作系统籍此告知SSD/eMMC主控某些闪存区块已经不再使用,无需继续追踪,可以执行垃圾回收了。

这对维持闪存存储长时间性能稳定是至关重要的。要知道,在闪存设备上删除软件的时候,执行的只是一个软件标记,让用户看起来空间释放了,但物理存储并未发生变化,在主控看来响应的区块还在使用中,仍旧有正常数据。

比如说,你向手机存储中拷贝了一部3GB的电影,看完了删了,3GB空间看起来解放了,但在你重新向这些区块写入数据之前,在主控眼里,电影还在那儿。

安卓4.3对此是这么处理的:系统框架发出一个“start idle maintenance window”(开始空闲维护窗口)的事件,MountService系统服务接听到之后,便通过磁盘管理进程vold联系fstrim文件系统,执行清理。

不过这一系列操作是需要满足一定前提条件才会触发的:设备未使用超过一个小时、过往24小时没有空闲维护窗口事件、电池剩余电量不低于80%、设备正在充电且电量不低于30%。

如果你习惯每天晚上插上充电,fstrim会大概每24小时执行一次。

验证fstrim是否工作也很简单,只要在ADB中执行以下命令:

adb logcat -d | grep -i fstrim

下边就是输出示例(系统都是4.3):

Nexus 7 (2013):

┌─[brianklug@MBP] - [~/Downloads/APKs] - [Mon Jul 29, 03:30] └─[$] <> ./adb  logcat -d | grep -i fstrim I/fstrim  (  172): Starting fstrim work... I/fstrim  (  172): Invoking FITRIM ioctl on /cache I/fstrim  (  172): Trimmed 564789248 bytes on /cache I/fstrim  (  172): Invoking FITRIM ioctl on /data I/fstrim  (  172): Trimmed 25105637376 bytes on /data I/fstrim  (  172): Invoking FITRIM ioctl on /persist I/fstrim  (  172): Trimmed 0 bytes on /persist I/fstrim  (  172): Finished fstrim work. I/fstrim  (  172): Starting fstrim work... I/fstrim  (  172): Invoking FITRIM ioctl on /cache I/fstrim  (  172): Trimmed 0 bytes on /cache I/fstrim  (  172): Invoking FITRIM ioctl on /data I/fstrim  (  172): Trimmed 1045696512 bytes on /data I/fstrim  (  172): Invoking FITRIM ioctl on /persist I/fstrim  (  172): Trimmed 0 bytes on /persist I/fstrim  (  172): Finished fstrim work.

Nexus 7 (2012):

┌─[brianklug@MBP] - [~/Downloads/APKs] - [Mon Jul 29, 03:46] └─[$] <> ./adb  logcat -d | grep -i fstrim I/fstrim  (  122): Starting fstrim work... I/fstrim  (  122): Invoking FITRIM ioctl on /cache I/fstrim  (  122): Trimmed 122961920 bytes on /cache I/fstrim  (  122): Invoking FITRIM ioctl on /data I/fstrim  (  122): Trimmed 1087574016 bytes on /data E/fstrim  (  122): Cannot stat mount point /radio I/fstrim  (  122): Finished fstrim work. I/fstrim  (  122): Starting fstrim work... I/fstrim  (  122): Invoking FITRIM ioctl on /cache I/fstrim  (  122): Trimmed 118923264 bytes on /cache I/fstrim  (  122): Invoking FITRIM ioctl on /data I/fstrim  (  122): Trimmed 782077952 bytes on /data E/fstrim  (  122): Cannot stat mount point /radio I/fstrim  (  122): Finished fstrim work. Nexus 4:

┌─[brianklug@MBP] - [~/Downloads/APKs] - [Mon Jul 29, 03:47] └─[$] <> ./adb  logcat -d | grep -i fstrim - waiting for device - I/fstrim  (  169): Starting fstrim work... I/fstrim  (  169): Invoking FITRIM ioctl on /cache I/fstrim  (  169): Trimmed 115343360 bytes on /cache I/fstrim  (  169): Invoking FITRIM ioctl on /data I/fstrim  (  169): Trimmed 888254464 bytes on /data I/fstrim  (  169): Invoking FITRIM ioctl on /persist I/fstrim  (  169): Trimmed 0 bytes on /persist I/fstrim  (  169): Finished fstrim work. I/fstrim  (  169): Starting fstrim work... I/fstrim  (  169): Invoking FITRIM ioctl on /cache I/fstrim  (  169): Trimmed 113246208 bytes on /cache I/fstrim  (  169): Invoking FITRIM ioctl on /data I/fstrim  (  169): Trimmed 1431195648 bytes on /data I/fstrim  (  169): Invoking FITRIM ioctl on /persist I/fstrim  (  169): Trimmed 0 bytes on /persist I/fstrim  (  169): Finished fstrim work.

如果你的设备经历着性能倒退的问题,升级到4.3之后让sftrim工作几次应该就能满血复活了。至于究竟能恢复多少,请等测试。

满血复活:安卓4.3为所有Nexus带来TRIM

 

文章纠错

  • 好文点赞
  • 水文反对

此文章为快科技原创文章,快科技网站保留文章图片及文字内容版权,如需转载此文章请注明出处:快科技

观点发布 网站评论、账号管理说明
热门评论
查看全部0条评论
相关报道

最热文章排行查看排行详情

邮件订阅

评论0 | 点赞0| 分享0 | 收藏0