lkml.org 
[lkml]   [2005]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 18/25] NTFS: Make ntfs_write_block() not instantiate sparse blocks if they are zero.
    [PATCH 18/25] NTFS: Make ntfs_write_block() not instantiate sparse blocks if they are zero.

    Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

    ---

    fs/ntfs/ChangeLog | 2 ++
    fs/ntfs/aops.c | 21 +++++++++++++++++++++
    2 files changed, 23 insertions(+), 0 deletions(-)

    8dcdebafb848415eae25924b00c4f0b9ec907da0
    diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
    --- a/fs/ntfs/ChangeLog
    +++ b/fs/ntfs/ChangeLog
    @@ -77,6 +77,8 @@ ToDo/Notes:
    updating the times in the inode in ntfs_setattr().
    - Fixup handling of sparse, compressed, and encrypted attributes in
    fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode().
    + - Make ntfs_write_block() not instantiate sparse blocks if they contain
    + only zeroes.

    2.1.23 - Implement extension of resident files and make writing safe as well as
    many bug fixes, cleanups, and enhancements...
    diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
    --- a/fs/ntfs/aops.c
    +++ b/fs/ntfs/aops.c
    @@ -670,6 +670,27 @@ lock_retry_remap:
    }
    /* It is a hole, need to instantiate it. */
    if (lcn == LCN_HOLE) {
    + u8 *kaddr;
    + unsigned long *bpos, *bend;
    +
    + /* Check if the buffer is zero. */
    + kaddr = kmap_atomic(page, KM_USER0);
    + bpos = (unsigned long *)(kaddr + bh_offset(bh));
    + bend = (unsigned long *)((u8*)bpos + blocksize);
    + do {
    + if (unlikely(*bpos))
    + break;
    + } while (likely(++bpos < bend));
    + kunmap_atomic(kaddr, KM_USER0);
    + if (bpos == bend) {
    + /*
    + * Buffer is zero and sparse, no need to write
    + * it.
    + */
    + bh->b_blocknr = -1;
    + clear_buffer_dirty(bh);
    + continue;
    + }
    // TODO: Instantiate the hole.
    // clear_buffer_new(bh);
    // unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr);
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2005-09-09 11:32    [W:0.025 / U:0.340 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site