diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/ChangeLog | 2 | ||||
-rw-r--r-- | fs/ntfs/aops.c | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index ed8d00150931..b1766642baf8 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -77,6 +77,8 @@ ToDo/Notes: | |||
77 | updating the times in the inode in ntfs_setattr(). | 77 | updating the times in the inode in ntfs_setattr(). |
78 | - Fixup handling of sparse, compressed, and encrypted attributes in | 78 | - Fixup handling of sparse, compressed, and encrypted attributes in |
79 | fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode(). | 79 | fs/ntfs/inode.c::ntfs_read_locked_{,attr_,index_}inode(). |
80 | - Make ntfs_write_block() not instantiate sparse blocks if they contain | ||
81 | only zeroes. | ||
80 | 82 | ||
81 | 2.1.23 - Implement extension of resident files and make writing safe as well as | 83 | 2.1.23 - Implement extension of resident files and make writing safe as well as |
82 | many bug fixes, cleanups, and enhancements... | 84 | many bug fixes, cleanups, and enhancements... |
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index 78adad7a988d..f3ad36d8b8c9 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -670,6 +670,27 @@ lock_retry_remap: | |||
670 | } | 670 | } |
671 | /* It is a hole, need to instantiate it. */ | 671 | /* It is a hole, need to instantiate it. */ |
672 | if (lcn == LCN_HOLE) { | 672 | if (lcn == LCN_HOLE) { |
673 | u8 *kaddr; | ||
674 | unsigned long *bpos, *bend; | ||
675 | |||
676 | /* Check if the buffer is zero. */ | ||
677 | kaddr = kmap_atomic(page, KM_USER0); | ||
678 | bpos = (unsigned long *)(kaddr + bh_offset(bh)); | ||
679 | bend = (unsigned long *)((u8*)bpos + blocksize); | ||
680 | do { | ||
681 | if (unlikely(*bpos)) | ||
682 | break; | ||
683 | } while (likely(++bpos < bend)); | ||
684 | kunmap_atomic(kaddr, KM_USER0); | ||
685 | if (bpos == bend) { | ||
686 | /* | ||
687 | * Buffer is zero and sparse, no need to write | ||
688 | * it. | ||
689 | */ | ||
690 | bh->b_blocknr = -1; | ||
691 | clear_buffer_dirty(bh); | ||
692 | continue; | ||
693 | } | ||
673 | // TODO: Instantiate the hole. | 694 | // TODO: Instantiate the hole. |
674 | // clear_buffer_new(bh); | 695 | // clear_buffer_new(bh); |
675 | // unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr); | 696 | // unmap_underlying_metadata(bh->b_bdev, bh->b_blocknr); |