diff options
author | Lukas Czerner <lczerner@redhat.com> | 2013-05-27 23:32:35 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-05-27 23:32:35 -0400 |
commit | c121ffd013e5ab7c04414a5f0cb3604731775174 (patch) | |
tree | 672bc9385b43c52530d70749f4a2bf4d2bbd7be2 /fs/ext4 | |
parent | a87dd18ce24dee5da1e9eb44bf8d8d48e0957efd (diff) |
ext4: remove unused discard_partial_page_buffers
The discard_partial_page_buffers is no longer used anywhere so we can
simply remove it including the *_no_lock variant and
EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED define.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 8 | ||||
-rw-r--r-- | fs/ext4/inode.c | 206 |
2 files changed, 0 insertions, 214 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 2d4b0aa74859..019db3c1bc3b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -581,11 +581,6 @@ enum { | |||
581 | #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020 | 581 | #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020 |
582 | 582 | ||
583 | /* | 583 | /* |
584 | * Flags used by ext4_discard_partial_page_buffers | ||
585 | */ | ||
586 | #define EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED 0x0001 | ||
587 | |||
588 | /* | ||
589 | * ioctl commands | 584 | * ioctl commands |
590 | */ | 585 | */ |
591 | #define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS | 586 | #define EXT4_IOC_GETFLAGS FS_IOC_GETFLAGS |
@@ -2102,9 +2097,6 @@ extern int ext4_block_zero_page_range(handle_t *handle, | |||
2102 | struct address_space *mapping, loff_t from, loff_t length); | 2097 | struct address_space *mapping, loff_t from, loff_t length); |
2103 | extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, | 2098 | extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode, |
2104 | loff_t lstart, loff_t lend); | 2099 | loff_t lstart, loff_t lend); |
2105 | extern int ext4_discard_partial_page_buffers(handle_t *handle, | ||
2106 | struct address_space *mapping, loff_t from, | ||
2107 | loff_t length, int flags); | ||
2108 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 2100 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
2109 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 2101 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
2110 | extern void ext4_da_update_reserve_space(struct inode *inode, | 2102 | extern void ext4_da_update_reserve_space(struct inode *inode, |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3acf353493d4..0fca5a8c6d3e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -136,9 +136,6 @@ static void ext4_invalidatepage(struct page *page, unsigned int offset, | |||
136 | unsigned int length); | 136 | unsigned int length); |
137 | static int __ext4_journalled_writepage(struct page *page, unsigned int len); | 137 | static int __ext4_journalled_writepage(struct page *page, unsigned int len); |
138 | static int ext4_bh_delay_or_unwritten(handle_t *handle, struct buffer_head *bh); | 138 | static int ext4_bh_delay_or_unwritten(handle_t *handle, struct buffer_head *bh); |
139 | static int ext4_discard_partial_page_buffers_no_lock(handle_t *handle, | ||
140 | struct inode *inode, struct page *page, loff_t from, | ||
141 | loff_t length, int flags); | ||
142 | 139 | ||
143 | /* | 140 | /* |
144 | * Test whether an inode is a fast symlink. | 141 | * Test whether an inode is a fast symlink. |
@@ -3367,209 +3364,6 @@ void ext4_set_aops(struct inode *inode) | |||
3367 | inode->i_mapping->a_ops = &ext4_aops; | 3364 | inode->i_mapping->a_ops = &ext4_aops; |
3368 | } | 3365 | } |
3369 | 3366 | ||
3370 | |||
3371 | /* | ||
3372 | * ext4_discard_partial_page_buffers() | ||
3373 | * Wrapper function for ext4_discard_partial_page_buffers_no_lock. | ||
3374 | * This function finds and locks the page containing the offset | ||
3375 | * "from" and passes it to ext4_discard_partial_page_buffers_no_lock. | ||
3376 | * Calling functions that already have the page locked should call | ||
3377 | * ext4_discard_partial_page_buffers_no_lock directly. | ||
3378 | */ | ||
3379 | int ext4_discard_partial_page_buffers(handle_t *handle, | ||
3380 | struct address_space *mapping, loff_t from, | ||
3381 | loff_t length, int flags) | ||
3382 | { | ||
3383 | struct inode *inode = mapping->host; | ||
3384 | struct page *page; | ||
3385 | int err = 0; | ||
3386 | |||
3387 | page = find_or_create_page(mapping, from >> PAGE_CACHE_SHIFT, | ||
3388 | mapping_gfp_mask(mapping) & ~__GFP_FS); | ||
3389 | if (!page) | ||
3390 | return -ENOMEM; | ||
3391 | |||
3392 | err = ext4_discard_partial_page_buffers_no_lock(handle, inode, page, | ||
3393 | from, length, flags); | ||
3394 | |||
3395 | unlock_page(page); | ||
3396 | page_cache_release(page); | ||
3397 | return err; | ||
3398 | } | ||
3399 | |||
3400 | /* | ||
3401 | * ext4_discard_partial_page_buffers_no_lock() | ||
3402 | * Zeros a page range of length 'length' starting from offset 'from'. | ||
3403 | * Buffer heads that correspond to the block aligned regions of the | ||
3404 | * zeroed range will be unmapped. Unblock aligned regions | ||
3405 | * will have the corresponding buffer head mapped if needed so that | ||
3406 | * that region of the page can be updated with the partial zero out. | ||
3407 | * | ||
3408 | * This function assumes that the page has already been locked. The | ||
3409 | * The range to be discarded must be contained with in the given page. | ||
3410 | * If the specified range exceeds the end of the page it will be shortened | ||
3411 | * to the end of the page that corresponds to 'from'. This function is | ||
3412 | * appropriate for updating a page and it buffer heads to be unmapped and | ||
3413 | * zeroed for blocks that have been either released, or are going to be | ||
3414 | * released. | ||
3415 | * | ||
3416 | * handle: The journal handle | ||
3417 | * inode: The files inode | ||
3418 | * page: A locked page that contains the offset "from" | ||
3419 | * from: The starting byte offset (from the beginning of the file) | ||
3420 | * to begin discarding | ||
3421 | * len: The length of bytes to discard | ||
3422 | * flags: Optional flags that may be used: | ||
3423 | * | ||
3424 | * EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED | ||
3425 | * Only zero the regions of the page whose buffer heads | ||
3426 | * have already been unmapped. This flag is appropriate | ||
3427 | * for updating the contents of a page whose blocks may | ||
3428 | * have already been released, and we only want to zero | ||
3429 | * out the regions that correspond to those released blocks. | ||
3430 | * | ||
3431 | * Returns zero on success or negative on failure. | ||
3432 | */ | ||
3433 | static int ext4_discard_partial_page_buffers_no_lock(handle_t *handle, | ||
3434 | struct inode *inode, struct page *page, loff_t from, | ||
3435 | loff_t length, int flags) | ||
3436 | { | ||
3437 | ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT; | ||
3438 | unsigned int offset = from & (PAGE_CACHE_SIZE-1); | ||
3439 | unsigned int blocksize, max, pos; | ||
3440 | ext4_lblk_t iblock; | ||
3441 | struct buffer_head *bh; | ||
3442 | int err = 0; | ||
3443 | |||
3444 | blocksize = inode->i_sb->s_blocksize; | ||
3445 | max = PAGE_CACHE_SIZE - offset; | ||
3446 | |||
3447 | if (index != page->index) | ||
3448 | return -EINVAL; | ||
3449 | |||
3450 | /* | ||
3451 | * correct length if it does not fall between | ||
3452 | * 'from' and the end of the page | ||
3453 | */ | ||
3454 | if (length > max || length < 0) | ||
3455 | length = max; | ||
3456 | |||
3457 | iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); | ||
3458 | |||
3459 | if (!page_has_buffers(page)) | ||
3460 | create_empty_buffers(page, blocksize, 0); | ||
3461 | |||
3462 | /* Find the buffer that contains "offset" */ | ||
3463 | bh = page_buffers(page); | ||
3464 | pos = blocksize; | ||
3465 | while (offset >= pos) { | ||
3466 | bh = bh->b_this_page; | ||
3467 | iblock++; | ||
3468 | pos += blocksize; | ||
3469 | } | ||
3470 | |||
3471 | pos = offset; | ||
3472 | while (pos < offset + length) { | ||
3473 | unsigned int end_of_block, range_to_discard; | ||
3474 | |||
3475 | err = 0; | ||
3476 | |||
3477 | /* The length of space left to zero and unmap */ | ||
3478 | range_to_discard = offset + length - pos; | ||
3479 | |||
3480 | /* The length of space until the end of the block */ | ||
3481 | end_of_block = blocksize - (pos & (blocksize-1)); | ||
3482 | |||
3483 | /* | ||
3484 | * Do not unmap or zero past end of block | ||
3485 | * for this buffer head | ||
3486 | */ | ||
3487 | if (range_to_discard > end_of_block) | ||
3488 | range_to_discard = end_of_block; | ||
3489 | |||
3490 | |||
3491 | /* | ||
3492 | * Skip this buffer head if we are only zeroing unampped | ||
3493 | * regions of the page | ||
3494 | */ | ||
3495 | if (flags & EXT4_DISCARD_PARTIAL_PG_ZERO_UNMAPPED && | ||
3496 | buffer_mapped(bh)) | ||
3497 | goto next; | ||
3498 | |||
3499 | /* If the range is block aligned, unmap */ | ||
3500 | if (range_to_discard == blocksize) { | ||
3501 | clear_buffer_dirty(bh); | ||
3502 | bh->b_bdev = NULL; | ||
3503 | clear_buffer_mapped(bh); | ||
3504 | clear_buffer_req(bh); | ||
3505 | clear_buffer_new(bh); | ||
3506 | clear_buffer_delay(bh); | ||
3507 | clear_buffer_unwritten(bh); | ||
3508 | clear_buffer_uptodate(bh); | ||
3509 | zero_user(page, pos, range_to_discard); | ||
3510 | BUFFER_TRACE(bh, "Buffer discarded"); | ||
3511 | goto next; | ||
3512 | } | ||
3513 | |||
3514 | /* | ||
3515 | * If this block is not completely contained in the range | ||
3516 | * to be discarded, then it is not going to be released. Because | ||
3517 | * we need to keep this block, we need to make sure this part | ||
3518 | * of the page is uptodate before we modify it by writeing | ||
3519 | * partial zeros on it. | ||
3520 | */ | ||
3521 | if (!buffer_mapped(bh)) { | ||
3522 | /* | ||
3523 | * Buffer head must be mapped before we can read | ||
3524 | * from the block | ||
3525 | */ | ||
3526 | BUFFER_TRACE(bh, "unmapped"); | ||
3527 | ext4_get_block(inode, iblock, bh, 0); | ||
3528 | /* unmapped? It's a hole - nothing to do */ | ||
3529 | if (!buffer_mapped(bh)) { | ||
3530 | BUFFER_TRACE(bh, "still unmapped"); | ||
3531 | goto next; | ||
3532 | } | ||
3533 | } | ||
3534 | |||
3535 | /* Ok, it's mapped. Make sure it's up-to-date */ | ||
3536 | if (PageUptodate(page)) | ||
3537 | set_buffer_uptodate(bh); | ||
3538 | |||
3539 | if (!buffer_uptodate(bh)) { | ||
3540 | err = -EIO; | ||
3541 | ll_rw_block(READ, 1, &bh); | ||
3542 | wait_on_buffer(bh); | ||
3543 | /* Uhhuh. Read error. Complain and punt.*/ | ||
3544 | if (!buffer_uptodate(bh)) | ||
3545 | goto next; | ||
3546 | } | ||
3547 | |||
3548 | if (ext4_should_journal_data(inode)) { | ||
3549 | BUFFER_TRACE(bh, "get write access"); | ||
3550 | err = ext4_journal_get_write_access(handle, bh); | ||
3551 | if (err) | ||
3552 | goto next; | ||
3553 | } | ||
3554 | |||
3555 | zero_user(page, pos, range_to_discard); | ||
3556 | |||
3557 | err = 0; | ||
3558 | if (ext4_should_journal_data(inode)) { | ||
3559 | err = ext4_handle_dirty_metadata(handle, inode, bh); | ||
3560 | } else | ||
3561 | mark_buffer_dirty(bh); | ||
3562 | |||
3563 | BUFFER_TRACE(bh, "Partial buffer zeroed"); | ||
3564 | next: | ||
3565 | bh = bh->b_this_page; | ||
3566 | iblock++; | ||
3567 | pos += range_to_discard; | ||
3568 | } | ||
3569 | |||
3570 | return err; | ||
3571 | } | ||
3572 | |||
3573 | /* | 3367 | /* |
3574 | * ext4_block_truncate_page() zeroes out a mapping from file offset `from' | 3368 | * ext4_block_truncate_page() zeroes out a mapping from file offset `from' |
3575 | * up to the end of the block which corresponds to `from'. | 3369 | * up to the end of the block which corresponds to `from'. |