• Joel Becker's avatar
    ocfs2: No need to zero pages past i_size. · 693c241a
    Joel Becker authored
    When ocfs2 fills a hole, it does so by allocating clusters.  When a
    cluster is larger than the write, ocfs2 must zero the portions of the
    cluster outside of the write.  If the clustersize is smaller than a
    pagecache page, this is handled by the normal pagecache mechanisms, but
    when the clustersize is larger than a page, ocfs2's write code will zero
    the pages adjacent to the write.  This makes sure the entire cluster is
    zeroed correctly.
    
    Currently ocfs2 behaves exactly the same when writing past i_size.
    However, this means ocfs2 is writing zeroed pages for portions of a new
    cluster that are beyond i_size.  The page writeback code isn't expecting
    this.  It treats all pages past the one containing i_size as left behind
    due to a previous truncate operation.
    
    Thankfully, ocfs2 calculates the number of pages it will be working on
    up front.  The rest of the write code merely honors the original
    calculation.  We can simply trim the number of pages to only cover the
    actual file data.
    Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
    Cc: stable@kernel.org
    693c241a
aops.c 50.5 KB