Skip to content
  • Li Wang's avatar
    eCryptfs: Avoid unnecessary disk read and data decryption during writing · e4bc6522
    Li Wang authored
    
    
    ecryptfs_write_begin grabs a page from page cache for writing.
    If the page contains invalid data, or data older than the
    counterpart on the disk, eCryptfs will read out the
    corresponing data from the disk into the page, decrypt them,
    then perform writing. However, for this page, if the length
    of the data to be written into is equal to page size,
    that means the whole page of data will be overwritten,
    in which case, it does not matter whatever the data were before,
    it is beneficial to perform writing directly rather than bothering
    to read and decrypt first.
    
    With this optimization, according to our test on a machine with
    Intel Core 2 Duo processor, iozone 'write' operation on an existing
    file with write size being multiple of page size will enjoy a steady
    3x speedup.
    
    Signed-off-by: default avatarLi Wang <wangli@kylinos.com.cn>
    Signed-off-by: default avatarYunchuan Wen <wenyunchuan@kylinos.com.cn>
    Signed-off-by: default avatarTyler Hicks <tyhicks@canonical.com>
    e4bc6522