extents.c (9ea7a0df63630ad8197716cd313ea66e28906fc0) | extents.c (189e868fa8fdca702eb9db9d8afc46b5cb9144c9) |
---|---|
1/* 2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 * Written by Alex Tomas <alex@clusterfs.com> 4 * 5 * Architecture independence: 6 * Copyright (c) 2005, Bull S.A. 7 * Written by Pierre Peiffer <pierre.peiffer@bull.net> 8 * --- 3639 unchanged lines hidden (view full) --- 3648} 3649 3650void ext4_ext_truncate(struct inode *inode) 3651{ 3652 struct address_space *mapping = inode->i_mapping; 3653 struct super_block *sb = inode->i_sb; 3654 ext4_lblk_t last_block; 3655 handle_t *handle; | 1/* 2 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 * Written by Alex Tomas <alex@clusterfs.com> 4 * 5 * Architecture independence: 6 * Copyright (c) 2005, Bull S.A. 7 * Written by Pierre Peiffer <pierre.peiffer@bull.net> 8 * --- 3639 unchanged lines hidden (view full) --- 3648} 3649 3650void ext4_ext_truncate(struct inode *inode) 3651{ 3652 struct address_space *mapping = inode->i_mapping; 3653 struct super_block *sb = inode->i_sb; 3654 ext4_lblk_t last_block; 3655 handle_t *handle; |
3656 loff_t page_len; |
|
3656 int err = 0; 3657 3658 /* 3659 * finish any pending end_io work so we won't run the risk of 3660 * converting any truncated blocks to initialized later 3661 */ 3662 ext4_flush_completed_IO(inode); 3663 3664 /* 3665 * probably first extent we're gonna free will be last in block 3666 */ 3667 err = ext4_writepage_trans_blocks(inode); 3668 handle = ext4_journal_start(inode, err); 3669 if (IS_ERR(handle)) 3670 return; 3671 | 3657 int err = 0; 3658 3659 /* 3660 * finish any pending end_io work so we won't run the risk of 3661 * converting any truncated blocks to initialized later 3662 */ 3663 ext4_flush_completed_IO(inode); 3664 3665 /* 3666 * probably first extent we're gonna free will be last in block 3667 */ 3668 err = ext4_writepage_trans_blocks(inode); 3669 handle = ext4_journal_start(inode, err); 3670 if (IS_ERR(handle)) 3671 return; 3672 |
3672 if (inode->i_size & (sb->s_blocksize - 1)) 3673 ext4_block_truncate_page(handle, mapping, inode->i_size); | 3673 if (inode->i_size % PAGE_CACHE_SIZE != 0) { 3674 page_len = PAGE_CACHE_SIZE - 3675 (inode->i_size & (PAGE_CACHE_SIZE - 1)); |
3674 | 3676 |
3677 err = ext4_discard_partial_page_buffers(handle, 3678 mapping, inode->i_size, page_len, 0); 3679 3680 if (err) 3681 goto out_stop; 3682 } 3683 |
|
3675 if (ext4_orphan_add(handle, inode)) 3676 goto out_stop; 3677 3678 down_write(&EXT4_I(inode)->i_data_sem); 3679 ext4_ext_invalidate_cache(inode); 3680 3681 ext4_discard_preallocations(inode); 3682 --- 722 unchanged lines hidden --- | 3684 if (ext4_orphan_add(handle, inode)) 3685 goto out_stop; 3686 3687 down_write(&EXT4_I(inode)->i_data_sem); 3688 ext4_ext_invalidate_cache(inode); 3689 3690 ext4_discard_preallocations(inode); 3691 --- 722 unchanged lines hidden --- |