mirror of https://gitee.com/openkylin/linux.git
[XFS] remove unused vars, args, & unneeded intermediate vars from zeroing
code SGI-PV: 946641 SGI-Modid: xfs-linux-melb:xfs-kern:203328a Signed-off-by: Eric Sandeen <sandeen@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
parent
65be605419
commit
24ee80882d
|
@ -362,7 +362,6 @@ STATIC int /* error (positive) */
|
|||
xfs_zero_last_block(
|
||||
struct inode *ip,
|
||||
xfs_iocore_t *io,
|
||||
xfs_off_t offset,
|
||||
xfs_fsize_t isize,
|
||||
xfs_fsize_t end_size)
|
||||
{
|
||||
|
@ -371,19 +370,16 @@ xfs_zero_last_block(
|
|||
int nimaps;
|
||||
int zero_offset;
|
||||
int zero_len;
|
||||
int isize_fsb_offset;
|
||||
int error = 0;
|
||||
xfs_bmbt_irec_t imap;
|
||||
loff_t loff;
|
||||
size_t lsize;
|
||||
|
||||
ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0);
|
||||
ASSERT(offset > isize);
|
||||
|
||||
mp = io->io_mount;
|
||||
|
||||
isize_fsb_offset = XFS_B_FSB_OFFSET(mp, isize);
|
||||
if (isize_fsb_offset == 0) {
|
||||
zero_offset = XFS_B_FSB_OFFSET(mp, isize);
|
||||
if (zero_offset == 0) {
|
||||
/*
|
||||
* There are no extra bytes in the last block on disk to
|
||||
* zero, so return.
|
||||
|
@ -413,10 +409,8 @@ xfs_zero_last_block(
|
|||
*/
|
||||
XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD);
|
||||
loff = XFS_FSB_TO_B(mp, last_fsb);
|
||||
lsize = XFS_FSB_TO_B(mp, 1);
|
||||
|
||||
zero_offset = isize_fsb_offset;
|
||||
zero_len = mp->m_sb.sb_blocksize - isize_fsb_offset;
|
||||
zero_len = mp->m_sb.sb_blocksize - zero_offset;
|
||||
|
||||
error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size);
|
||||
|
||||
|
@ -447,20 +441,17 @@ xfs_zero_eof(
|
|||
struct inode *ip = LINVFS_GET_IP(vp);
|
||||
xfs_fileoff_t start_zero_fsb;
|
||||
xfs_fileoff_t end_zero_fsb;
|
||||
xfs_fileoff_t prev_zero_fsb;
|
||||
xfs_fileoff_t zero_count_fsb;
|
||||
xfs_fileoff_t last_fsb;
|
||||
xfs_extlen_t buf_len_fsb;
|
||||
xfs_extlen_t prev_zero_count;
|
||||
xfs_mount_t *mp;
|
||||
int nimaps;
|
||||
int error = 0;
|
||||
xfs_bmbt_irec_t imap;
|
||||
loff_t loff;
|
||||
size_t lsize;
|
||||
|
||||
ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
|
||||
ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
|
||||
ASSERT(offset > isize);
|
||||
|
||||
mp = io->io_mount;
|
||||
|
||||
|
@ -468,7 +459,7 @@ xfs_zero_eof(
|
|||
* First handle zeroing the block on which isize resides.
|
||||
* We only zero a part of that block so it is handled specially.
|
||||
*/
|
||||
error = xfs_zero_last_block(ip, io, offset, isize, end_size);
|
||||
error = xfs_zero_last_block(ip, io, isize, end_size);
|
||||
if (error) {
|
||||
ASSERT(ismrlocked(io->io_lock, MR_UPDATE));
|
||||
ASSERT(ismrlocked(io->io_iolock, MR_UPDATE));
|
||||
|
@ -496,8 +487,6 @@ xfs_zero_eof(
|
|||
}
|
||||
|
||||
ASSERT(start_zero_fsb <= end_zero_fsb);
|
||||
prev_zero_fsb = NULLFILEOFF;
|
||||
prev_zero_count = 0;
|
||||
while (start_zero_fsb <= end_zero_fsb) {
|
||||
nimaps = 1;
|
||||
zero_count_fsb = end_zero_fsb - start_zero_fsb + 1;
|
||||
|
@ -519,10 +508,7 @@ xfs_zero_eof(
|
|||
* that sits on a hole and sets the page as P_HOLE
|
||||
* and calls remapf if it is a mapped file.
|
||||
*/
|
||||
prev_zero_fsb = NULLFILEOFF;
|
||||
prev_zero_count = 0;
|
||||
start_zero_fsb = imap.br_startoff +
|
||||
imap.br_blockcount;
|
||||
start_zero_fsb = imap.br_startoff + imap.br_blockcount;
|
||||
ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
|
||||
continue;
|
||||
}
|
||||
|
@ -543,17 +529,15 @@ xfs_zero_eof(
|
|||
*/
|
||||
XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD);
|
||||
|
||||
loff = XFS_FSB_TO_B(mp, start_zero_fsb);
|
||||
lsize = XFS_FSB_TO_B(mp, buf_len_fsb);
|
||||
|
||||
error = xfs_iozero(ip, loff, lsize, end_size);
|
||||
error = xfs_iozero(ip,
|
||||
XFS_FSB_TO_B(mp, start_zero_fsb),
|
||||
XFS_FSB_TO_B(mp, buf_len_fsb),
|
||||
end_size);
|
||||
|
||||
if (error) {
|
||||
goto out_lock;
|
||||
}
|
||||
|
||||
prev_zero_fsb = start_zero_fsb;
|
||||
prev_zero_count = buf_len_fsb;
|
||||
start_zero_fsb = imap.br_startoff + buf_len_fsb;
|
||||
ASSERT(start_zero_fsb <= (end_zero_fsb + 1));
|
||||
|
||||
|
|
|
@ -1777,22 +1777,19 @@ xfs_igrow_start(
|
|||
xfs_fsize_t new_size,
|
||||
cred_t *credp)
|
||||
{
|
||||
xfs_fsize_t isize;
|
||||
int error;
|
||||
|
||||
ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0);
|
||||
ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0);
|
||||
ASSERT(new_size > ip->i_d.di_size);
|
||||
|
||||
error = 0;
|
||||
isize = ip->i_d.di_size;
|
||||
/*
|
||||
* Zero any pages that may have been created by
|
||||
* xfs_write_file() beyond the end of the file
|
||||
* and any blocks between the old and new file sizes.
|
||||
*/
|
||||
error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size, isize,
|
||||
new_size);
|
||||
error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size,
|
||||
ip->i_d.di_size, new_size);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue