|
|
| version 1.773, 2008/08/29 04:08:54 | version 1.774, 2008/09/05 06:13:54 |
|---|---|
| Line 3160 error1: /* Just cancel transaction */ | Line 3160 error1: /* Just cancel transaction */ |
| /* | /* |
| * Zero file bytes between startoff and endoff inclusive. | * Zero file bytes between startoff and endoff inclusive. |
| * The iolock is held exclusive and no blocks are buffered. | * The iolock is held exclusive and no blocks are buffered. |
| * | |
| * This function is used by xfs_free_file_space() to zero | |
| * partial blocks when the range to free is not block aligned. | |
| * When unreserving space with boundaries that are not block | |
| * aligned we round up the start and round down the end | |
| * boundaries and then use this function to zero the parts of | |
| * the blocks that got dropped during the rounding. | |
| */ | */ |
| STATIC int | STATIC int |
| xfs_zero_remaining_bytes( | xfs_zero_remaining_bytes( |
| Line 3176 xfs_zero_remaining_bytes( | Line 3183 xfs_zero_remaining_bytes( |
| int nimap; | int nimap; |
| int error = 0; | int error = 0; |
| /* | |
| * Avoid doing I/O beyond eof - it's not necessary | |
| * since nothing can read beyond eof. The space will | |
| * be zeroed when the file is extended anyway. | |
| */ | |
| if (startoff >= ip->i_size) | |
| return 0; | |
| if (endoff > ip->i_size) | |
| endoff = ip->i_size; | |
| bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize, | bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize, |
| XFS_IS_REALTIME_INODE(ip) ? | XFS_IS_REALTIME_INODE(ip) ? |
| mp->m_rtdev_targp : mp->m_ddev_targp); | mp->m_rtdev_targp : mp->m_ddev_targp); |