Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fde214d4 authored by Jan Kara's avatar Jan Kara Committed by Al Viro
Browse files

isofs: Fix isofs_get_blocks for 8TB files



Currently isofs_get_blocks() was limited to handle only 4TB files on 32-bit
architectures because of unnecessary use of iblock variable which was signed
long. Just remove the variable. The error messages that were using this
variable should have rather used b_off anyway because that is the block we
are currently mapping.

Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ebdec241
Loading
Loading
Loading
Loading
+8 −9
Original line number Original line Diff line number Diff line
@@ -962,25 +962,23 @@ static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
 * or getblk() if they are not.  Returns the number of blocks inserted
 * or getblk() if they are not.  Returns the number of blocks inserted
 * (-ve == error.)
 * (-ve == error.)
 */
 */
int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
int isofs_get_blocks(struct inode *inode, sector_t iblock,
		     struct buffer_head **bh, unsigned long nblocks)
		     struct buffer_head **bh, unsigned long nblocks)
{
{
	unsigned long b_off;
	unsigned long b_off = iblock;
	unsigned offset, sect_size;
	unsigned offset, sect_size;
	unsigned int firstext;
	unsigned int firstext;
	unsigned long nextblk, nextoff;
	unsigned long nextblk, nextoff;
	long iblock = (long)iblock_s;
	int section, rv, error;
	int section, rv, error;
	struct iso_inode_info *ei = ISOFS_I(inode);
	struct iso_inode_info *ei = ISOFS_I(inode);


	error = -EIO;
	error = -EIO;
	rv = 0;
	rv = 0;
	if (iblock < 0 || iblock != iblock_s) {
	if (iblock != b_off) {
		printk(KERN_DEBUG "%s: block number too large\n", __func__);
		printk(KERN_DEBUG "%s: block number too large\n", __func__);
		goto abort;
		goto abort;
	}
	}


	b_off = iblock;


	offset = 0;
	offset = 0;
	firstext = ei->i_first_extent;
	firstext = ei->i_first_extent;
@@ -998,8 +996,9 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
		 * I/O errors.
		 * I/O errors.
		 */
		 */
		if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
		if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
			printk(KERN_DEBUG "%s: block >= EOF (%ld, %ld)\n",
			printk(KERN_DEBUG "%s: block >= EOF (%lu, %llu)\n",
				__func__, iblock, (unsigned long) inode->i_size);
				__func__, b_off,
				(unsigned long long)inode->i_size);
			goto abort;
			goto abort;
		}
		}


@@ -1025,9 +1024,9 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
			if (++section > 100) {
			if (++section > 100) {
				printk(KERN_DEBUG "%s: More than 100 file sections ?!?"
				printk(KERN_DEBUG "%s: More than 100 file sections ?!?"
					" aborting...\n", __func__);
					" aborting...\n", __func__);
				printk(KERN_DEBUG "%s: block=%ld firstext=%u sect_size=%u "
				printk(KERN_DEBUG "%s: block=%lu firstext=%u sect_size=%u "
					"nextblk=%lu nextoff=%lu\n", __func__,
					"nextblk=%lu nextoff=%lu\n", __func__,
					iblock, firstext, (unsigned) sect_size,
					b_off, firstext, (unsigned) sect_size,
					nextblk, nextoff);
					nextblk, nextoff);
				goto abort;
				goto abort;
			}
			}