首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android文件系统日志记录

Android文件系统日志记录
EN

Stack Overflow用户
提问于 2011-09-20 10:29:26
回答 1查看 1.6K关注 0票数 6

ext3有3个日志记录选项:日志、已排序和回写。根据维基百科entry的说法,对于崩溃恢复,这些风险从最低风险到最高风险不等。由于某种原因,Android版本的Linux只支持后两个选项,默认为写回。(我正在运行Froyo)

有没有办法添加对日志模式的支持?我希望在ext3的/data分区上执行此操作,该分区也是大多数文件写入发生的位置。我的设备没有电池,所以我需要确保当有人断开电源时它是防崩溃的。

如果有人感兴趣,可以在kernel/fs/ext3/Kconfig中定义Linux选项。具体的选项是EXT3_DEFAULTS_TO_ORDERED。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-02-23 00:19:40

解决方案是将以下内容添加到内核/fs/ext3/Kconfig中,并使用EXT3_DEFAULTS_TO_JOURNAL重新构建内核。

代码语言:javascript
复制
choice
    prompt "EXT3 default journal mode"
    default EXT3_DEFAULTS_TO_ORDERED
    help
      The journal mode options for ext3 have different tradeoffs
      between when data is guaranteed to be on disk and
      performance.  The use of "data=writeback" can cause
      unwritten data to appear in files after an system crash or
      power failure, which can be a security issue.  However,
      "data=ordered" mode can also result in major performance
      problems, including seconds-long delays before an fsync()
      call returns.  "data=journal" is the safest option but possibly
      the the great perfromance burden.  For details, see:

      http://ext4.wiki.kernel.org/index.php/Ext3_data_mode_tradeoffs

      If you have been historically happy with ext3's performance,
      data=ordered mode will be a safe choice.


config EXT3_DEFAULTS_TO_JOURNAL
    bool "Default to 'data=journal' in ext3"
    depends on EXT3_FS
    help
      Both data and metadata are journaled.  Should be safe
      against crashes, power failure, etc.


config EXT3_DEFAULTS_TO_ORDERED
    bool "Default to 'data=ordered' in ext3"
    depends on EXT3_FS
    help
      Only metadata are journaled. Data is written first and then
      metadata is update.  Mostly safe against crashes, power
      failures, etc., except if the anomally occurred while a file 
      is being overwritten.  Most of the time files are appended and
      not over written.

config EXT3_DEFAULTS_TO_WRITEBACK
    bool "Default to 'data=writeback' in ext3"
    depends on EXT3_FS
    help
      Ext2 with a fast ckfs.  Not always safe against crashes, 
      power failure, etc., but has the best preformance

endchoice
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7479414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档