diff options
| author | Eric Sandeen <sandeen@sgi.com> | 2006-01-10 23:34:32 -0500 |
|---|---|---|
| committer | Nathan Scott <nathans@sgi.com> | 2006-01-10 23:34:32 -0500 |
| commit | 24ee80882deb5777aeee6f75a05f178ab8fbfa69 (patch) | |
| tree | e13924d483483dd2f380e7d4eb909447f66d2d1f | |
| parent | 65be60541909c7bf8c384cde3502c18cc362939e (diff) | |
[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>
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 36 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 7 |
2 files changed, 12 insertions, 31 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 885dfafeabee..c73d3c18882c 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
| @@ -362,7 +362,6 @@ STATIC int /* error (positive) */ | |||
| 362 | xfs_zero_last_block( | 362 | xfs_zero_last_block( |
| 363 | struct inode *ip, | 363 | struct inode *ip, |
| 364 | xfs_iocore_t *io, | 364 | xfs_iocore_t *io, |
| 365 | xfs_off_t offset, | ||
| 366 | xfs_fsize_t isize, | 365 | xfs_fsize_t isize, |
| 367 | xfs_fsize_t end_size) | 366 | xfs_fsize_t end_size) |
| 368 | { | 367 | { |
| @@ -371,19 +370,16 @@ xfs_zero_last_block( | |||
| 371 | int nimaps; | 370 | int nimaps; |
| 372 | int zero_offset; | 371 | int zero_offset; |
| 373 | int zero_len; | 372 | int zero_len; |
| 374 | int isize_fsb_offset; | ||
| 375 | int error = 0; | 373 | int error = 0; |
| 376 | xfs_bmbt_irec_t imap; | 374 | xfs_bmbt_irec_t imap; |
| 377 | loff_t loff; | 375 | loff_t loff; |
| 378 | size_t lsize; | ||
| 379 | 376 | ||
| 380 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0); | 377 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE) != 0); |
| 381 | ASSERT(offset > isize); | ||
| 382 | 378 | ||
| 383 | mp = io->io_mount; | 379 | mp = io->io_mount; |
| 384 | 380 | ||
| 385 | isize_fsb_offset = XFS_B_FSB_OFFSET(mp, isize); | 381 | zero_offset = XFS_B_FSB_OFFSET(mp, isize); |
| 386 | if (isize_fsb_offset == 0) { | 382 | if (zero_offset == 0) { |
| 387 | /* | 383 | /* |
| 388 | * There are no extra bytes in the last block on disk to | 384 | * There are no extra bytes in the last block on disk to |
| 389 | * zero, so return. | 385 | * zero, so return. |
| @@ -413,10 +409,8 @@ xfs_zero_last_block( | |||
| 413 | */ | 409 | */ |
| 414 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); | 410 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL| XFS_EXTSIZE_RD); |
| 415 | loff = XFS_FSB_TO_B(mp, last_fsb); | 411 | loff = XFS_FSB_TO_B(mp, last_fsb); |
| 416 | lsize = XFS_FSB_TO_B(mp, 1); | ||
| 417 | 412 | ||
| 418 | zero_offset = isize_fsb_offset; | 413 | zero_len = mp->m_sb.sb_blocksize - zero_offset; |
| 419 | zero_len = mp->m_sb.sb_blocksize - isize_fsb_offset; | ||
| 420 | 414 | ||
| 421 | error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size); | 415 | error = xfs_iozero(ip, loff + zero_offset, zero_len, end_size); |
| 422 | 416 | ||
| @@ -447,20 +441,17 @@ xfs_zero_eof( | |||
| 447 | struct inode *ip = LINVFS_GET_IP(vp); | 441 | struct inode *ip = LINVFS_GET_IP(vp); |
| 448 | xfs_fileoff_t start_zero_fsb; | 442 | xfs_fileoff_t start_zero_fsb; |
| 449 | xfs_fileoff_t end_zero_fsb; | 443 | xfs_fileoff_t end_zero_fsb; |
| 450 | xfs_fileoff_t prev_zero_fsb; | ||
| 451 | xfs_fileoff_t zero_count_fsb; | 444 | xfs_fileoff_t zero_count_fsb; |
| 452 | xfs_fileoff_t last_fsb; | 445 | xfs_fileoff_t last_fsb; |
| 453 | xfs_extlen_t buf_len_fsb; | 446 | xfs_extlen_t buf_len_fsb; |
| 454 | xfs_extlen_t prev_zero_count; | ||
| 455 | xfs_mount_t *mp; | 447 | xfs_mount_t *mp; |
| 456 | int nimaps; | 448 | int nimaps; |
| 457 | int error = 0; | 449 | int error = 0; |
| 458 | xfs_bmbt_irec_t imap; | 450 | xfs_bmbt_irec_t imap; |
| 459 | loff_t loff; | ||
| 460 | size_t lsize; | ||
| 461 | 451 | ||
| 462 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 452 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); |
| 463 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 453 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); |
| 454 | ASSERT(offset > isize); | ||
| 464 | 455 | ||
| 465 | mp = io->io_mount; | 456 | mp = io->io_mount; |
| 466 | 457 | ||
| @@ -468,7 +459,7 @@ xfs_zero_eof( | |||
| 468 | * First handle zeroing the block on which isize resides. | 459 | * First handle zeroing the block on which isize resides. |
| 469 | * We only zero a part of that block so it is handled specially. | 460 | * We only zero a part of that block so it is handled specially. |
| 470 | */ | 461 | */ |
| 471 | error = xfs_zero_last_block(ip, io, offset, isize, end_size); | 462 | error = xfs_zero_last_block(ip, io, isize, end_size); |
| 472 | if (error) { | 463 | if (error) { |
| 473 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); | 464 | ASSERT(ismrlocked(io->io_lock, MR_UPDATE)); |
| 474 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); | 465 | ASSERT(ismrlocked(io->io_iolock, MR_UPDATE)); |
| @@ -496,8 +487,6 @@ xfs_zero_eof( | |||
| 496 | } | 487 | } |
| 497 | 488 | ||
| 498 | ASSERT(start_zero_fsb <= end_zero_fsb); | 489 | ASSERT(start_zero_fsb <= end_zero_fsb); |
| 499 | prev_zero_fsb = NULLFILEOFF; | ||
| 500 | prev_zero_count = 0; | ||
| 501 | while (start_zero_fsb <= end_zero_fsb) { | 490 | while (start_zero_fsb <= end_zero_fsb) { |
| 502 | nimaps = 1; | 491 | nimaps = 1; |
| 503 | zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; | 492 | zero_count_fsb = end_zero_fsb - start_zero_fsb + 1; |
| @@ -519,10 +508,7 @@ xfs_zero_eof( | |||
| 519 | * that sits on a hole and sets the page as P_HOLE | 508 | * that sits on a hole and sets the page as P_HOLE |
| 520 | * and calls remapf if it is a mapped file. | 509 | * and calls remapf if it is a mapped file. |
| 521 | */ | 510 | */ |
| 522 | prev_zero_fsb = NULLFILEOFF; | 511 | start_zero_fsb = imap.br_startoff + imap.br_blockcount; |
| 523 | prev_zero_count = 0; | ||
| 524 | start_zero_fsb = imap.br_startoff + | ||
| 525 | imap.br_blockcount; | ||
| 526 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); | 512 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); |
| 527 | continue; | 513 | continue; |
| 528 | } | 514 | } |
| @@ -543,17 +529,15 @@ xfs_zero_eof( | |||
| 543 | */ | 529 | */ |
| 544 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); | 530 | XFS_IUNLOCK(mp, io, XFS_ILOCK_EXCL|XFS_EXTSIZE_RD); |
| 545 | 531 | ||
| 546 | loff = XFS_FSB_TO_B(mp, start_zero_fsb); | 532 | error = xfs_iozero(ip, |
| 547 | lsize = XFS_FSB_TO_B(mp, buf_len_fsb); | 533 | XFS_FSB_TO_B(mp, start_zero_fsb), |
| 548 | 534 | XFS_FSB_TO_B(mp, buf_len_fsb), | |
| 549 | error = xfs_iozero(ip, loff, lsize, end_size); | 535 | end_size); |
| 550 | 536 | ||
| 551 | if (error) { | 537 | if (error) { |
| 552 | goto out_lock; | 538 | goto out_lock; |
| 553 | } | 539 | } |
| 554 | 540 | ||
| 555 | prev_zero_fsb = start_zero_fsb; | ||
| 556 | prev_zero_count = buf_len_fsb; | ||
| 557 | start_zero_fsb = imap.br_startoff + buf_len_fsb; | 541 | start_zero_fsb = imap.br_startoff + buf_len_fsb; |
| 558 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); | 542 | ASSERT(start_zero_fsb <= (end_zero_fsb + 1)); |
| 559 | 543 | ||
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index e486c7d244c2..0063437f291a 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -1777,22 +1777,19 @@ xfs_igrow_start( | |||
| 1777 | xfs_fsize_t new_size, | 1777 | xfs_fsize_t new_size, |
| 1778 | cred_t *credp) | 1778 | cred_t *credp) |
| 1779 | { | 1779 | { |
| 1780 | xfs_fsize_t isize; | ||
| 1781 | int error; | 1780 | int error; |
| 1782 | 1781 | ||
| 1783 | ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0); | 1782 | ASSERT(ismrlocked(&(ip->i_lock), MR_UPDATE) != 0); |
| 1784 | ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0); | 1783 | ASSERT(ismrlocked(&(ip->i_iolock), MR_UPDATE) != 0); |
| 1785 | ASSERT(new_size > ip->i_d.di_size); | 1784 | ASSERT(new_size > ip->i_d.di_size); |
| 1786 | 1785 | ||
| 1787 | error = 0; | ||
| 1788 | isize = ip->i_d.di_size; | ||
| 1789 | /* | 1786 | /* |
| 1790 | * Zero any pages that may have been created by | 1787 | * Zero any pages that may have been created by |
| 1791 | * xfs_write_file() beyond the end of the file | 1788 | * xfs_write_file() beyond the end of the file |
| 1792 | * and any blocks between the old and new file sizes. | 1789 | * and any blocks between the old and new file sizes. |
| 1793 | */ | 1790 | */ |
| 1794 | error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size, isize, | 1791 | error = xfs_zero_eof(XFS_ITOV(ip), &ip->i_iocore, new_size, |
| 1795 | new_size); | 1792 | ip->i_d.di_size, new_size); |
| 1796 | return error; | 1793 | return error; |
| 1797 | } | 1794 | } |
| 1798 | 1795 | ||
