aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorZheng Liu <wenqing.lz@taobao.com>2011-12-28 20:25:40 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-12-28 20:25:40 -0500
commitccb4d7af914e0fe9b2f1022f8ea6c300463fd5e6 (patch)
tree1e8f739dfdd2aadf667d608800b8cad551f13bd3 /fs/ext4
parent14c83c9fddf2e75bdd0c20f1072f35260e356484 (diff)
ext4: remove no longer used functions in inode.c
The functions ext4_block_truncate_page() and ext4_block_zero_page_range() are no longer used, so remove them. Signed-off-by: Zheng Liu <wenqing.lz@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4.h4
-rw-r--r--fs/ext4/inode.c120
2 files changed, 0 insertions, 124 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 5b0e26a1272d..ae2407f4502a 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1880,10 +1880,6 @@ extern int ext4_alloc_da_blocks(struct inode *inode);
1880extern void ext4_set_aops(struct inode *inode); 1880extern void ext4_set_aops(struct inode *inode);
1881extern int ext4_writepage_trans_blocks(struct inode *); 1881extern int ext4_writepage_trans_blocks(struct inode *);
1882extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); 1882extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1883extern int ext4_block_truncate_page(handle_t *handle,
1884 struct address_space *mapping, loff_t from);
1885extern int ext4_block_zero_page_range(handle_t *handle,
1886 struct address_space *mapping, loff_t from, loff_t length);
1887extern int ext4_discard_partial_page_buffers(handle_t *handle, 1883extern int ext4_discard_partial_page_buffers(handle_t *handle,
1888 struct address_space *mapping, loff_t from, 1884 struct address_space *mapping, loff_t from,
1889 loff_t length, int flags); 1885 loff_t length, int flags);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index ef9e8fdddfba..e6cc24dfa98d 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3301,126 +3301,6 @@ next:
3301 return err; 3301 return err;
3302} 3302}
3303 3303
3304/*
3305 * ext4_block_truncate_page() zeroes out a mapping from file offset `from'
3306 * up to the end of the block which corresponds to `from'.
3307 * This required during truncate. We need to physically zero the tail end
3308 * of that block so it doesn't yield old data if the file is later grown.
3309 */
3310int ext4_block_truncate_page(handle_t *handle,
3311 struct address_space *mapping, loff_t from)
3312{
3313 unsigned offset = from & (PAGE_CACHE_SIZE-1);
3314 unsigned length;
3315 unsigned blocksize;
3316 struct inode *inode = mapping->host;
3317
3318 blocksize = inode->i_sb->s_blocksize;
3319 length = blocksize - (offset & (blocksize - 1));
3320
3321 return ext4_block_zero_page_range(handle, mapping, from, length);
3322}
3323
3324/*
3325 * ext4_block_zero_page_range() zeros out a mapping of length 'length'
3326 * starting from file offset 'from'. The range to be zero'd must
3327 * be contained with in one block. If the specified range exceeds
3328 * the end of the block it will be shortened to end of the block
3329 * that cooresponds to 'from'
3330 */
3331int ext4_block_zero_page_range(handle_t *handle,
3332 struct address_space *mapping, loff_t from, loff_t length)
3333{
3334 ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT;
3335 unsigned offset = from & (PAGE_CACHE_SIZE-1);
3336 unsigned blocksize, max, pos;
3337 ext4_lblk_t iblock;
3338 struct inode *inode = mapping->host;
3339 struct buffer_head *bh;
3340 struct page *page;
3341 int err = 0;
3342
3343 page = find_or_create_page(mapping, from >> PAGE_CACHE_SHIFT,
3344 mapping_gfp_mask(mapping) & ~__GFP_FS);
3345 if (!page)
3346 return -ENOMEM;
3347
3348 blocksize = inode->i_sb->s_blocksize;
3349 max = blocksize - (offset & (blocksize - 1));
3350
3351 /*
3352 * correct length if it does not fall between
3353 * 'from' and the end of the block
3354 */
3355 if (length > max || length < 0)
3356 length = max;
3357
3358 iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
3359
3360 if (!page_has_buffers(page))
3361 create_empty_buffers(page, blocksize, 0);
3362
3363 /* Find the buffer that contains "offset" */
3364 bh = page_buffers(page);
3365 pos = blocksize;
3366 while (offset >= pos) {
3367 bh = bh->b_this_page;
3368 iblock++;
3369 pos += blocksize;
3370 }
3371
3372 err = 0;
3373 if (buffer_freed(bh)) {
3374 BUFFER_TRACE(bh, "freed: skip");
3375 goto unlock;
3376 }
3377
3378 if (!buffer_mapped(bh)) {
3379 BUFFER_TRACE(bh, "unmapped");
3380 ext4_get_block(inode, iblock, bh, 0);
3381 /* unmapped? It's a hole - nothing to do */
3382 if (!buffer_mapped(bh)) {
3383 BUFFER_TRACE(bh, "still unmapped");
3384 goto unlock;
3385 }
3386 }
3387
3388 /* Ok, it's mapped. Make sure it's up-to-date */
3389 if (PageUptodate(page))
3390 set_buffer_uptodate(bh);
3391
3392 if (!buffer_uptodate(bh)) {
3393 err = -EIO;
3394 ll_rw_block(READ, 1, &bh);
3395 wait_on_buffer(bh);
3396 /* Uhhuh. Read error. Complain and punt. */
3397 if (!buffer_uptodate(bh))
3398 goto unlock;
3399 }
3400
3401 if (ext4_should_journal_data(inode)) {
3402 BUFFER_TRACE(bh, "get write access");
3403 err = ext4_journal_get_write_access(handle, bh);
3404 if (err)
3405 goto unlock;
3406 }
3407
3408 zero_user(page, offset, length);
3409
3410 BUFFER_TRACE(bh, "zeroed end of block");
3411
3412 err = 0;
3413 if (ext4_should_journal_data(inode)) {
3414 err = ext4_handle_dirty_metadata(handle, inode, bh);
3415 } else
3416 mark_buffer_dirty(bh);
3417
3418unlock:
3419 unlock_page(page);
3420 page_cache_release(page);
3421 return err;
3422}
3423
3424int ext4_can_truncate(struct inode *inode) 3304int ext4_can_truncate(struct inode *inode)
3425{ 3305{
3426 if (S_ISREG(inode->i_mode)) 3306 if (S_ISREG(inode->i_mode))