aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/aops.c
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-09-08 16:25:48 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-09-08 16:25:48 -0400
commit8dcdebafb848415eae25924b00c4f0b9ec907da0 (patch)
tree5e7289dca23148d6b157817c6272c0fc3460f449 /fs/ntfs/aops.c
parent67bb103725e4cde322cb4ddb160a12933c5c7072 (diff)
NTFS: Make ntfs_write_block() not instantiate sparse blocks if they are zero.
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs/aops.c')
-rw-r--r--fs/ntfs/aops.c21
1 files changed, 21 insertions, 0 deletions
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);