Skip to content

Commit ccb4d7a

Browse files
gnehzuiltytso
authored andcommitted
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 <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent 14c83c9 commit ccb4d7a

File tree

2 files changed

+0
-124
lines changed

2 files changed

+0
-124
lines changed

fs/ext4/ext4.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1880,10 +1880,6 @@ extern int ext4_alloc_da_blocks(struct inode *inode);
18801880
extern void ext4_set_aops(struct inode *inode);
18811881
extern int ext4_writepage_trans_blocks(struct inode *);
18821882
extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1883-
extern int ext4_block_truncate_page(handle_t *handle,
1884-
struct address_space *mapping, loff_t from);
1885-
extern int ext4_block_zero_page_range(handle_t *handle,
1886-
struct address_space *mapping, loff_t from, loff_t length);
18871883
extern int ext4_discard_partial_page_buffers(handle_t *handle,
18881884
struct address_space *mapping, loff_t from,
18891885
loff_t length, int flags);

fs/ext4/inode.c

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,126 +3301,6 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
33013301
return err;
33023302
}
33033303

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-
*/
3310-
int 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-
*/
3331-
int 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-
3418-
unlock:
3419-
unlock_page(page);
3420-
page_cache_release(page);
3421-
return err;
3422-
}
3423-
34243304
int ext4_can_truncate(struct inode *inode)
34253305
{
34263306
if (S_ISREG(inode->i_mode))

0 commit comments

Comments
 (0)