diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/Documentation/Configure.help linux-2.4-lbd/Documentation/Configure.help --- linux-2.4.20-rc1/Documentation/Configure.help Fri Dec 13 10:45:05 2002 +++ linux-2.4-lbd/Documentation/Configure.help Thu Oct 24 14:25:46 2002 @@ -564,6 +564,11 @@ If unsure, say N. +Large disc support +CONFIG_LBD + If you have mass-storage devices bigger than 2TB and want to access them, + say Y here, and your kernel will use 64-bit sector offsets throughout. + ATA/IDE/MFM/RLL support CONFIG_IDE If you say Y here, your kernel will be able to manage low cost mass diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/Config.in linux-2.4-lbd/drivers/block/Config.in --- linux-2.4.20-rc1/drivers/block/Config.in Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/Config.in Wed Sep 25 10:25:25 2002 @@ -50,4 +50,7 @@ bool 'Per partition statistics in /proc/partitions' CONFIG_BLK_STATS +if [ "$CONFIG_X86" = "y" -o "$CONFIG_PPC" = "y" ]; then + bool 'Support for discs bigger than 2TB?' CONFIG_LBD +fi endmenu diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/DAC960.c linux-2.4-lbd/drivers/block/DAC960.c --- linux-2.4.20-rc1/drivers/block/DAC960.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/DAC960.c Wed Oct 30 11:20:02 2002 @@ -5479,12 +5479,17 @@ Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)].start_sect; return (copy_to_user(UserGeometry, &Geometry, sizeof(DiskGeometry_T)) ? -EFAULT : 0); - case BLKGETSIZE: + case BLKGETSIZE: { /* Get Device Size. */ - if ((unsigned long *) Argument == NULL) return -EINVAL; - return put_user(Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] - .nr_sects, - (unsigned long *) Argument); + unsigned long sz; + if ((unsigned long *) Argument == NULL) return -EINVAL; + sz = Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] + .nr_sects; + if ((sector_t)sz != Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] + .nr_sects) + return -EFBIG; + return put_user(sz, (unsigned long *) Argument); + } case BLKGETSIZE64: if ((u64 *) Argument == NULL) return -EINVAL; return put_user((u64) Controller->GenericDiskInfo diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/DAC960.h linux-2.4-lbd/drivers/block/DAC960.h --- linux-2.4.20-rc1/drivers/block/DAC960.h Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/DAC960.h Wed Sep 25 10:25:25 2002 @@ -2473,7 +2473,7 @@ } V2; } FW; DiskPartition_T DiskPartitions[DAC960_MinorCount]; - int PartitionSizes[DAC960_MinorCount]; + sector_t PartitionSizes[DAC960_MinorCount]; int BlockSizes[DAC960_MinorCount]; int MaxSectorsPerRequest[DAC960_MinorCount]; unsigned char ProgressBuffer[DAC960_ProgressBufferSize]; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/blkpg.c linux-2.4-lbd/drivers/block/blkpg.c --- linux-2.4.20-rc1/drivers/block/blkpg.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/blkpg.c Wed Oct 30 11:21:53 2002 @@ -65,8 +65,9 @@ */ int add_partition(kdev_t dev, struct blkpg_partition *p) { struct gendisk *g; - long long ppstart, pplength; - long pstart, plength; + long long ppstart; + long long pplength; + sector_t pstart, plength; int i, drive, first_minor, end_minor, minor; /* convert bytes to sectors, check for fit in a hd_struct */ @@ -246,10 +247,12 @@ if (g) ullval = g->part[MINOR(dev)].nr_sects; - if (cmd == BLKGETSIZE) + if (cmd == BLKGETSIZE) { + if ((unsigned long)ullval != ullval) + return -EFBIG; return put_user((unsigned long)ullval, (unsigned long *)arg); - else - return put_user(ullval << 9, (u64 *)arg); + } + return put_user(ullval << 9, (u64 *)arg); #if 0 case BLKRRPART: /* Re-read partition tables */ if (!capable(CAP_SYS_ADMIN)) diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/cciss.c linux-2.4-lbd/drivers/block/cciss.c --- linux-2.4.20-rc1/drivers/block/cciss.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/cciss.c Wed Oct 30 11:23:26 2002 @@ -430,7 +430,7 @@ driver_geo.heads = 0xff; driver_geo.sectors = 0x3f; driver_geo.cylinders = - hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); + (int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); } driver_geo.start= hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect; @@ -450,7 +450,7 @@ driver_geo.heads = 0xff; driver_geo.sectors = 0x3f; driver_geo.cylinders = - hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); + (int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); } driver_geo.start= hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect; @@ -459,16 +459,12 @@ return -EFAULT; return(0); } - case BLKGETSIZE: - put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, (unsigned long *)arg); - return 0; - case BLKGETSIZE64: - put_user((u64)hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects << 9, (u64*)arg); - return 0; case BLKRRPART: if(!capable(CAP_SYS_ADMIN)) return -EPERM; return revalidate_logvol(inode->i_rdev, 1); + case BLKGETSIZE64: + case BLKGETSIZE: case BLKFLSBUF: case BLKBSZSET: case BLKBSZGET: diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/cciss.h linux-2.4-lbd/drivers/block/cciss.h --- linux-2.4.20-rc1/drivers/block/cciss.h Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/cciss.h Wed Sep 25 10:25:25 2002 @@ -82,7 +82,7 @@ struct gendisk gendisk; // indexed by minor numbers struct hd_struct hd[256]; - int sizes[256]; + sector_t sizes[256]; int blocksizes[256]; int hardsizes[256]; #ifdef CONFIG_CISS_SCSI_TAPE diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/cpqarray.c linux-2.4-lbd/drivers/block/cpqarray.c --- linux-2.4.20-rc1/drivers/block/cpqarray.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/cpqarray.c Wed Oct 30 11:24:04 2002 @@ -1287,12 +1287,6 @@ case IDAGETDRVINFO: return copy_to_user(&io->c.drv,&hba[ctlr]->drv[dsk],sizeof(drv_info_t)); - case BLKGETSIZE: - if (!arg) return -EINVAL; - return put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, - (unsigned long *)arg); - case BLKGETSIZE64: - return put_user((u64)(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects) << 9, (u64*)arg); case BLKRRPART: return revalidate_logvol(inode->i_rdev, 1); case IDAPASSTHRU: @@ -1360,6 +1354,8 @@ return(0); } + case BLKGETSIZE: + case BLKGETSIZE64: case BLKFLSBUF: case BLKBSZSET: case BLKBSZGET: diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/cpqarray.h linux-2.4-lbd/drivers/block/cpqarray.h --- linux-2.4.20-rc1/drivers/block/cpqarray.h Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/cpqarray.h Wed Sep 25 10:25:25 2002 @@ -123,7 +123,7 @@ struct gendisk gendisk; // Index by Minor Numbers struct hd_struct hd[256]; - int sizes[256]; + sector_t sizes[256]; int blocksizes[256]; int hardsizes[256]; }; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/floppy.c linux-2.4-lbd/drivers/block/floppy.c --- linux-2.4.20-rc1/drivers/block/floppy.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/floppy.c Wed Sep 25 10:25:25 2002 @@ -480,7 +480,7 @@ */ static struct floppy_struct user_params[N_DRIVE]; -static int floppy_sizes[256]; +static sector_t floppy_sizes[256]; static int floppy_blocksizes[256]; /* @@ -582,7 +582,7 @@ static struct floppy_struct *_floppy = floppy_type; static unsigned char current_drive; static long current_count_sectors; -static unsigned char sector_t; /* sector in track */ +static unsigned char sector; /* sector in track */ static unsigned char in_sector_offset; /* offset within physical sector, * expressed in units of 512 bytes */ @@ -2383,7 +2383,7 @@ printk("rt=%d t=%d\n", R_TRACK, TRACK); printk("heads=%d eoc=%d\n", heads, eoc); printk("spt=%d st=%d ss=%d\n", SECT_PER_TRACK, - sector_t, ssize); + sector, ssize); printk("in_sector_offset=%d\n", in_sector_offset); } #endif @@ -2430,7 +2430,7 @@ } else if (CT(COMMAND) == FD_READ){ buffer_track = raw_cmd->track; buffer_drive = current_drive; - INFBOUND(buffer_max, nr_sectors + sector_t); + INFBOUND(buffer_max, nr_sectors + sector); } cont->redo(); } @@ -2459,13 +2459,13 @@ /* Compute the maximal transfer size */ static int transfer_size(int ssize, int max_sector, int max_size) { - SUPBOUND(max_sector, sector_t + max_size); + SUPBOUND(max_sector, sector + max_size); /* alignment */ max_sector -= (max_sector % _floppy->sect) % ssize; /* transfer size, beginning not aligned */ - current_count_sectors = max_sector - sector_t ; + current_count_sectors = max_sector - sector ; return max_sector; } @@ -2485,8 +2485,8 @@ CURRENT->nr_sectors); if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE && - buffer_max > sector_t + CURRENT->nr_sectors) - current_count_sectors = minimum(buffer_max - sector_t, + buffer_max > sector + CURRENT->nr_sectors) + current_count_sectors = minimum(buffer_max - sector, CURRENT->nr_sectors); remaining = current_count_sectors << 9; @@ -2506,7 +2506,7 @@ buffer_max = maximum(max_sector, buffer_max); - dma_buffer = floppy_track_buffer + ((sector_t - buffer_min) << 9); + dma_buffer = floppy_track_buffer + ((sector - buffer_min) << 9); bh = CURRENT->bh; size = CURRENT->current_nr_sectors << 9; @@ -2520,8 +2520,8 @@ dma_buffer < floppy_track_buffer){ DPRINT("buffer overrun in copy buffer %d\n", (int) ((floppy_track_buffer - dma_buffer) >>9)); - printk("sector_t=%d buffer_min=%d\n", - sector_t, buffer_min); + printk("sector=%d buffer_min=%d\n", + sector, buffer_min); printk("current_count_sectors=%ld\n", current_count_sectors); if (CT(COMMAND) == FD_READ) @@ -2614,7 +2614,7 @@ static int make_raw_rw_request(void) { - int aligned_sector_t; + int aligned_sector; int max_sector, max_size, tracksize, ssize; if(max_buffer_sectors == 0) { @@ -2641,8 +2641,8 @@ max_sector = _floppy->sect * _floppy->head; - TRACK = CURRENT->sector / max_sector; - sector_t = CURRENT->sector % max_sector; + TRACK = (long)CURRENT->sector / max_sector; + sector = (long)CURRENT->sector % max_sector; if (_floppy->track && TRACK >= _floppy->track) { if (CURRENT->current_nr_sectors & 1) { current_count_sectors = 1; @@ -2650,17 +2650,17 @@ } else return 0; } - HEAD = sector_t / _floppy->sect; + HEAD = sector / _floppy->sect; if (((_floppy->stretch & FD_SWAPSIDES) || TESTF(FD_NEED_TWADDLE)) && - sector_t < _floppy->sect) + sector < _floppy->sect) max_sector = _floppy->sect; /* 2M disks have phantom sectors on the first track */ if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){ max_sector = 2 * _floppy->sect / 3; - if (sector_t >= max_sector){ - current_count_sectors = minimum(_floppy->sect - sector_t, + if (sector >= max_sector){ + current_count_sectors = minimum(_floppy->sect - sector, CURRENT->nr_sectors); return 1; } @@ -2682,7 +2682,7 @@ GAP = _floppy->gap; CODE2SIZE; SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE; - SECTOR = ((sector_t % _floppy->sect) << 2 >> SIZECODE) + 1; + SECTOR = ((sector % _floppy->sect) << 2 >> SIZECODE) + 1; /* tracksize describes the size which can be filled up with sectors * of size ssize. @@ -2690,11 +2690,11 @@ tracksize = _floppy->sect - _floppy->sect % ssize; if (tracksize < _floppy->sect){ SECT_PER_TRACK ++; - if (tracksize <= sector_t % _floppy->sect) + if (tracksize <= sector % _floppy->sect) SECTOR--; /* if we are beyond tracksize, fill up using smaller sectors */ - while (tracksize <= sector_t % _floppy->sect){ + while (tracksize <= sector % _floppy->sect){ while(tracksize + ssize > _floppy->sect){ SIZECODE--; ssize >>= 1; @@ -2710,12 +2710,12 @@ max_sector = _floppy->sect; } - in_sector_offset = (sector_t % _floppy->sect) % ssize; - aligned_sector_t = sector_t - in_sector_offset; + in_sector_offset = (sector % _floppy->sect) % ssize; + aligned_sector = sector - in_sector_offset; max_size = CURRENT->nr_sectors; if ((raw_cmd->track == buffer_track) && (current_drive == buffer_drive) && - (sector_t >= buffer_min) && (sector_t < buffer_max)) { + (sector >= buffer_min) && (sector < buffer_max)) { /* data already in track buffer */ if (CT(COMMAND) == FD_READ) { copy_buffer(1, max_sector, buffer_max); @@ -2723,8 +2723,8 @@ } } else if (in_sector_offset || CURRENT->nr_sectors < ssize){ if (CT(COMMAND) == FD_WRITE){ - if (sector_t + CURRENT->nr_sectors > ssize && - sector_t + CURRENT->nr_sectors < ssize + ssize) + if (sector + CURRENT->nr_sectors > ssize && + sector + CURRENT->nr_sectors < ssize + ssize) max_size = ssize + ssize; else max_size = ssize; @@ -2737,7 +2737,7 @@ int direct, indirect; indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) - - sector_t; + sector; /* * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide @@ -2752,7 +2752,7 @@ if (CROSS_64KB(CURRENT->buffer, max_size << 9)) max_size = (K_64 - ((unsigned long)CURRENT->buffer) % K_64)>>9; - direct = transfer_size(ssize,max_sector,max_size) - sector_t; + direct = transfer_size(ssize,max_sector,max_size) - sector; /* * We try to read tracks, but if we get too many errors, we * go back to reading just one sector at a time. @@ -2771,8 +2771,8 @@ raw_cmd->length = current_count_sectors << 9; if (raw_cmd->length == 0){ DPRINT("zero dma transfer attempted from make_raw_request\n"); - DPRINT("indirect=%d direct=%d sector_t=%d", - indirect, direct, sector_t); + DPRINT("indirect=%d direct=%d sector=%d", + indirect, direct, sector); return 0; } /* check_dma_crossing(raw_cmd->kernel_data, @@ -2790,19 +2790,19 @@ /* claim buffer track if needed */ if (buffer_track != raw_cmd->track || /* bad track */ buffer_drive !=current_drive || /* bad drive */ - sector_t > buffer_max || - sector_t < buffer_min || + sector > buffer_max || + sector < buffer_min || ((CT(COMMAND) == FD_READ || (!in_sector_offset && CURRENT->nr_sectors >= ssize))&& max_sector > 2 * max_buffer_sectors + buffer_min && - max_size + sector_t > 2 * max_buffer_sectors + buffer_min) + max_size + sector > 2 * max_buffer_sectors + buffer_min) /* not enough space */){ buffer_track = -1; buffer_drive = current_drive; - buffer_max = buffer_min = aligned_sector_t; + buffer_max = buffer_min = aligned_sector; } raw_cmd->kernel_data = floppy_track_buffer + - ((aligned_sector_t-buffer_min)<<9); + ((aligned_sector-buffer_min)<<9); if (CT(COMMAND) == FD_WRITE){ /* copy write buffer to track buffer. @@ -2818,7 +2818,7 @@ copy_buffer(ssize, max_sector, 2*max_buffer_sectors+buffer_min); } else transfer_size(ssize, max_sector, - 2*max_buffer_sectors+buffer_min-aligned_sector_t); + 2*max_buffer_sectors+buffer_min-aligned_sector); /* round up current_count_sectors to get dma xfer size */ raw_cmd->length = in_sector_offset+current_count_sectors; @@ -2830,8 +2830,8 @@ if ((raw_cmd->length < current_count_sectors << 9) || (raw_cmd->kernel_data != CURRENT->buffer && CT(COMMAND) == FD_WRITE && - (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max || - aligned_sector_t < buffer_min)) || + (aligned_sector + (raw_cmd->length >> 9) > buffer_max || + aligned_sector < buffer_min)) || raw_cmd->length % (128 << SIZECODE) || raw_cmd->length <= 0 || current_count_sectors <= 0){ DPRINT("fractionary current count b=%lx s=%lx\n", @@ -2842,7 +2842,7 @@ floppy_track_buffer) >> 9), current_count_sectors); printk("st=%d ast=%d mse=%d msi=%d\n", - sector_t, aligned_sector_t, max_sector, max_size); + sector, aligned_sector, max_sector, max_size); printk("ssize=%x SIZECODE=%d\n", ssize, SIZECODE); printk("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n", COMMAND, SECTOR, HEAD, TRACK); @@ -2860,8 +2860,8 @@ raw_cmd->kernel_data + raw_cmd->length > floppy_track_buffer + (max_buffer_sectors << 10)){ DPRINT("buffer overrun in schedule dma\n"); - printk("sector_t=%d buffer_min=%d current_count=%ld\n", - sector_t, buffer_min, + printk("sector=%d buffer_min=%d current_count=%ld\n", + sector, buffer_min, raw_cmd->length >> 9); printk("current_count_sectors=%ld\n", current_count_sectors); @@ -2983,7 +2983,7 @@ if (usage_count == 0) { printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT); - printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd); + printk("sect=%llu cmd=%d\n", (unsigned long long)CURRENT->sector, CURRENT->cmd); return; } if (fdc_busy){ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/genhd.c linux-2.4-lbd/drivers/block/genhd.c --- linux-2.4.20-rc1/drivers/block/genhd.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/genhd.c Thu Oct 24 14:25:46 2002 @@ -200,9 +200,9 @@ struct hd_struct *hd = &gp->part[n]; disk_round_stats(hd); - seq_printf(s, "%4d %4d %10d %s " + seq_printf(s, "%4d %4d %10llu %s " "%d %d %d %d %d %d %d %d %d %d %d\n", - gp->major, n, gp->sizes[n], + gp->major, n, (unsigned long long)gp->sizes[n], disk_name(gp, n, buf), hd->rd_ios, hd->rd_merges, #define MSEC(x) ((x) * 1000 / HZ) @@ -212,8 +212,8 @@ hd->ios_in_flight, MSEC(hd->io_ticks), MSEC(hd->aveq)); #else - seq_printf(s, "%4d %4d %10d %s\n", - gp->major, n, gp->sizes[n], + seq_printf(s, "%4d %4d %10llu %s\n", + gp->major, n, (unsigned long long)gp->sizes[n], disk_name(gp, n, buf)); #endif /* CONFIG_BLK_STATS */ } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/ll_rw_blk.c linux-2.4-lbd/drivers/block/ll_rw_blk.c --- linux-2.4.20-rc1/drivers/block/ll_rw_blk.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/ll_rw_blk.c Fri Oct 11 12:15:16 2002 @@ -83,10 +83,10 @@ * * if (!blk_size[MAJOR]) then no minor size checking is done. */ -int * blk_size[MAX_BLKDEV]; +sector_t * blk_size[MAX_BLKDEV]; /* - * blksize_size contains the size of all block-devices: + * blksize_size contains the block size of all block-devices: * * blksize_size[MAJOR][MINOR] * @@ -902,7 +902,8 @@ static int __make_request(request_queue_t * q, int rw, struct buffer_head * bh) { - unsigned int sector, count; + sector_t sector; + unsigned count; int max_segments = MAX_SEGMENTS; struct request * req, *freereq = NULL; int rw_ahead, max_sectors, el_ret; @@ -1077,7 +1078,7 @@ } /** - * generic_make_request: hand a buffer head to it's device driver for I/O + * generic_make_request: hand a buffer head to its device driver for I/O * @rw: READ, WRITE, or READA - what sort of I/O is desired. * @bh: The buffer head describing the location in memory and on the device. * @@ -1113,7 +1114,7 @@ void generic_make_request (int rw, struct buffer_head * bh) { int major = MAJOR(bh->b_rdev); - int minorsize = 0; + sector_t minorsize = 0; request_queue_t *q; if (!bh->b_end_io) @@ -1123,8 +1124,8 @@ if (blk_size[major]) minorsize = blk_size[major][MINOR(bh->b_rdev)]; if (minorsize) { - unsigned long maxsector = (minorsize << 1) + 1; - unsigned long sector = bh->b_rsector; + sector_t maxsector = (minorsize << 1) + 1; + sector_t sector = bh->b_rsector; unsigned int count = bh->b_size >> 9; if (maxsector < count || maxsector - count < sector) { @@ -1136,9 +1137,10 @@ when mounting a device. */ printk(KERN_INFO "attempt to access beyond end of device\n"); - printk(KERN_INFO "%s: rw=%d, want=%ld, limit=%d\n", + printk(KERN_INFO "%s: rw=%d, want=%llu, limit=%llu\n", kdevname(bh->b_rdev), rw, - (sector + count)>>1, minorsize); + (unsigned long long)((sector + count)>>1), + (unsigned long long)minorsize); /* Yecch again */ bh->b_end_io(bh, 0); @@ -1159,8 +1161,8 @@ if (!q) { printk(KERN_ERR "generic_make_request: Trying to access " - "nonexistent block-device %s (%ld)\n", - kdevname(bh->b_rdev), bh->b_rsector); + "nonexistent block-device %s (%llu)\n", + kdevname(bh->b_rdev), (unsigned long long)bh->b_rsector); buffer_IO_error(bh); break; } @@ -1346,8 +1348,8 @@ req->errors = 0; if (!uptodate) - printk("end_request: I/O error, dev %s (%s), sector %lu\n", - kdevname(req->rq_dev), name, req->sector); + printk("end_request: I/O error, dev %s (%s), sector %llu\n", + kdevname(req->rq_dev), name, (unsigned long long)req->sector); if ((bh = req->bh) != NULL) { nsect = bh->b_size >> 9; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/loop.c linux-2.4-lbd/drivers/block/loop.c --- linux-2.4.20-rc1/drivers/block/loop.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/loop.c Wed Oct 30 14:15:15 2002 @@ -80,7 +80,7 @@ static int max_loop = 8; static struct loop_device *loop_dev; -static int *loop_sizes; +static sector_t *loop_sizes; static int *loop_blksizes; static devfs_handle_t devfs_handle; /* For the directory */ @@ -88,7 +88,7 @@ * Transfer functions */ static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, int real_block) + char *loop_buf, int size, sector_t real_block) { if (raw_buf != loop_buf) { if (cmd == READ) @@ -101,7 +101,7 @@ } static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, int real_block) + char *loop_buf, int size, sector_t real_block) { char *in, *out, *key; int i, keysize; @@ -154,21 +154,27 @@ #define MAX_DISK_SIZE 1024*1024*1024 -static int compute_loop_size(struct loop_device *lo, struct dentry * lo_dentry, kdev_t lodev) -{ - if (S_ISREG(lo_dentry->d_inode->i_mode)) - return (lo_dentry->d_inode->i_size - lo->lo_offset) >> BLOCK_SIZE_BITS; - if (blk_size[MAJOR(lodev)]) - return blk_size[MAJOR(lodev)][MINOR(lodev)] - - (lo->lo_offset >> BLOCK_SIZE_BITS); - return MAX_DISK_SIZE; -} -static void figure_loop_size(struct loop_device *lo) +static int figure_loop_size(struct loop_device *lo) { - loop_sizes[lo->lo_number] = compute_loop_size(lo, - lo->lo_backing_file->f_dentry, - lo->lo_device); + loff_t size = lo->lo_backing_file->f_dentry->d_inode->i_mapping->host->i_size; + sector_t x; + + /* + * Unfortunately, if we want to do I/O on the device, + * the number of 512-byte sectors has to fit into a sector_t. + */ + size = (size - lo->lo_offset) >> 9; + x = (sector_t)size; + if ((loff_t)x != size) + return -EFBIG; + /* + * Convert sectors to blocks + */ + size >>= (BLOCK_SIZE_BITS - 9); + + loop_sizes[lo->lo_number] = (sector_t)size; + return 0; } static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize, @@ -189,7 +195,7 @@ len = bh->b_size; data = bh->b_data; while (len > 0) { - int IV = index * (PAGE_CACHE_SIZE/bsize) + offset/bsize; + sector_t IV = (sector_t)index * (PAGE_CACHE_SIZE/bsize) + offset/bsize; int transfer_result; size = PAGE_CACHE_SIZE - offset; @@ -247,7 +253,7 @@ unsigned long count = desc->count; struct lo_read_data *p = (struct lo_read_data*)desc->buf; struct loop_device *lo = p->lo; - int IV = page->index * (PAGE_CACHE_SIZE/p->bsize) + offset/p->bsize; + sector_t IV = (sector_t)page->index * (PAGE_CACHE_SIZE/p->bsize) + offset/p->bsize; if (size > count) size = count; @@ -255,7 +261,7 @@ kaddr = kmap(page); if (lo_do_transfer(lo, READ, kaddr + offset, p->data, size, IV)) { size = 0; - printk(KERN_ERR "loop: transfer error block %ld\n",page->index); + printk(KERN_ERR "loop: transfer error block %lu\n",page->index); desc->error = -EINVAL; } kunmap(page); @@ -299,15 +305,29 @@ return bs; } -static inline unsigned long loop_get_iv(struct loop_device *lo, - unsigned long sector) +static inline int loop_get_bs_shift(struct loop_device *lo) { int bs = loop_get_bs(lo); + int i; + /* + * Assume power-of-two block size + */ + for (i = -1; bs; i++) + bs >>= 1; + return i; +} + +static inline unsigned long loop_get_iv(struct loop_device *lo, + sector_t sector) +{ + int bs = loop_get_bs_shift(lo); unsigned long offset, IV; - IV = sector / (bs >> 9) + lo->lo_offset / bs; - offset = ((sector % (bs >> 9)) << 9) + lo->lo_offset % bs; - if (offset >= bs) + IV = (sector >> (bs - 9)) + (lo->lo_offset >> bs); + + offset = ((sector & ((1 << (bs-9)) - 1))<<9) + (lo->lo_offset & ((1 << bs)-1)); + + if (offset >= (1 << bs)) IV++; return IV; @@ -540,7 +560,7 @@ bh->b_end_io(bh, !ret); } else { struct buffer_head *rbh = bh->b_private; - unsigned long IV = loop_get_iv(lo, rbh->b_rsector); + sector_t IV = loop_get_iv(lo, rbh->b_rsector); ret = lo_do_transfer(lo, READ, bh->b_data, rbh->b_data, bh->b_size, IV); @@ -678,7 +698,11 @@ lo->lo_backing_file = file; lo->transfer = NULL; lo->ioctl = NULL; - figure_loop_size(lo); + if (figure_loop_size(lo)) { + error = -EFBIG; + fput(file); + goto out_putf; + } lo->old_gfp_mask = inode->i_mapping->gfp_mask; inode->i_mapping->gfp_mask = GFP_NOIO; @@ -779,6 +803,7 @@ { struct loop_info info; int err; + loff_t offset; unsigned int type; if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid && @@ -798,10 +823,18 @@ err = loop_release_xfer(lo); if (!err) err = loop_init_xfer(lo, type, &info); + + offset = lo->lo_offset; + if (offset != info.lo_offset) { + lo->lo_offset = info.lo_offset; + if (figure_loop_size(lo)){ + err = -EFBIG; + lo->lo_offset = offset; + } + } if (err) return err; - lo->lo_offset = info.lo_offset; strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE); lo->transfer = xfer_funcs[type]->transfer; @@ -876,12 +909,19 @@ err = loop_get_status(lo, (struct loop_info *) arg); break; case BLKGETSIZE: + { + unsigned long val; if (lo->lo_state != Lo_bound) { err = -ENXIO; break; } - err = put_user((unsigned long)loop_sizes[lo->lo_number] << 1, (unsigned long *) arg); + val = loop_sizes[lo->lo_number] << 1; + if ((sector_t) val != (loop_sizes[lo->lo_number] << 1)) + err = -EFBIG; + else + err = put_user(val, (unsigned long *) arg); break; + } case BLKGETSIZE64: if (lo->lo_state != Lo_bound) { err = -ENXIO; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/nbd.c linux-2.4-lbd/drivers/block/nbd.c --- linux-2.4.20-rc1/drivers/block/nbd.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/nbd.c Wed Sep 25 10:25:25 2002 @@ -57,7 +57,7 @@ static int nbd_blksizes[MAX_NBD]; static int nbd_blksize_bits[MAX_NBD]; -static int nbd_sizes[MAX_NBD]; +static sector_t nbd_sizes[MAX_NBD]; static u64 nbd_bytesizes[MAX_NBD]; static struct nbd_device nbd_dev[MAX_NBD]; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/ps2esdi.c linux-2.4-lbd/drivers/block/ps2esdi.c --- linux-2.4.20-rc1/drivers/block/ps2esdi.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/ps2esdi.c Wed Sep 25 10:25:25 2002 @@ -116,7 +116,7 @@ static int no_int_yet; static int access_count[MAX_HD]; static char ps2esdi_valid[MAX_HD]; -static int ps2esdi_sizes[MAX_HD << 6]; +static sector_t ps2esdi_sizes[MAX_HD << 6]; static int ps2esdi_blocksizes[MAX_HD << 6]; static int ps2esdi_maxsect[MAX_HD << 6]; static int ps2esdi_drives; @@ -517,7 +517,7 @@ /* is request is valid */ else { printk("Grrr. error. ps2esdi_drives: %d, %lu %lu\n", ps2esdi_drives, - CURRENT->sector, ps2esdi[MINOR(CURRENT->rq_dev)].nr_sects); + (unsigned long)CURRENT->sector, (unsigned long)ps2esdi[MINOR(CURRENT->rq_dev)].nr_sects); end_request(FAIL); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/rd.c linux-2.4-lbd/drivers/block/rd.c --- linux-2.4.20-rc1/drivers/block/rd.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/rd.c Wed Sep 25 10:25:25 2002 @@ -75,7 +75,7 @@ static unsigned long rd_length[NUM_RAMDISKS]; /* Size of RAM disks in bytes */ static int rd_hardsec[NUM_RAMDISKS]; /* Size of real blocks in bytes */ static int rd_blocksizes[NUM_RAMDISKS]; /* Size of 1024 byte blocks :) */ -static int rd_kbsize[NUM_RAMDISKS]; /* Size in blocks of 1024 bytes */ +static sector_t rd_kbsize[NUM_RAMDISKS]; /* Size in blocks of 1024 bytes */ static devfs_handle_t devfs_handle; static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/umem.c linux-2.4-lbd/drivers/block/umem.c --- linux-2.4.20-rc1/drivers/block/umem.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/umem.c Wed Sep 25 10:25:25 2002 @@ -160,7 +160,7 @@ static int mm_hardsect [MM_MAXCARDS << MM_SHIFT]; static int mm_blocksizes[MM_MAXCARDS << MM_SHIFT]; -static int mm_sizes[MM_MAXCARDS << MM_SHIFT]; +static sector_t mm_sizes[MM_MAXCARDS << MM_SHIFT]; static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT]; static int num_cards = 0; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/block/xd.c linux-2.4-lbd/drivers/block/xd.c --- linux-2.4.20-rc1/drivers/block/xd.c Fri Dec 13 10:45:21 2002 +++ linux-2.4-lbd/drivers/block/xd.c Wed Sep 25 10:25:25 2002 @@ -121,7 +121,7 @@ }; static struct hd_struct xd_struct[XD_MAXDRIVES << 6]; -static int xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES]; +static sector_t xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES]; static int xd_blocksizes[XD_MAXDRIVES << 6]; static int xd_maxsect[XD_MAXDRIVES << 6]; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/char/raw.c linux-2.4-lbd/drivers/char/raw.c --- linux-2.4.20-rc1/drivers/char/raw.c Fri Dec 13 10:45:29 2002 +++ linux-2.4-lbd/drivers/char/raw.c Wed Sep 25 10:25:29 2002 @@ -294,7 +294,8 @@ struct kiobuf * iobuf; int new_iobuf; int err = 0; - unsigned long blocknr, blocks; + sector_t blocknr; + unsigned long blocks; size_t transferred; int iosize; int i; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ataraid.c linux-2.4-lbd/drivers/ide/ataraid.c --- linux-2.4.20-rc1/drivers/ide/ataraid.c Fri Dec 13 10:45:31 2002 +++ linux-2.4-lbd/drivers/ide/ataraid.c Wed Sep 25 10:25:34 2002 @@ -47,7 +47,7 @@ struct gendisk ataraid_gendisk; -static int ataraid_gendisk_sizes[256]; +static sector_t ataraid_gendisk_sizes[256]; static int ataraid_readahead[256]; static struct block_device_operations ataraid_fops = { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide-cd.c linux-2.4-lbd/drivers/ide/ide-cd.c --- linux-2.4.20-rc1/drivers/ide/ide-cd.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide-cd.c Wed Sep 25 10:25:34 2002 @@ -1060,8 +1060,8 @@ paranoid and check. */ if (rq->current_nr_sectors < (rq->bh->b_size >> SECTOR_BITS) && (rq->sector % SECTORS_PER_FRAME) != 0) { - printk ("%s: cdrom_read_from_buffer: buffer botch (%ld)\n", - drive->name, rq->sector); + printk ("%s: cdrom_read_from_buffer: buffer botch (%llu)\n", + drive->name, (unsigned long long)rq->sector); cdrom_end_request (0, drive); return -1; } @@ -1689,8 +1689,9 @@ * cdrom driver request routine. */ static ide_startstop_t -ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, unsigned long block) +ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t sect) { + unsigned long block = (unsigned long)sect; ide_startstop_t action; struct cdrom_info *info = drive->driver_data; @@ -2934,14 +2935,14 @@ } static -unsigned long ide_cdrom_capacity (ide_drive_t *drive) +sector_t ide_cdrom_capacity (ide_drive_t *drive) { unsigned long capacity; if (cdrom_read_capacity(drive, &capacity, NULL)) return 0; - return capacity * SECTORS_PER_FRAME; + return (sector_t)capacity * SECTORS_PER_FRAME; } static diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide-disk.c linux-2.4-lbd/drivers/ide/ide-disk.c --- linux-2.4.20-rc1/drivers/ide/ide-disk.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide-disk.c Wed Oct 30 14:15:49 2002 @@ -352,7 +352,7 @@ * using LBA if supported, or CHS otherwise, to address sectors. * It also takes care of issuing special DRIVE_CMDs. */ -static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) { if (rq->cmd == READ) goto good_command; @@ -556,7 +556,7 @@ * using LBA if supported, or CHS otherwise, to address sectors. * It also takes care of issuing special DRIVE_CMDs. */ -static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) { if (IDE_CONTROL_REG) OUT_BYTE(drive->ctl,IDE_CONTROL_REG); @@ -582,10 +582,13 @@ tasklets[5] = (task_ioreg_t) (block>>8); tasklets[6] = (task_ioreg_t) (block>>16); tasklets[7] = (task_ioreg_t) (block>>24); +#if CONFIG_LBD + tasklets[8] = (task_ioreg_t) (block>>32); + tasklets[9] = (task_ioreg_t) (block>>40); +#else tasklets[8] = (task_ioreg_t) 0; tasklets[9] = (task_ioreg_t) 0; -// tasklets[8] = (task_ioreg_t) (block>>32); -// tasklets[9] = (task_ioreg_t) (block>>40); +#endif #ifdef DEBUG printk("%s: %sing: LBAsect=%lu, sectors=%ld, buffer=0x%08lx, LBAsect=0x%012lx\n", drive->name, @@ -626,8 +629,8 @@ } } else { unsigned int sect,head,cyl,track; - track = block / drive->sect; - sect = block % drive->sect + 1; + track = (unsigned int)block / drive->sect; + sect = (unsigned int)block % drive->sect + 1; OUT_BYTE(sect,IDE_SECTOR_REG); head = track % drive->head; cyl = track / drive->head; @@ -963,8 +966,10 @@ drive->capacity48 = capacity_2; drive->capacity = (unsigned long) capacity_2; return; + } + /* Determine capacity, and use LBA if the drive properly supports it */ - } else if ((id->capability & 2) && lba_capacity_is_ok(id)) { + if ((id->capability & 2) && lba_capacity_is_ok(id)) { capacity = id->lba_capacity; drive->cyl = capacity / (drive->head * drive->sect); drive->select.b.lba = 1; @@ -996,7 +1001,7 @@ } } -static unsigned long idedisk_capacity (ide_drive_t *drive) +static sector_t idedisk_capacity (ide_drive_t *drive) { if (drive->id->cfs_enable_2 & 0x0400) return (drive->capacity48 - drive->sect0); @@ -1326,7 +1331,7 @@ int i; struct hd_driveid *id = drive->id; - unsigned long capacity; + sector_t capacity; idedisk_add_settings(drive); @@ -1382,17 +1387,28 @@ /* * if possible, give fdisk access to more of the drive, - * by correcting bios_cyls: + * by correcting bios_cyls: */ capacity = idedisk_capacity (drive); - if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) && - (!drive->forced_geom) && drive->bios_sect && drive->bios_head) - drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head; - printk (KERN_INFO "%s: %ld sectors", drive->name, capacity); + if ((capacity > (((sector_t)drive->bios_cyl * drive->bios_sect * drive->bios_head))) && + (!drive->forced_geom) && drive->bios_sect && drive->bios_head) { + sector_t cyl = capacity; + sector_div(cyl, drive->bios_head * drive->bios_sect); + if (cyl > 0x7fffffffULL) + drive->bios_cyl = 0x7fffffffUL; + else + drive->bios_cyl = cyl; + } /* Give size in megabytes (MB), not mebibytes (MiB). */ /* We compute the exact rounded value, avoiding overflow. */ - printk (" (%ld MB)", (capacity - capacity/625 + 974)/1950); + { + sector_t mbcap = capacity; + sector_div(mbcap, 625); + mbcap = capacity - mbcap + 974; + sector_div(mbcap, 1950); + printk (" (%llu MB)", (unsigned long long)mbcap); + } /* Only print cache size when it was specified */ if (id->buf_size) diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide-floppy.c linux-2.4-lbd/drivers/ide/ide-floppy.c --- linux-2.4.20-rc1/drivers/ide/ide-floppy.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide-floppy.c Wed Sep 25 10:25:35 2002 @@ -1294,14 +1294,15 @@ /* * idefloppy_do_request is our request handling function. */ -static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, sector_t sect) { idefloppy_floppy_t *floppy = drive->driver_data; idefloppy_pc_t *pc; + unsigned long block = sect; #if IDEFLOPPY_DEBUG_LOG printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); - printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); + printk (KERN_INFO "sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); #endif /* IDEFLOPPY_DEBUG_LOG */ if (rq->errors >= ERROR_MAX) { @@ -1316,7 +1317,7 @@ switch (rq->cmd) { case READ: case WRITE: - if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { + if ((long)rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { printk ("%s: unsupported r/w request size\n", drive->name); idefloppy_end_request (0, HWGROUP(drive)); return ide_stopped; @@ -1859,12 +1860,12 @@ /* * Return the current floppy capacity to ide.c. */ -static unsigned long idefloppy_capacity (ide_drive_t *drive) +static sector_t idefloppy_capacity (ide_drive_t *drive) { idefloppy_floppy_t *floppy = drive->driver_data; unsigned long capacity = floppy->blocks * floppy->bs_factor; - return capacity; + return (sector_t)capacity; } /* diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide-probe.c linux-2.4-lbd/drivers/ide/ide-probe.c --- linux-2.4.20-rc1/drivers/ide/ide-probe.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide-probe.c Wed Oct 30 10:22:29 2002 @@ -786,7 +786,7 @@ if (!gd) goto err_kmalloc_gd; memset (gd, 0, sizeof(struct gendisk)); - gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL); + gd->sizes = kmalloc (minors * sizeof(gd->sizes[0]), GFP_KERNEL); if (!gd->sizes) goto err_kmalloc_gd_sizes; gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide-tape.c linux-2.4-lbd/drivers/ide/ide-tape.c --- linux-2.4.20-rc1/drivers/ide/ide-tape.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide-tape.c Wed Sep 25 10:25:35 2002 @@ -2609,7 +2609,7 @@ /* * idetape_do_request is our request handling function. */ -static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, sector_t block) { idetape_tape_t *tape = drive->driver_data; idetape_pc_t *pc; @@ -2620,7 +2620,7 @@ if (tape->debug_level >= 5) printk (KERN_INFO "ide-tape: rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); if (tape->debug_level >= 2) - printk (KERN_INFO "ide-tape: sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); + printk (KERN_INFO "ide-tape: sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); #endif /* IDETAPE_DEBUG_LOG */ if (!IDETAPE_RQ_CMD (rq->cmd)) { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ide/ide.c linux-2.4-lbd/drivers/ide/ide.c --- linux-2.4.20-rc1/drivers/ide/ide.c Fri Dec 13 10:45:33 2002 +++ linux-2.4-lbd/drivers/ide/ide.c Wed Sep 25 10:25:35 2002 @@ -1010,7 +1010,8 @@ } } if (HWGROUP(drive) && HWGROUP(drive)->rq) - printk(", sector=%ld", HWGROUP(drive)->rq->sector); + printk(", sector=%llu", + (unsigned long long)HWGROUP(drive)->rq->sector); } } #endif /* FANCY_STATUS_DUMPS */ @@ -3745,7 +3746,7 @@ return 0; } -static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, sector_t block) { ide_end_request(0, HWGROUP(drive)); return ide_stopped; @@ -3781,9 +3782,9 @@ { } -static unsigned long default_capacity (ide_drive_t *drive) +static sector_t default_capacity (ide_drive_t *drive) { - return 0x7fffffff; + return (sector_t)0x7fffffff; } static ide_startstop_t default_special (ide_drive_t *drive) diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/ieee1394/sbp2.c linux-2.4-lbd/drivers/ieee1394/sbp2.c --- linux-2.4.20-rc1/drivers/ieee1394/sbp2.c Fri Dec 13 10:45:34 2002 +++ linux-2.4-lbd/drivers/ieee1394/sbp2.c Fri Oct 11 12:15:16 2002 @@ -3160,12 +3160,12 @@ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (unsigned int)disk->capacity / (heads * sectors); if (cylinders > 1024) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (unsigned int)disk->capacity / (heads * sectors); } geom[0] = heads; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/linear.c linux-2.4-lbd/drivers/md/linear.c --- linux-2.4.20-rc1/drivers/md/linear.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/linear.c Wed Oct 30 12:49:51 2002 @@ -32,8 +32,9 @@ linear_conf_t *conf; struct linear_hash *table; mdk_rdev_t *rdev; - int size, i, j, nb_zone; - unsigned int curr_offset; + s64 size; + int i, j, nb_zone; + sector_t curr_offset; MOD_INC_USE_COUNT; @@ -54,10 +55,16 @@ curr_offset = 0; ITERATE_RDEV_ORDERED(mddev,rdev,j) { dev_info_t *disk = conf->disks + j; + long x; disk->dev = rdev->dev; disk->size = rdev->size; disk->offset = curr_offset; + x = disk->size; + if (unlikely((sector_t)x != disk->size)) { + printk("linear: Array members must be smaller than 2TB, aborting\n"); + goto out; + } curr_offset += disk->size; @@ -65,10 +72,14 @@ conf->smallest = disk; } - nb_zone = conf->nr_zones = - md_size[mdidx(mddev)] / conf->smallest->size + - ((md_size[mdidx(mddev)] % conf->smallest->size) ? 1 : 0); - + + + { + sector_t sz = md_size[mdidx(mddev)]; + unsigned round = sector_div(sz, (long)conf->smallest->size); + nb_zone = conf->nr_zones = sz + (round != 0); + } + conf->hash_table = kmalloc (sizeof (struct linear_hash) * nb_zone, GFP_KERNEL); if (!conf->hash_table) @@ -87,7 +98,6 @@ table[-1].dev1 = disk; } size += disk->size; - while (size>0) { table->dev0 = disk; table->dev1 = NULL; @@ -125,15 +135,21 @@ linear_conf_t *conf = mddev_to_conf(mddev); struct linear_hash *hash; dev_info_t *tmp_dev; - long block; + sector_t block; + sector_t hashindex; block = bh->b_rsector >> 1; - hash = conf->hash_table + (block / conf->smallest->size); + + BUG_ON((sector_t)block != ((sector_t)bh->b_rsector >> 1)); + + hashindex = block; + sector_div(hashindex, (long)conf->smallest->size); + hash = conf->hash_table + hashindex; if (block >= (hash->dev0->size + hash->dev0->offset)) { if (!hash->dev1) { - printk ("linear_make_request : hash->dev1==NULL for block %ld\n", - block); + printk ("linear_make_request : hash->dev1==NULL for block %llu\n", + (unsigned long long)block); buffer_IO_error(bh); return 0; } @@ -143,7 +159,11 @@ if (block >= (tmp_dev->size + tmp_dev->offset) || block < tmp_dev->offset) { - printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, kdevname(tmp_dev->dev), tmp_dev->size, tmp_dev->offset); + printk ("linear_make_request: Block %llu out of bounds on dev %s size %ld offset %ld\n", + (unsigned long long)block, + kdevname(tmp_dev->dev), + (long)tmp_dev->size, + (long)tmp_dev->offset); buffer_IO_error(bh); return 0; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/lvm-snap.c linux-2.4-lbd/drivers/md/lvm-snap.c --- linux-2.4.20-rc1/drivers/md/lvm-snap.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/lvm-snap.c Wed Sep 25 10:25:39 2002 @@ -71,7 +71,7 @@ static inline int __brw_kiovec(int rw, int nr, struct kiobuf *iovec[], - kdev_t dev, unsigned long b[], int size, + kdev_t dev, sector_t b[], int size, lv_t *lv) { return brw_kiovec(rw, nr, iovec, dev, b, size); } @@ -218,8 +218,8 @@ reason); } -static inline int lvm_snapshot_prepare_blocks(unsigned long *blocks, - unsigned long start, +static inline int lvm_snapshot_prepare_blocks(sector_t *blocks, + sector_t start, int nr_sectors, int blocksize) { @@ -231,7 +231,7 @@ return 0; nr_blocks = nr_sectors / sectors_per_block; - start /= sectors_per_block; + sector_div(start, sectors_per_block); for (i = 0; i < nr_blocks; i++) blocks[i] = start++; @@ -356,7 +356,7 @@ unsigned long phys_start; int idx = lv_snap->lv_remap_ptr, chunk_size = lv_snap->lv_chunk_size; struct kiobuf * iobuf = lv_snap->lv_iobuf; - unsigned long *blocks = iobuf->blocks; + sector_t *blocks = iobuf->blocks; int blksize_snap, blksize_org, min_blksize, max_blksize; int max_sectors, nr_sectors; @@ -621,7 +621,7 @@ uint pvn; ulong snap_pe_start, COW_table_sector_offset, COW_entries_per_pe, COW_chunks_per_pe, COW_entries_per_block; - ulong blocks[1]; + sector_t blocks[1]; kdev_t snap_phys_dev; lv_block_exception_t *be; struct kiobuf *COW_table_iobuf = lv_snap->lv_COW_table_iobuf; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/lvm.c linux-2.4-lbd/drivers/md/lvm.c --- linux-2.4.20-rc1/drivers/md/lvm.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/lvm.c Wed Sep 25 10:25:39 2002 @@ -417,7 +417,7 @@ static struct hd_struct lvm_hd_struct[MAX_LV]; static int lvm_blocksizes[MAX_LV]; static int lvm_hardsectsizes[MAX_LV]; -static int lvm_size[MAX_LV]; +static sector_t lvm_size[MAX_LV]; static struct gendisk lvm_gendisk = { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/md.c linux-2.4-lbd/drivers/md/md.c --- linux-2.4.20-rc1/drivers/md/md.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/md.c Wed Oct 30 11:25:33 2002 @@ -109,7 +109,7 @@ static int md_maxreadahead[MAX_MD_DEVS]; static mdk_thread_t *md_recovery_thread; -int md_size[MAX_MD_DEVS]; +sector_t md_size[MAX_MD_DEVS]; static struct block_device_operations md_fops; static devfs_handle_t devfs_handle; @@ -282,10 +282,10 @@ return dname->name; } -static unsigned int calc_dev_sboffset(kdev_t dev, mddev_t *mddev, +static sector_t calc_dev_sboffset(kdev_t dev, mddev_t *mddev, int persistent) { - unsigned int size = 0; + sector_t size = 0; if (blk_size[MAJOR(dev)]) size = blk_size[MAJOR(dev)][MINOR(dev)]; @@ -294,9 +294,9 @@ return size; } -static unsigned int calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent) +static sector_t calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent) { - unsigned int size; + sector_t size; size = calc_dev_sboffset(dev, mddev, persistent); if (!mddev->sb) { @@ -304,13 +304,13 @@ return size; } if (mddev->sb->chunk_size) - size &= ~(mddev->sb->chunk_size/1024 - 1); + size &= ~((sector_t)mddev->sb->chunk_size/1024 - 1); return size; } static unsigned int zoned_raid_size(mddev_t *mddev) { - unsigned int mask; + sector_t mask; mdk_rdev_t * rdev; struct md_list_head *tmp; @@ -321,7 +321,7 @@ /* * do size and offset calculations. */ - mask = ~(mddev->sb->chunk_size/1024 - 1); + mask = ~((sector_t)mddev->sb->chunk_size/1024 - 1); ITERATE_RDEV(mddev,rdev,tmp) { rdev->size &= mask; @@ -331,7 +331,7 @@ } /* - * We check wether all devices are numbered from 0 to nb_dev-1. The + * We check whether all devices are numbered from 0 to nb_dev-1. The * order is guaranteed even after device name changes. * * Some personalities (raid0, linear) use this. Personalities that @@ -474,7 +474,7 @@ struct buffer_head *bh = NULL; kdev_t dev = rdev->dev; mdp_super_t *sb; - unsigned long sb_offset; + sector_t sb_offset; if (!rdev->sb) { MD_BUG(); @@ -784,7 +784,7 @@ { printk(KERN_INFO "md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ", partition_name(rdev->dev), partition_name(rdev->old_dev), - rdev->size, rdev->faulty, rdev->desc_nr); + (long)rdev->size, rdev->faulty, rdev->desc_nr); if (rdev->sb) { printk(KERN_INFO "md: rdev superblock:\n"); print_sb(rdev->sb); @@ -892,7 +892,7 @@ { struct buffer_head *bh; kdev_t dev; - unsigned long sb_offset, size; + sector_t sb_offset, size; mdp_super_t *sb; if (!rdev->sb) { @@ -911,8 +911,8 @@ dev = rdev->dev; sb_offset = calc_dev_sboffset(dev, rdev->mddev, 1); if (rdev->sb_offset != sb_offset) { - printk(KERN_INFO "%s's sb offset has changed from %ld to %ld, skipping\n", - partition_name(dev), rdev->sb_offset, sb_offset); + printk(KERN_INFO "%s's sb offset has changed from %llu to %llu, skipping\n", + partition_name(dev), (unsigned long long)rdev->sb_offset, (unsigned long long)sb_offset); goto skip; } /* @@ -922,12 +922,13 @@ */ size = calc_dev_size(dev, rdev->mddev, 1); if (size != rdev->size) { - printk(KERN_INFO "%s's size has changed from %ld to %ld since import, skipping\n", - partition_name(dev), rdev->size, size); + printk(KERN_INFO "%s's size has changed from %llu to %llu since import, skipping\n", + partition_name(dev), (unsigned long long)rdev->size, + (unsigned long long)size); goto skip; } - printk(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset); + printk(KERN_INFO "(write) %s's sb offset: %llu\n", partition_name(dev), (unsigned long long)sb_offset); fsync_dev(dev); set_blocksize(dev, MD_SB_BYTES); bh = getblk(dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES); @@ -1071,7 +1072,7 @@ { int err; mdk_rdev_t *rdev; - unsigned int size; + sector_t size; if (find_rdev_all(newdev)) return -EEXIST; @@ -1538,9 +1539,9 @@ rdev->size = calc_dev_size(rdev->dev, mddev, persistent); if (rdev->size < sb->chunk_size / 1024) { printk(KERN_WARNING - "md: Dev %s smaller than chunk_size: %ldk < %dk\n", + "md: Dev %s smaller than chunk_size: %lluk < %dk\n", partition_name(rdev->dev), - rdev->size, sb->chunk_size / 1024); + (unsigned long long)rdev->size, sb->chunk_size / 1024); return -EINVAL; } } @@ -2180,7 +2181,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) { - int err, size, persistent; + int err, persistent; + sector_t size; mdk_rdev_t *rdev; unsigned int nr; kdev_t dev; @@ -2611,20 +2613,7 @@ #endif case BLKGETSIZE: /* Return device size */ - if (!arg) { - err = -EINVAL; - MD_BUG(); - goto abort; - } - err = md_put_user(md_hd_struct[minor].nr_sects, - (unsigned long *) arg); - goto done; - case BLKGETSIZE64: /* Return device size */ - err = md_put_user((u64)md_hd_struct[minor].nr_sects << 9, - (u64 *) arg); - goto done; - case BLKRAGET: case BLKRASET: case BLKFLSBUF: @@ -2861,7 +2850,7 @@ default: printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, " - "upgrade your software to use new ictls.\n", + "upgrade your software to use new ioctls.\n", current->comm, current->pid); err = -EINVAL; goto abort_unlock; @@ -3161,7 +3150,8 @@ static int md_status_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) { - int sz = 0, j, size; + int sz = 0, j; + sector_t size; struct md_list_head *tmp, *tmp2; mdk_rdev_t *rdev; mddev_t *mddev; @@ -3202,10 +3192,10 @@ if (mddev->nb_dev) { if (mddev->pers) - sz += sprintf(page + sz, "\n %d blocks", - md_size[mdidx(mddev)]); + sz += sprintf(page + sz, "\n %llu blocks", + (unsigned long long)md_size[mdidx(mddev)]); else - sz += sprintf(page + sz, "\n %d blocks", size); + sz += sprintf(page + sz, "\n %llu blocks", (unsigned long long)size); } if (!mddev->pers) { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/multipath.c linux-2.4-lbd/drivers/md/multipath.c --- linux-2.4.20-rc1/drivers/md/multipath.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/multipath.c Wed Sep 25 10:25:39 2002 @@ -216,8 +216,8 @@ /* * oops, IO error: */ - printk(KERN_ERR "multipath: %s: rescheduling block %lu\n", - partition_name(bh->b_dev), bh->b_blocknr); + printk(KERN_ERR "multipath: %s: rescheduling block %llu\n", + partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); multipath_reschedule_retry(mp_bh); return; } @@ -670,10 +670,10 @@ #define IO_ERROR KERN_ALERT \ -"multipath: %s: unrecoverable IO read error for block %lu\n" +"multipath: %s: unrecoverable IO read error for block %llu\n" #define REDIRECT_SECTOR KERN_ERR \ -"multipath: %s: redirecting sector %lu to another IO path\n" +"multipath: %s: redirecting sector %llu to another IO path\n" /* * This is a kernel thread which: @@ -708,11 +708,11 @@ multipath_map (mddev, &bh->b_dev); if (bh->b_dev == dev) { - printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); + printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); multipath_end_bh_io(mp_bh, 0); } else { printk (REDIRECT_SECTOR, - partition_name(bh->b_dev), bh->b_blocknr); + partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); bh->b_rdev = bh->b_dev; bh->b_rsector = bh->b_blocknr; generic_make_request (mp_bh->cmd, bh); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/raid0.c linux-2.4-lbd/drivers/md/raid0.c --- linux-2.4.20-rc1/drivers/md/raid0.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/raid0.c Wed Sep 25 10:25:39 2002 @@ -41,7 +41,10 @@ printk("raid0: looking at %s\n", partition_name(rdev1->dev)); c = 0; ITERATE_RDEV_ORDERED(mddev,rdev2,j2) { - printk("raid0: comparing %s(%ld) with %s(%ld)\n", partition_name(rdev1->dev), rdev1->size, partition_name(rdev2->dev), rdev2->size); + printk("raid0: comparing %s(%llu) with %s(%llu)\n", partition_name(rdev1->dev), + (unsigned long long)rdev1->size, + partition_name(rdev2->dev), + (unsigned long long)rdev2->size); if (rdev2 == rdev1) { printk("raid0: END\n"); break; @@ -95,7 +98,7 @@ c++; if (!smallest || (rdev->size size)) { smallest = rdev; - printk(" (%ld) is smallest!.\n", rdev->size); + printk(" (%llu) is smallest!.\n", (unsigned long long)rdev->size); } } else printk(" nope.\n"); @@ -120,7 +123,8 @@ static int raid0_run (mddev_t *mddev) { - unsigned long cur=0, i=0, size, zone0_size, nb_zone; + unsigned long cur=0, i=0, zone0_size, nb_zone; + sector_t size; raid0_conf_t *conf; MOD_INC_USE_COUNT; @@ -138,13 +142,18 @@ if (create_strip_zones (mddev)) goto out_free_conf; - printk("raid0 : md_size is %d blocks.\n", md_size[mdidx(mddev)]); + printk("raid0 : md_size is %llu blocks.\n", (unsigned long long)md_size[mdidx(mddev)]); printk("raid0 : conf->smallest->size is %ld blocks.\n", conf->smallest->size); - nb_zone = md_size[mdidx(mddev)]/conf->smallest->size + - (md_size[mdidx(mddev)] % conf->smallest->size ? 1 : 0); - printk("raid0 : nb_zone is %ld.\n", nb_zone); - conf->nr_zones = nb_zone; + { +#if __GNUC__ < 3 /* work around bug in gcc 2.9[56] */ + volatile +#endif + sector_t sz = md_size[mdidx(mddev)]; + unsigned round = sector_div(sz, conf->smallest->size); + conf->nr_zones = nb_zone = sz + (round != 0); + } + printk("raid0 : nb_zone is %ld.\n", nb_zone); printk("raid0 : Allocating %ld bytes for hash.\n", nb_zone*sizeof(struct raid0_hash)); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/md/raid1.c linux-2.4-lbd/drivers/md/raid1.c --- linux-2.4.20-rc1/drivers/md/raid1.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/md/raid1.c Wed Sep 25 10:25:39 2002 @@ -441,8 +441,8 @@ /* * oops, read error: */ - printk(KERN_ERR "raid1: %s: rescheduling block %lu\n", - partition_name(bh->b_dev), bh->b_blocknr); + printk(KERN_ERR "raid1: %s: rescheduling block %llu\n", + partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); raid1_reschedule_retry(r1_bh); return; } @@ -1137,10 +1137,10 @@ #define IO_ERROR KERN_ALERT \ -"raid1: %s: unrecoverable I/O read error for block %lu\n" +"raid1: %s: unrecoverable I/O read error for block %llu\n" #define REDIRECT_SECTOR KERN_ERR \ -"raid1: %s: redirecting sector %lu to another mirror\n" +"raid1: %s: redirecting sector %llu to another mirror\n" /* * This is a kernel thread which: @@ -1251,7 +1251,7 @@ * as reconstruct is about to be aborted */ - printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); + printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); md_done_sync(mddev, bh->b_size>>9, 0); } @@ -1261,11 +1261,11 @@ dev = bh->b_dev; raid1_map (mddev, &bh->b_dev); if (bh->b_dev == dev) { - printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); + printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); raid1_end_bh_io(r1_bh, 0); } else { printk (REDIRECT_SECTOR, - partition_name(bh->b_dev), bh->b_blocknr); + partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); bh->b_rdev = bh->b_dev; bh->b_rsector = bh->b_blocknr; generic_make_request (r1_bh->cmd, bh); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/message/i2o/i2o_block.c linux-2.4-lbd/drivers/message/i2o/i2o_block.c --- linux-2.4.20-rc1/drivers/message/i2o/i2o_block.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/message/i2o/i2o_block.c Wed Sep 25 10:25:42 2002 @@ -125,7 +125,7 @@ static int i2ob_blksizes[MAX_I2OB<<4]; static int i2ob_hardsizes[MAX_I2OB<<4]; -static int i2ob_sizes[MAX_I2OB<<4]; +static sector_t i2ob_sizes[MAX_I2OB<<4]; static int i2ob_media_change_flag[MAX_I2OB]; static u32 i2ob_max_sectors[MAX_I2OB<<4]; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/mtd/devices/blkmtd.c linux-2.4-lbd/drivers/mtd/devices/blkmtd.c --- linux-2.4.20-rc1/drivers/mtd/devices/blkmtd.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/mtd/devices/blkmtd.c Wed Sep 25 10:25:42 2002 @@ -167,7 +167,7 @@ int sectornr, sectors, i; struct kiobuf *iobuf; kdev_t dev; - unsigned long *blocks; + sector_t *blocks; if(!rawdevice) { printk("blkmtd: readpage: PANIC file->private_data == NULL\n"); @@ -227,7 +227,7 @@ /* Pre 2.4.4 doesn't have space for the block list in the kiobuf */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4) - blocks = kmalloc(KIO_MAX_SECTORS * sizeof(unsigned long)); + blocks = kmalloc(KIO_MAX_SECTORS * sizeof(*blocks)); if(blocks == NULL) { printk("blkmtd: cant allocate iobuf blocks\n"); free_kiovec(1, &iobuf); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/mtd/mtdblock.c linux-2.4-lbd/drivers/mtd/mtdblock.c --- linux-2.4.20-rc1/drivers/mtd/mtdblock.c Fri Dec 13 10:45:38 2002 +++ linux-2.4-lbd/drivers/mtd/mtdblock.c Wed Sep 25 10:25:42 2002 @@ -57,7 +57,7 @@ static spinlock_t mtdblks_lock; -static int mtd_sizes[MAX_MTD_DEVICES]; +static sector_t mtd_sizes[MAX_MTD_DEVICES]; static int mtd_blksizes[MAX_MTD_DEVICES]; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14) diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/3w-xxxx.c linux-2.4-lbd/drivers/scsi/3w-xxxx.c --- linux-2.4.20-rc1/drivers/scsi/3w-xxxx.c Fri Dec 13 10:45:49 2002 +++ linux-2.4-lbd/drivers/scsi/3w-xxxx.c Thu Oct 24 14:25:47 2002 @@ -2256,12 +2256,12 @@ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); if (disk->capacity >= 0x200000) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); } dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_biosparam(): heads = %d, sectors = %d, cylinders = %d\n", heads, sectors, cylinders); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/advansys.c linux-2.4-lbd/drivers/scsi/advansys.c --- linux-2.4.20-rc1/drivers/scsi/advansys.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/advansys.c Wed Sep 25 10:26:40 2002 @@ -6219,7 +6219,7 @@ ip[1] = 32; } } - ip[2] = dp->capacity / (ip[0] * ip[1]); + ip[2] = (long)dp->capacity / (ip[0] * ip[1]); ASC_DBG(1, "advansys_biosparam: end\n"); return 0; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/aha152x.c linux-2.4-lbd/drivers/scsi/aha152x.c --- linux-2.4.20-rc1/drivers/scsi/aha152x.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/aha152x.c Wed Sep 25 10:26:40 2002 @@ -1848,7 +1848,7 @@ /* try default translation */ info_array[0] = 64; info_array[1] = 32; - info_array[2] = disk->capacity / (64 * 32); + info_array[2] = (long)disk->capacity / (64 * 32); /* for disks >1GB do some guessing */ if (info_array[2] >= 1024) { @@ -1863,7 +1863,7 @@ " using extended translation.\n"); info_array[0] = 255; info_array[1] = 63; - info_array[2] = disk->capacity / (255 * 63); + info_array[2] = (long)disk->capacity / (255 * 63); } else { printk(KERN_NOTICE "aha152x: unable to verify geometry for disk with >1GB.\n" diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/aic7xxx_old.c linux-2.4-lbd/drivers/scsi/aic7xxx_old.c --- linux-2.4.20-rc1/drivers/scsi/aic7xxx_old.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/aic7xxx_old.c Wed Sep 25 10:26:40 2002 @@ -11752,13 +11752,13 @@ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); if ((p->flags & AHC_EXTEND_TRANS_A) && (cylinders > 1024)) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); } geom[0] = heads; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/atp870u.c linux-2.4-lbd/drivers/scsi/atp870u.c --- linux-2.4.20-rc1/drivers/scsi/atp870u.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/atp870u.c Wed Sep 25 10:26:41 2002 @@ -2850,12 +2850,12 @@ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); if (cylinders > 1024) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); } ip[0] = heads; ip[1] = sectors; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/ibmmca.c linux-2.4-lbd/drivers/scsi/ibmmca.c --- linux-2.4.20-rc1/drivers/scsi/ibmmca.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/ibmmca.c Wed Sep 25 10:26:47 2002 @@ -2386,15 +2386,15 @@ { info[0] = 64; info[1] = 32; - info[2] = disk->capacity / (info[0] * info[1]); + info[2] = (long)disk->capacity / (info[0] * info[1]); if (info[2] >= 1024) { info[0] = 128; info[1] = 63; - info[2] = disk->capacity / (info[0] * info[1]); + info[2] = (long)disk->capacity / (info[0] * info[1]); if (info[2] >= 1024) { info[0] = 255; info[1] = 63; - info[2] = disk->capacity / (info[0] * info[1]); + info[2] = (long)disk->capacity / (info[0] * info[1]); if (info[2] >= 1024) info[2] = 1023; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/ide-scsi.c linux-2.4-lbd/drivers/scsi/ide-scsi.c --- linux-2.4.20-rc1/drivers/scsi/ide-scsi.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/ide-scsi.c Wed Sep 25 10:26:47 2002 @@ -454,11 +454,11 @@ /* * idescsi_do_request is our request handling function. */ -static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) +static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block) { #if IDESCSI_DEBUG_LOG printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); - printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); + printk (KERN_INFO "sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); #endif /* IDESCSI_DEBUG_LOG */ if (rq->cmd == IDESCSI_PC_RQ) { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/imm.c linux-2.4-lbd/drivers/scsi/imm.c --- linux-2.4.20-rc1/drivers/scsi/imm.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/imm.c Wed Sep 25 10:26:47 2002 @@ -1129,11 +1129,11 @@ { ip[0] = 0x40; ip[1] = 0x20; - ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); + ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); if (ip[2] > 1024) { ip[0] = 0xff; ip[1] = 0x3f; - ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); + ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); } return 0; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/in2000.c linux-2.4-lbd/drivers/scsi/in2000.c --- linux-2.4.20-rc1/drivers/scsi/in2000.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/in2000.c Wed Sep 25 10:26:47 2002 @@ -2174,17 +2174,17 @@ if (iinfo[2] > 1024) { iinfo[0] = 64; iinfo[1] = 63; - iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); + iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); } if (iinfo[2] > 1024) { iinfo[0] = 128; iinfo[1] = 63; - iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); + iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); } if (iinfo[2] > 1024) { iinfo[0] = 255; iinfo[1] = 63; - iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); + iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); } return 0; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/ini9100u.c linux-2.4-lbd/drivers/scsi/ini9100u.c --- linux-2.4.20-rc1/drivers/scsi/ini9100u.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/ini9100u.c Wed Sep 25 10:26:47 2002 @@ -592,16 +592,16 @@ if (pTcb->TCS_DrvHead) { info_array[0] = pTcb->TCS_DrvHead; info_array[1] = pTcb->TCS_DrvSector; - info_array[2] = disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; + info_array[2] = (long)disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; } else { if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) { info_array[0] = 255; info_array[1] = 63; - info_array[2] = disk->capacity / 255 / 63; + info_array[2] = (long)disk->capacity / 255 / 63; } else { info_array[0] = 64; info_array[1] = 32; - info_array[2] = disk->capacity >> 11; + info_array[2] = (long)disk->capacity >> 11; } } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/inia100.c linux-2.4-lbd/drivers/scsi/inia100.c --- linux-2.4.20-rc1/drivers/scsi/inia100.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/inia100.c Wed Sep 25 10:26:47 2002 @@ -701,16 +701,16 @@ if (pTcb->TCS_DrvHead) { info_array[0] = pTcb->TCS_DrvHead; info_array[1] = pTcb->TCS_DrvSector; - info_array[2] = disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; + info_array[2] = (long)disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; } else { if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) { info_array[0] = 255; info_array[1] = 63; - info_array[2] = disk->capacity / 255 / 63; + info_array[2] = (long)disk->capacity / 255 / 63; } else { info_array[0] = 64; info_array[1] = 32; - info_array[2] = disk->capacity >> 11; + info_array[2] = (long)disk->capacity >> 11; } } return 0; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/ips.c linux-2.4-lbd/drivers/scsi/ips.c --- linux-2.4.20-rc1/drivers/scsi/ips.c Fri Dec 13 10:45:51 2002 +++ linux-2.4-lbd/drivers/scsi/ips.c Wed Sep 25 10:26:48 2002 @@ -1870,7 +1870,7 @@ sectors = IPS_COMP_SECTORS; } - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); DEBUG_VAR(2, "Geometry: heads: %d, sectors: %d, cylinders: %d", heads, sectors, cylinders); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/megaraid.c linux-2.4-lbd/drivers/scsi/megaraid.c --- linux-2.4.20-rc1/drivers/scsi/megaraid.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/megaraid.c Wed Sep 25 10:26:54 2002 @@ -4236,13 +4236,13 @@ /* Default heads (64) & sectors (32) */ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); /* Handle extended translation size for logical drives > 1Gb */ if (disk->capacity >= 0x200000) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); } /* return result */ @@ -4260,13 +4260,13 @@ /* Default heads (64) & sectors (32) */ heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); /* Handle extended translation size for logical drives > 1Gb */ if (disk->capacity >= 0x200000) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); } /* return result */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/ppa.c linux-2.4-lbd/drivers/scsi/ppa.c --- linux-2.4.20-rc1/drivers/scsi/ppa.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/ppa.c Wed Sep 25 10:26:56 2002 @@ -1004,11 +1004,11 @@ { ip[0] = 0x40; ip[1] = 0x20; - ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); + ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); if (ip[2] > 1024) { ip[0] = 0xff; ip[1] = 0x3f; - ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); + ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); if (ip[2] > 1023) ip[2] = 1023; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/qla1280.c linux-2.4-lbd/drivers/scsi/qla1280.c --- linux-2.4.20-rc1/drivers/scsi/qla1280.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/qla1280.c Wed Sep 25 10:26:57 2002 @@ -1483,14 +1483,14 @@ { int heads, sectors, cylinders; - heads = 64; + heads = 64; sectors = 32; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); if (cylinders > 1024) { heads = 255; sectors = 63; - cylinders = disk->capacity / (heads * sectors); + cylinders = (long)disk->capacity / (heads * sectors); /* if (cylinders > 1023) cylinders = 1023; */ } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/qlogicfas.c linux-2.4-lbd/drivers/scsi/qlogicfas.c --- linux-2.4.20-rc1/drivers/scsi/qlogicfas.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/qlogicfas.c Wed Sep 25 10:26:57 2002 @@ -653,11 +653,11 @@ /* This should mimic the DOS Qlogic driver's behavior exactly */ ip[0] = 0x40; ip[1] = 0x20; - ip[2] = disk->capacity / (ip[0] * ip[1]); + ip[2] = (long)disk->capacity / (ip[0] * ip[1]); if (ip[2] > 1024) { ip[0] = 0xff; ip[1] = 0x3f; - ip[2] = disk->capacity / (ip[0] * ip[1]); + ip[2] = (long)disk->capacity / (ip[0] * ip[1]); #if 0 if (ip[2] > 1023) ip[2] = 1023; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/scsi.c linux-2.4-lbd/drivers/scsi/scsi.c --- linux-2.4.20-rc1/drivers/scsi/scsi.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/scsi.c Wed Sep 25 10:26:57 2002 @@ -2477,7 +2477,7 @@ for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) { /* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */ - printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4ld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", + printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4lld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", i++, SCpnt->host->host_no, @@ -2486,7 +2486,7 @@ SCpnt->lun, kdevname(SCpnt->request.rq_dev), - SCpnt->request.sector, + (unsigned long long)SCpnt->request.sector, SCpnt->request.nr_sectors, SCpnt->request.current_nr_sectors, SCpnt->request.rq_status, diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/scsi_lib.c linux-2.4-lbd/drivers/scsi/scsi_lib.c --- linux-2.4.20-rc1/drivers/scsi/scsi_lib.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/scsi_lib.c Wed Sep 25 10:26:58 2002 @@ -371,8 +371,8 @@ req = &SCpnt->request; req->errors = 0; if (!uptodate) { - printk(" I/O error: dev %s, sector %lu\n", - kdevname(req->rq_dev), req->sector); + printk(" I/O error: dev %s, sector %llu\n", + kdevname(req->rq_dev), (unsigned long long)req->sector); } do { if ((bh = req->bh) != NULL) { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/sd.c linux-2.4-lbd/drivers/scsi/sd.c --- linux-2.4.20-rc1/drivers/scsi/sd.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/sd.c Fri Dec 13 10:40:29 2002 @@ -91,7 +91,7 @@ static Scsi_Disk *rscsi_disks; static struct gendisk *sd_gendisks; -static int *sd_sizes; +static sector_t *sd_sizes; static int *sd_blocksizes; static int *sd_hardsizes; /* Hardware sector size */ static int *sd_max_sectors; @@ -218,7 +218,7 @@ diskinfo[0] = 0x40; diskinfo[1] = 0x20; - diskinfo[2] = rscsi_disks[DEVICE_NR(dev)].capacity >> 11; + diskinfo[2] = (int)rscsi_disks[DEVICE_NR(dev)].capacity >> 11; /* override with calculated, extended default, or driver values */ @@ -294,7 +294,8 @@ static int sd_init_command(Scsi_Cmnd * SCpnt) { - int dev, block, this_count; + int dev, this_count; + sector_t block; struct hd_struct *ppnt; Scsi_Disk *dpnt; #if CONFIG_SCSI_LOGGING @@ -603,7 +604,7 @@ int this_count = SCpnt->bufflen >> 9; int good_sectors = (result == 0 ? this_count : 0); int block_sectors = 1; - long error_sector; + sector_t error_sector; SCSI_LOG_HLCOMPLETE(1, sd_devname(DEVICE_NR(SCpnt->request.rq_dev), nbuff)); @@ -624,7 +625,7 @@ SCpnt->sense_buffer[0] == 0xF0) { /* Sense data is valid */ switch (SCpnt->sense_buffer[2]) { case MEDIUM_ERROR: - error_sector = (SCpnt->sense_buffer[3] << 24) | + error_sector = ((sector_t)SCpnt->sense_buffer[3] << 24) | (SCpnt->sense_buffer[4] << 16) | (SCpnt->sense_buffer[5] << 8) | SCpnt->sense_buffer[6]; @@ -953,7 +954,7 @@ */ rscsi_disks[i].ready = 1; - rscsi_disks[i].capacity = 1 + ((buffer[0] << 24) | + rscsi_disks[i].capacity = 1 + (((sector_t)buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]); @@ -1001,7 +1002,11 @@ */ int m; int hard_sector = sector_size; - int sz = rscsi_disks[i].capacity * (hard_sector/256); + sector_t sz = rscsi_disks[i].capacity * (hard_sector/256); + sector_t mb = sz >> 1; + sector_div(sz, 1250); + mb -= sz - 974; + sector_div(mb, 1950); /* There are 16 minors allocated for each major device */ for (m = i << 4; m < ((i + 1) << 4); m++) { @@ -1009,19 +1014,19 @@ } printk("SCSI device %s: " - "%d %d-byte hdwr sectors (%d MB)\n", - nbuff, rscsi_disks[i].capacity, - hard_sector, (sz/2 - sz/1250 + 974)/1950); + "%llu %d-byte hdwr sectors (%llu MB)\n", + nbuff, (unsigned long long)rscsi_disks[i].capacity, + hard_sector, (unsigned long long)mb); } /* Rescale capacity to 512-byte units */ if (sector_size == 4096) rscsi_disks[i].capacity <<= 3; - if (sector_size == 2048) + else if (sector_size == 2048) rscsi_disks[i].capacity <<= 2; - if (sector_size == 1024) + else if (sector_size == 1024) rscsi_disks[i].capacity <<= 1; - if (sector_size == 256) + else if (sector_size == 256) rscsi_disks[i].capacity >>= 1; } @@ -1123,20 +1128,20 @@ memset(rscsi_disks, 0, sd_template.dev_max * sizeof(Scsi_Disk)); /* for every (necessary) major: */ - sd_sizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); + sd_sizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_sizes), GFP_ATOMIC); if (!sd_sizes) goto cleanup_disks; - memset(sd_sizes, 0, (sd_template.dev_max << 4) * sizeof(int)); + memset(sd_sizes, 0, (sd_template.dev_max << 4) * sizeof(*sd_sizes)); - sd_blocksizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); + sd_blocksizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_blocksizes), GFP_ATOMIC); if (!sd_blocksizes) goto cleanup_sizes; - - sd_hardsizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); + + sd_hardsizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_hardsizes), GFP_ATOMIC); if (!sd_hardsizes) goto cleanup_blocksizes; - sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); + sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_max_sectors), GFP_ATOMIC); if (!sd_max_sectors) goto cleanup_max_sectors; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/sd.h linux-2.4-lbd/drivers/scsi/sd.h --- linux-2.4.20-rc1/drivers/scsi/sd.h Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/sd.h Fri Oct 11 14:15:03 2002 @@ -24,7 +24,7 @@ #endif typedef struct scsi_disk { - unsigned capacity; /* size in blocks */ + sector_t capacity; /* size in blocks */ Scsi_Device *device; unsigned char ready; /* flag ready for FLOPTICAL */ unsigned char write_prot; /* flag write_protect for rmvable dev */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/sr.c linux-2.4-lbd/drivers/scsi/sr.c --- linux-2.4.20-rc1/drivers/scsi/sr.c Fri Dec 13 10:45:52 2002 +++ linux-2.4-lbd/drivers/scsi/sr.c Wed Sep 25 10:26:58 2002 @@ -85,7 +85,7 @@ }; Scsi_CD *scsi_CDs; -static int *sr_sizes; +static sector_t *sr_sizes; static int *sr_blocksizes; static int *sr_hardsizes; @@ -198,7 +198,7 @@ int good_sectors = (result == 0 ? this_count : 0); int block_sectors = 0; int device_nr = DEVICE_NR(SCpnt->request.rq_dev); - long error_sector; + sector_t error_sector; #ifdef DEBUG printk("sr.c done: %x %p\n", result, SCpnt->request.bh->b_data); @@ -216,7 +216,7 @@ case MEDIUM_ERROR: case VOLUME_OVERFLOW: case ILLEGAL_REQUEST: - error_sector = (SCpnt->sense_buffer[3] << 24) | + error_sector = ((sector_t)SCpnt->sense_buffer[3] << 24) | (SCpnt->sense_buffer[4] << 16) | (SCpnt->sense_buffer[5] << 8) | SCpnt->sense_buffer[6]; @@ -293,7 +293,7 @@ /* * need front pad */ - if ((fsize = SCpnt->request.sector % (s_size >> 9))) { + if ((fsize = (unsigned long)SCpnt->request.sector % (s_size >> 9))) { fsize <<= 9; sg_ent++; if ((front = scsi_malloc(fsize)) == NULL) @@ -425,12 +425,12 @@ return 0; } - block = SCpnt->request.sector / (s_size >> 9); + block = (long)SCpnt->request.sector / (s_size >> 9); /* * request doesn't start on hw block boundary, add scatter pads */ - if ((SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) + if (((long)SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) if (sr_scatter_pad(SCpnt, s_size)) return 0; @@ -824,16 +824,16 @@ goto cleanup_devfs; memset(scsi_CDs, 0, sr_template.dev_max * sizeof(Scsi_CD)); - sr_sizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); + sr_sizes = kmalloc(sr_template.dev_max * sizeof(sr_sizes[0]), GFP_ATOMIC); if (!sr_sizes) goto cleanup_cds; - memset(sr_sizes, 0, sr_template.dev_max * sizeof(int)); + memset(sr_sizes, 0, sr_template.dev_max * sizeof(sr_sizes[0])); - sr_blocksizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); + sr_blocksizes = kmalloc(sr_template.dev_max * sizeof(sr_blocksizes[0]), GFP_ATOMIC); if (!sr_blocksizes) goto cleanup_sizes; - sr_hardsizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); + sr_hardsizes = kmalloc(sr_template.dev_max * sizeof(sr_hardsizes[0]), GFP_ATOMIC); if (!sr_hardsizes) goto cleanup_blocksizes; /* diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/drivers/scsi/wd7000.c linux-2.4-lbd/drivers/scsi/wd7000.c --- linux-2.4.20-rc1/drivers/scsi/wd7000.c Fri Dec 13 10:45:54 2002 +++ linux-2.4-lbd/drivers/scsi/wd7000.c Wed Sep 25 10:27:01 2002 @@ -1739,7 +1739,7 @@ */ ip[0] = 64; ip[1] = 32; - ip[2] = disk->capacity / (64 * 32); + ip[2] = (long)disk->capacity / (64 * 32); /* * for disks >1GB do some guessing @@ -1758,7 +1758,7 @@ ip[0] = 255; ip[1] = 63; - ip[2] = disk->capacity / (255 * 63); + ip[2] = (long)disk->capacity / (255 * 63); } else { ip[0] = info[0]; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/adfs/adfs.h linux-2.4-lbd/fs/adfs/adfs.h --- linux-2.4.20-rc1/fs/adfs/adfs.h Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/adfs/adfs.h Wed Sep 25 10:27:34 2002 @@ -66,7 +66,7 @@ /* Inode stuff */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) -int adfs_get_block(struct inode *inode, long block, +int adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh, int create); #else int adfs_bmap(struct inode *inode, int block); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/adfs/inode.c linux-2.4-lbd/fs/adfs/inode.c --- linux-2.4.20-rc1/fs/adfs/inode.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/adfs/inode.c Wed Sep 25 10:27:34 2002 @@ -27,7 +27,7 @@ * not support creation of new blocks, so we return -EIO for this case. */ int -adfs_get_block(struct inode *inode, long block, struct buffer_head *bh, int create) +adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh, int create) { if (block < 0) goto abort_negative; @@ -71,7 +71,7 @@ &page->mapping->host->u.adfs_i.mmu_private); } -static int _adfs_bmap(struct address_space *mapping, long block) +static sector_t _adfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, adfs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/affs/file.c linux-2.4-lbd/fs/affs/file.c --- linux-2.4.20-rc1/fs/affs/file.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/affs/file.c Wed Sep 25 10:27:34 2002 @@ -38,7 +38,7 @@ static struct buffer_head *affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext); static inline struct buffer_head *affs_get_extblock(struct inode *inode, u32 ext); static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); -static int affs_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create); +static int affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create); static ssize_t affs_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos); static int affs_file_open(struct inode *inode, struct file *filp); @@ -332,17 +332,21 @@ } static int -affs_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create) +affs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { struct super_block *sb = inode->i_sb; struct buffer_head *ext_bh; + long block = iblock; u32 ext; - pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, block); + pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, (long)block); if (block < 0) goto err_small; + if (unlikely(iblock != block)) + goto err_big; + if (block >= AFFS_INODE->i_blkcnt) { if (block > AFFS_INODE->i_blkcnt || !create) goto err_big; @@ -423,7 +427,7 @@ return cont_prepare_write(page, from, to, affs_get_block, &page->mapping->host->u.affs_i.mmu_private); } -static int _affs_bmap(struct address_space *mapping, long block) +static sector_t _affs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,affs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/affs/super.c linux-2.4-lbd/fs/affs/super.c --- linux-2.4.20-rc1/fs/affs/super.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/affs/super.c Wed Sep 25 10:27:35 2002 @@ -29,7 +29,6 @@ #include #include -extern int *blk_size[]; extern struct timezone sys_tz; static int affs_statfs(struct super_block *sb, struct statfs *buf); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/befs/linuxvfs.c linux-2.4-lbd/fs/befs/linuxvfs.c --- linux-2.4.20-rc1/fs/befs/linuxvfs.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/befs/linuxvfs.c Wed Sep 25 10:27:35 2002 @@ -27,9 +27,9 @@ #define VFS_BLOCK_SIZE 512 static int befs_readdir(struct file *, void *, filldir_t); -static int befs_get_block(struct inode *, long, struct buffer_head *, int); +static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int); static int befs_readpage(struct file *file, struct page *page); -static int befs_bmap(struct address_space *mapping, long block); +static sector_t befs_bmap(struct address_space *mapping, sector_t block); static struct dentry *befs_lookup(struct inode *, struct dentry *); static void befs_read_inode(struct inode *ino); static void befs_clear_inode(struct inode *ino); @@ -97,8 +97,8 @@ return block_read_full_page(page, befs_get_block); } -static int -befs_bmap(struct address_space *mapping, long block) +static sector_t +befs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, befs_get_block); } @@ -115,7 +115,7 @@ */ static int -befs_get_block(struct inode *inode, long block, +befs_get_block(struct inode *inode, sector_t sect, struct buffer_head *bh_result, int create) { struct super_block *sb = inode->i_sb; @@ -123,6 +123,7 @@ befs_block_run run = BAD_IADDR; int res = 0; ulong disk_off; + long block = (unsigned long)sect; befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", inode->i_ino, block); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/bfs/file.c linux-2.4-lbd/fs/bfs/file.c --- linux-2.4.20-rc1/fs/bfs/file.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/bfs/file.c Wed Sep 25 10:27:39 2002 @@ -54,7 +54,7 @@ return 0; } -static int bfs_get_block(struct inode * inode, long block, +static int bfs_get_block(struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) { long phys; @@ -151,7 +151,7 @@ return block_prepare_write(page, from, to, bfs_get_block); } -static int bfs_bmap(struct address_space *mapping, long block) +static sector_t bfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, bfs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/block_dev.c linux-2.4-lbd/fs/block_dev.c --- linux-2.4.20-rc1/fs/block_dev.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/block_dev.c Wed Sep 25 10:27:33 2002 @@ -22,14 +22,14 @@ #include -static unsigned long max_block(kdev_t dev) +static sector_t max_block(kdev_t dev) { - unsigned int retval = ~0U; + sector_t retval = ~0; int major = MAJOR(dev); if (blk_size[major]) { int minor = MINOR(dev); - unsigned int blocks = blk_size[major][minor]; + sector_t blocks = blk_size[major][minor]; if (blocks) { unsigned int size = block_size(dev); unsigned int sizebits = blksize_bits(size); @@ -44,7 +44,7 @@ static loff_t blkdev_size(kdev_t dev) { - unsigned int blocks = ~0U; + sector_t blocks = ~0; int major = MAJOR(dev); if (blk_size[major]) { @@ -120,7 +120,7 @@ return sb_set_blocksize(sb, size); } -static int blkdev_get_block(struct inode * inode, long iblock, struct buffer_head * bh, int create) +static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer_head * bh, int create) { if (iblock >= max_block(inode->i_rdev)) return -EIO; @@ -131,7 +131,7 @@ return 0; } -static int blkdev_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize) +static int blkdev_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, sector_t blocknr, int blocksize) { return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, blkdev_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/buffer.c linux-2.4-lbd/fs/buffer.c --- linux-2.4.20-rc1/fs/buffer.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/buffer.c Fri Oct 11 12:15:16 2002 @@ -558,7 +558,7 @@ spin_unlock(&lru_list_lock); } -struct buffer_head * get_hash_table(kdev_t dev, int block, int size) +struct buffer_head * get_hash_table(kdev_t dev, sector_t block, int size) { struct buffer_head *bh, **p = &hash(dev, block); @@ -947,7 +947,7 @@ * 14.02.92: changed it to sync dirty buffers a bit: better performance * when the filesystem starts to get full of dirty blocks (I hope). */ -struct buffer_head * getblk(kdev_t dev, int block, int size) +struct buffer_head * getblk(kdev_t dev, sector_t block, int size) { for (;;) { struct buffer_head * bh; @@ -1114,7 +1114,7 @@ * Reads a specified block, and returns buffer head that * contains it. It returns NULL if the block was unreadable. */ -struct buffer_head * bread(kdev_t dev, int block, int size) +struct buffer_head * bread(kdev_t dev, sector_t block, int size) { struct buffer_head * bh; @@ -1546,7 +1546,7 @@ unsigned from, unsigned to, get_block_t *get_block) { unsigned block_start, block_end; - unsigned long block; + sector_t block; int err = 0; unsigned blocksize, bbits; struct buffer_head *bh, *head, *wait[2], **wait_bh=wait; @@ -1558,7 +1558,7 @@ head = page->buffers; bbits = inode->i_blkbits; - block = page->index << (PAGE_CACHE_SHIFT - bbits); + block = (sector_t)page->index << (PAGE_CACHE_SHIFT - bbits); for(bh = head, block_start = 0; bh != head || !block_start; block++, block_start=block_end, bh = bh->b_this_page) { @@ -1686,7 +1686,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block) { struct inode *inode = page->mapping->host; - unsigned long iblock, lblock; + sector_t iblock, lblock; struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; unsigned int blocksize, blocks; int nr, i; @@ -1699,7 +1699,7 @@ head = page->buffers; blocks = PAGE_CACHE_SIZE >> inode->i_blkbits; - iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); + iblock = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); lblock = (inode->i_size+blocksize-1) >> inode->i_blkbits; bh = head; nr = 0; @@ -2081,7 +2081,7 @@ } EXPORT_SYMBOL(waitfor_one_page); -int generic_block_bmap(struct address_space *mapping, long block, get_block_t *get_block) +sector_t generic_block_bmap(struct address_space *mapping, sector_t block, get_block_t *get_block) { struct buffer_head tmp; struct inode *inode = mapping->host; @@ -2091,10 +2091,12 @@ return tmp.b_blocknr; } -int generic_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize, get_block_t * get_block) +int generic_direct_IO(int rw, struct inode * inode, + struct kiobuf * iobuf, sector_t blocknr, + int blocksize, get_block_t * get_block) { int i, nr_blocks, retval; - unsigned long * blocks = iobuf->blocks; + sector_t *blocks = iobuf->blocks; int length; length = iobuf->length; @@ -2122,7 +2124,7 @@ BUG(); if (!buffer_mapped(&bh)) { /* there was an hole in the filesystem */ - blocks[i] = -1UL; + blocks[i] = ~(sector_t)0; continue; } } else { @@ -2207,7 +2209,7 @@ */ int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], - kdev_t dev, unsigned long b[], int size) + kdev_t dev, sector_t b[], int size) { int err; int length; @@ -2217,7 +2219,7 @@ int pageind; int bhind; int offset; - unsigned long blocknr; + sector_t blocknr; struct kiobuf * iobuf = NULL; struct page * map; struct buffer_head *tmp, **bhs = NULL; @@ -2342,7 +2344,7 @@ * FIXME: we need a swapper_inode->get_block function to remove * some of the bmap kludges and interface ugliness here. */ -int brw_page(int rw, struct page *page, kdev_t dev, int b[], int size) +int brw_page(int rw, struct page *page, kdev_t dev, sector_t b[], int size) { struct buffer_head *head, *bh; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/efs/file.c linux-2.4-lbd/fs/efs/file.c --- linux-2.4.20-rc1/fs/efs/file.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/efs/file.c Wed Sep 25 10:27:40 2002 @@ -8,7 +8,7 @@ #include -int efs_get_block(struct inode *inode, long iblock, +int efs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { int error = -EROFS; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/efs/inode.c linux-2.4-lbd/fs/efs/inode.c --- linux-2.4.20-rc1/fs/efs/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/efs/inode.c Wed Sep 25 10:27:40 2002 @@ -12,12 +12,12 @@ #include -extern int efs_get_block(struct inode *, long, struct buffer_head *, int); +extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); static int efs_readpage(struct file *file, struct page *page) { return block_read_full_page(page,efs_get_block); } -static int _efs_bmap(struct address_space *mapping, long block) +static sector_t _efs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,efs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/ext2/inode.c linux-2.4-lbd/fs/ext2/inode.c --- linux-2.4.20-rc1/fs/ext2/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/ext2/inode.c Wed Sep 25 10:27:40 2002 @@ -496,7 +496,7 @@ * reachable from inode. */ -static int ext2_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +static int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { int err = -EIO; int offsets[4]; @@ -579,11 +579,12 @@ { return block_prepare_write(page,from,to,ext2_get_block); } -static int ext2_bmap(struct address_space *mapping, long block) +static sector_t ext2_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,ext2_get_block); } -static int ext2_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize) +static int ext2_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, + sector_t blocknr, int blocksize) { return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, ext2_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/ext3/ialloc.c linux-2.4-lbd/fs/ext3/ialloc.c --- linux-2.4.20-rc1/fs/ext3/ialloc.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/ext3/ialloc.c Wed Sep 25 10:27:40 2002 @@ -564,8 +564,8 @@ is_bad_inode(inode) || NEXT_ORPHAN(inode) > max_ino) { ext3_warning(sb, __FUNCTION__, "bad orphan inode %ld! e2fsck was run?\n", ino); - printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%ld) = %d\n", - bit, bh->b_blocknr, ext3_test_bit(bit, bh->b_data)); + printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", + bit, (unsigned long long)bh->b_blocknr, ext3_test_bit(bit, bh->b_data)); printk(KERN_NOTICE "inode=%p\n", inode); if (inode) { printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/ext3/inode.c linux-2.4-lbd/fs/ext3/inode.c --- linux-2.4.20-rc1/fs/ext3/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/ext3/inode.c Wed Sep 25 10:27:40 2002 @@ -825,7 +825,7 @@ /* * The BKL is not held on entry here. */ -static int ext3_get_block(struct inode *inode, long iblock, +static int ext3_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { handle_t *handle = 0; @@ -1165,7 +1165,7 @@ * So, if we see any bmap calls here on a modified, data-journaled file, * take extra steps to flush any blocks which might be in the cache. */ -static int ext3_bmap(struct address_space *mapping, long block) +static sector_t ext3_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; journal_t *journal; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/fat/file.c linux-2.4-lbd/fs/fat/file.c --- linux-2.4.20-rc1/fs/fat/file.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/fat/file.c Wed Sep 25 10:27:40 2002 @@ -48,11 +48,13 @@ } -int fat_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +int fat_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { struct super_block *sb = inode->i_sb; unsigned long phys; + BUG_ON(sizeof(iblock) > 4 && (iblock>>32)); + phys = fat_bmap(inode, iblock); if (phys) { bh_result->b_dev = inode->i_dev; @@ -66,7 +68,7 @@ BUG(); return -EIO; } - if (!(iblock % MSDOS_SB(inode->i_sb)->cluster_size)) { + if (!((unsigned long)iblock % MSDOS_SB(inode->i_sb)->cluster_size)) { if (fat_add_cluster(inode) < 0) return -ENOSPC; } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/fat/inode.c linux-2.4-lbd/fs/fat/inode.c --- linux-2.4.20-rc1/fs/fat/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/fat/inode.c Wed Sep 25 10:27:40 2002 @@ -869,7 +869,7 @@ return cont_prepare_write(page,from,to,fat_get_block, &MSDOS_I(page->mapping->host)->mmu_private); } -static int _fat_bmap(struct address_space *mapping, long block) +static sector_t _fat_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,fat_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/fat/misc.c linux-2.4-lbd/fs/fat/misc.c --- linux-2.4.20-rc1/fs/fat/misc.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/fat/misc.c Wed Sep 25 10:27:40 2002 @@ -182,10 +182,10 @@ mark_inode_dirty(inode); } if (file_cluster - != inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) { + != (long)inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) { printk ("file_cluster badly computed!!! %d <> %ld\n", file_cluster, - inode->i_blocks / cluster_size / (sb->s_blocksize / 512)); + (long)inode->i_blocks / cluster_size / (sb->s_blocksize / 512)); fat_cache_inval_inode(inode); } inode->i_blocks += (1 << MSDOS_SB(sb)->cluster_bits) / 512; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/freevxfs/vxfs_kcompat.h linux-2.4-lbd/fs/freevxfs/vxfs_kcompat.h --- linux-2.4.20-rc1/fs/freevxfs/vxfs_kcompat.h Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/freevxfs/vxfs_kcompat.h Wed Oct 30 10:02:20 2002 @@ -7,10 +7,8 @@ #include -typedef long sector_t; - /* Dito. */ -static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) +static inline void map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) { bh->b_state |= 1 << BH_Mapped; bh->b_dev = sb->s_dev; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/freevxfs/vxfs_subr.c linux-2.4-lbd/fs/freevxfs/vxfs_subr.c --- linux-2.4.20-rc1/fs/freevxfs/vxfs_subr.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/freevxfs/vxfs_subr.c Wed Sep 25 10:27:41 2002 @@ -42,7 +42,7 @@ static int vxfs_readpage(struct file *, struct page *); -static int vxfs_bmap(struct address_space *, long); +static sector_t vxfs_bmap(struct address_space *, sector_t); struct address_space_operations vxfs_aops = { .readpage = vxfs_readpage, @@ -185,8 +185,8 @@ * Locking status: * We are under the bkl. */ -static int -vxfs_bmap(struct address_space *mapping, long block) +static sector_t +vxfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, vxfs_getblk); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/hfs/file.c linux-2.4-lbd/fs/hfs/file.c --- linux-2.4.20-rc1/fs/hfs/file.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/hfs/file.c Wed Sep 25 10:27:41 2002 @@ -106,7 +106,7 @@ * block number. This function just calls hfs_extent_map() to do the * real work and then stuffs the appropriate info into the buffer_head. */ -int hfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +int hfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { unsigned long phys; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/hfs/hfs.h linux-2.4-lbd/fs/hfs/hfs.h --- linux-2.4.20-rc1/fs/hfs/hfs.h Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/hfs/hfs.h Wed Oct 30 10:02:22 2002 @@ -495,7 +495,7 @@ extern void hfs_extent_free(struct hfs_fork *); /* file.c */ -extern int hfs_get_block(struct inode *, long, struct buffer_head *, int); +extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); /* mdb.c */ extern struct hfs_mdb *hfs_mdb_get(hfs_sysmdb, int, hfs_s32); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/hfs/inode.c linux-2.4-lbd/fs/hfs/inode.c --- linux-2.4.20-rc1/fs/hfs/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/hfs/inode.c Wed Sep 25 10:27:41 2002 @@ -235,7 +235,7 @@ return cont_prepare_write(page,from,to,hfs_get_block, &page->mapping->host->u.hfs_i.mmu_private); } -static int hfs_bmap(struct address_space *mapping, long block) +static sector_t hfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,hfs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/hpfs/file.c linux-2.4-lbd/fs/hpfs/file.c --- linux-2.4.20-rc1/fs/hpfs/file.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/hpfs/file.c Wed Sep 25 10:27:44 2002 @@ -68,7 +68,7 @@ hpfs_write_inode(i); } -int hpfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { secno s; s = hpfs_bmap(inode, iblock); @@ -108,7 +108,7 @@ return cont_prepare_write(page,from,to,hpfs_get_block, &page->mapping->host->u.hpfs_i.mmu_private); } -static int _hpfs_bmap(struct address_space *mapping, long block) +static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,hpfs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/hpfs/hpfs_fn.h linux-2.4-lbd/fs/hpfs/hpfs_fn.h --- linux-2.4.20-rc1/fs/hpfs/hpfs_fn.h Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/hpfs/hpfs_fn.h Wed Oct 30 10:02:31 2002 @@ -261,7 +261,7 @@ int hpfs_file_fsync(struct file *, struct dentry *, int); secno hpfs_bmap(struct inode *, unsigned); void hpfs_truncate(struct inode *); -int hpfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create); +int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); ssize_t hpfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos); /* inode.c */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/inode.c linux-2.4-lbd/fs/inode.c --- linux-2.4.20-rc1/fs/inode.c Fri Dec 13 10:46:02 2002 +++ linux-2.4-lbd/fs/inode.c Wed Sep 25 10:27:34 2002 @@ -1112,9 +1112,9 @@ * file. */ -int bmap(struct inode * inode, int block) +sector_t bmap(struct inode * inode, sector_t block) { - int res = 0; + sector_t res = 0; if (inode->i_mapping->a_ops->bmap) res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block); return res; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/isofs/inode.c linux-2.4-lbd/fs/isofs/inode.c --- linux-2.4.20-rc1/fs/isofs/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/isofs/inode.c Wed Sep 25 10:27:45 2002 @@ -976,7 +976,7 @@ /* * Used by the standard interfaces. */ -static int isofs_get_block(struct inode *inode, long iblock, +static int isofs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { if ( create ) { @@ -984,10 +984,11 @@ return -EROFS; } - return isofs_get_blocks(inode, iblock, &bh_result, 1) ? 0 : -EIO; + BUG_ON(sizeof(iblock) > 4 && (iblock >> 32)); + return isofs_get_blocks(inode, (long)iblock, &bh_result, 1) ? 0 : -EIO; } -static int isofs_bmap(struct inode *inode, int block) +static int isofs_bmap(struct inode *inode, sector_t block) { struct buffer_head dummy; int error; @@ -1000,7 +1001,7 @@ return 0; } -struct buffer_head *isofs_bread(struct inode *inode, unsigned int block) +struct buffer_head *isofs_bread(struct inode *inode, sector_t block) { unsigned int blknr = isofs_bmap(inode, block); if (!blknr) @@ -1013,7 +1014,7 @@ return block_read_full_page(page,isofs_get_block); } -static int _isofs_bmap(struct address_space *mapping, long block) +static sector_t _isofs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,isofs_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/jbd/commit.c linux-2.4-lbd/fs/jbd/commit.c --- linux-2.4.20-rc1/fs/jbd/commit.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/jbd/commit.c Fri Oct 11 12:15:16 2002 @@ -359,8 +359,8 @@ } bh = jh2bh(descriptor); - jbd_debug(4, "JBD: got buffer %ld (%p)\n", - bh->b_blocknr, bh->b_data); + jbd_debug(4, "JBD: got buffer %llu (%p)\n", + (unsigned long long)bh->b_blocknr, bh->b_data); header = (journal_header_t *)&bh->b_data[0]; header->h_magic = htonl(JFS_MAGIC_NUMBER); header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/jbd/journal.c linux-2.4-lbd/fs/jbd/journal.c --- linux-2.4.20-rc1/fs/jbd/journal.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/jbd/journal.c Fri Oct 11 12:15:16 2002 @@ -1505,9 +1505,9 @@ if (buffer_dirty(bh)) { printk ("%sUnexpected dirty buffer encountered at " - "%s:%d (%s blocknr %lu)\n", + "%s:%d (%s blocknr %llu)\n", KERN_WARNING, function, line, - kdevname(bh->b_dev), bh->b_blocknr); + kdevname(bh->b_dev), (unsigned long long)bh->b_blocknr); #ifdef JBD_PARANOID_WRITES J_ASSERT_BH (bh, !buffer_dirty(bh)); #endif diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/jbd/revoke.c linux-2.4-lbd/fs/jbd/revoke.c --- linux-2.4.20-rc1/fs/jbd/revoke.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/jbd/revoke.c Wed Sep 25 10:27:46 2002 @@ -389,7 +389,7 @@ record = find_revoke_record(journal, bh->b_blocknr); if (record) { jbd_debug(4, "cancelled existing revoke on " - "blocknr %lu\n", bh->b_blocknr); + "blocknr %llu\n", (unsigned long long)bh->b_blocknr); list_del(&record->hash); kmem_cache_free(revoke_record_cache, record); did_revoke = 1; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/jfs/inode.c linux-2.4-lbd/fs/jfs/inode.c --- linux-2.4.20-rc1/fs/jfs/inode.c Fri Dec 13 10:46:07 2002 +++ linux-2.4-lbd/fs/jfs/inode.c Wed Sep 25 10:27:54 2002 @@ -195,7 +195,7 @@ set_cflag(COMMIT_Dirty, inode); } -static int jfs_get_block(struct inode *ip, long lblock, +static int jfs_get_block(struct inode *ip, sector_t lblock, struct buffer_head *bh_result, int create) { s64 lblock64 = lblock; @@ -318,13 +318,13 @@ return block_prepare_write(page, from, to, jfs_get_block); } -static int jfs_bmap(struct address_space *mapping, long block) +static sector_t jfs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping, block, jfs_get_block); } static int jfs_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf, - unsigned long blocknr, int blocksize) + sector_t blocknr, int blocksize) { return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, jfs_get_block); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/minix/inode.c linux-2.4-lbd/fs/minix/inode.c --- linux-2.4.20-rc1/fs/minix/inode.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/minix/inode.c Wed Sep 25 10:27:57 2002 @@ -292,7 +292,7 @@ return 0; } -static int minix_get_block(struct inode *inode, long block, +static int minix_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create) { if (INODE_VERSION(inode) == MINIX_V1) @@ -313,7 +313,7 @@ { return block_prepare_write(page,from,to,minix_get_block); } -static int minix_bmap(struct address_space *mapping, long block) +static sector_t minix_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,minix_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/minix/itree_common.c linux-2.4-lbd/fs/minix/itree_common.c --- linux-2.4.20-rc1/fs/minix/itree_common.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/minix/itree_common.c Wed Sep 25 10:27:57 2002 @@ -140,7 +140,7 @@ return -EAGAIN; } -static inline int get_block(struct inode * inode, long block, +static inline int get_block(struct inode * inode, sector_t block, struct buffer_head *bh_result, int create) { int err = -EIO; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/acorn.c linux-2.4-lbd/fs/partitions/acorn.c --- linux-2.4.20-rc1/fs/partitions/acorn.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/acorn.c Wed Sep 25 10:28:10 2002 @@ -462,7 +462,7 @@ * Returns: -1 on error, 0 if not ADFS format, 1 if ok. */ int acorn_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sect, int first_minor) + sector_t first_sect, int first_minor) { int i; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/acorn.h linux-2.4-lbd/fs/partitions/acorn.h --- linux-2.4.20-rc1/fs/partitions/acorn.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/acorn.h Thu Oct 24 14:58:16 2002 @@ -51,5 +51,5 @@ int acorn_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sect, int first_minor); + sector_t first_sect, int first_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/amiga.c linux-2.4-lbd/fs/partitions/amiga.c --- linux-2.4.20-rc1/fs/partitions/amiga.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/amiga.c Wed Sep 25 10:28:10 2002 @@ -32,7 +32,7 @@ int amiga_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor) + sector_t first_sector, int first_part_minor) { Sector sect; unsigned char *data; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/amiga.h linux-2.4-lbd/fs/partitions/amiga.h --- linux-2.4.20-rc1/fs/partitions/amiga.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/amiga.h Wed Sep 25 10:28:10 2002 @@ -4,5 +4,5 @@ int amiga_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/atari.c linux-2.4-lbd/fs/partitions/atari.c --- linux-2.4.20-rc1/fs/partitions/atari.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/atari.c Wed Sep 25 10:28:10 2002 @@ -41,7 +41,7 @@ } int atari_partition (struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int minor) + sector_t first_sector, int minor) { int m_lim = minor + hd->max_p; Sector sect; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/atari.h linux-2.4-lbd/fs/partitions/atari.h --- linux-2.4.20-rc1/fs/partitions/atari.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/atari.h Wed Sep 25 10:28:10 2002 @@ -32,5 +32,5 @@ } __attribute__((__packed__)); int atari_partition (struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/check.c linux-2.4-lbd/fs/partitions/check.c --- linux-2.4.20-rc1/fs/partitions/check.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/check.c Wed Sep 25 10:28:10 2002 @@ -19,6 +19,7 @@ #include #include #include +#include #include "check.h" @@ -35,11 +36,10 @@ #include "ultrix.h" #include "efi.h" -extern int *blk_size[]; int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ -static int (*check_part[])(struct gendisk *hd, struct block_device *bdev, unsigned long first_sect, int first_minor) = { +static int (*check_part[])(struct gendisk *hd, struct block_device *bdev, sector_t first_sect, int first_minor) = { #ifdef CONFIG_ACORN_PARTITION acorn_partition, #endif @@ -204,7 +204,7 @@ /* * Add a partitions details to the devices partition description. */ -void add_gd_partition(struct gendisk *hd, int minor, int start, int size) +void add_gd_partition(struct gendisk *hd, int minor, sector_t start, sector_t size) { #ifndef CONFIG_DEVFS_FS char buf[40]; @@ -227,7 +227,7 @@ { devfs_handle_t de = NULL; static int first_time = 1; - unsigned long first_sector; + sector_t first_sector; struct block_device *bdev; char buf[64]; int i; @@ -374,14 +374,14 @@ */ void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors, - struct block_device_operations *ops, long size) + struct block_device_operations *ops, sector_t size) { if (!gdev) return; grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size); } -void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size) +void grok_partitions(struct gendisk *dev, int drive, unsigned minors, sector_t size) { int i; int first_minor = drive << dev->minor_shift; @@ -415,13 +415,12 @@ } } -unsigned char *read_dev_sector(struct block_device *bdev, unsigned long n, Sector *p) +unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) { struct address_space *mapping = bdev->bd_inode->i_mapping; - int sect = PAGE_CACHE_SIZE / 512; struct page *page; - page = read_cache_page(mapping, n/sect, + page = read_cache_page(mapping, n >> (PAGE_CACHE_SHIFT-9), (filler_t *)mapping->a_ops->readpage, NULL); if (!IS_ERR(page)) { wait_on_page(page); @@ -430,7 +429,7 @@ if (PageError(page)) goto fail; p->v = page; - return (unsigned char *)page_address(page) + 512 * (n % sect); + return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9); fail: page_cache_release(page); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/check.h linux-2.4-lbd/fs/partitions/check.h --- linux-2.4.20-rc1/fs/partitions/check.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/check.h Wed Sep 25 10:28:10 2002 @@ -2,11 +2,11 @@ * add_partition adds a partitions details to the devices partition * description. */ -void add_gd_partition(struct gendisk *hd, int minor, int start, int size); +void add_gd_partition(struct gendisk *hd, int minor, sector_t start, sector_t size); typedef struct {struct page *v;} Sector; -unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *); +unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); static inline void put_dev_sector(Sector p) { diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/efi.c linux-2.4-lbd/fs/partitions/efi.c --- linux-2.4.20-rc1/fs/partitions/efi.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/efi.c Wed Sep 25 10:28:10 2002 @@ -778,7 +778,7 @@ */ int efi_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor) + sector_t first_sector, int first_part_minor) { kdev_t dev = to_kdev_t(bdev->bd_dev); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/efi.h linux-2.4-lbd/fs/partitions/efi.h --- linux-2.4.20-rc1/fs/partitions/efi.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/efi.h Wed Oct 30 09:59:59 2002 @@ -110,6 +110,6 @@ /* Functions */ extern int efi_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); #endif diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/ldm.c linux-2.4-lbd/fs/partitions/ldm.c --- linux-2.4.20-rc1/fs/partitions/ldm.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/ldm.c Wed Sep 25 10:28:10 2002 @@ -1480,7 +1480,7 @@ * Or @bdev is a dynamic disk, but it may be corrupted */ int ldm_partition (struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_minor) + sector_t first_sector, int first_minor) { struct ldmdb *ldb; unsigned long base; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/ldm.h linux-2.4-lbd/fs/partitions/ldm.h --- linux-2.4.20-rc1/fs/partitions/ldm.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/ldm.h Wed Oct 30 09:48:28 2002 @@ -215,7 +215,7 @@ }; int ldm_partition (struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_minor); + sector_t first_sector, int first_minor); #endif /* _FS_PT_LDM_H_ */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/mac.c linux-2.4-lbd/fs/partitions/mac.c --- linux-2.4.20-rc1/fs/partitions/mac.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/mac.c Wed Sep 25 10:28:10 2002 @@ -25,7 +25,7 @@ */ int mac_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long fsec, int first_part_minor) + sector_t fsec, int first_part_minor) { Sector sect; unsigned char *data; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/mac.h linux-2.4-lbd/fs/partitions/mac.h --- linux-2.4.20-rc1/fs/partitions/mac.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/mac.h Wed Sep 25 10:28:10 2002 @@ -49,4 +49,4 @@ /* ... more stuff */ }; -int mac_partition(struct gendisk *hd, struct block_device *bdev, unsigned long fsec, int first_part_minor); +int mac_partition(struct gendisk *hd, struct block_device *bdev, sector_t fsec, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/msdos.c linux-2.4-lbd/fs/partitions/msdos.c --- linux-2.4.20-rc1/fs/partitions/msdos.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/msdos.c Wed Sep 25 10:28:11 2002 @@ -551,7 +551,7 @@ } int msdos_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor) + sector_t first_sector, int first_part_minor) { int i, minor = first_part_minor; Sector sect; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/msdos.h linux-2.4-lbd/fs/partitions/msdos.h --- linux-2.4.20-rc1/fs/partitions/msdos.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/msdos.h Wed Sep 25 10:28:14 2002 @@ -5,5 +5,5 @@ #define MSDOS_LABEL_MAGIC 0xAA55 int msdos_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/osf.c linux-2.4-lbd/fs/partitions/osf.c --- linux-2.4.20-rc1/fs/partitions/osf.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/osf.c Wed Sep 25 10:28:14 2002 @@ -18,7 +18,7 @@ #include "osf.h" int osf_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int current_minor) + sector_t first_sector, int current_minor) { int i; Sector sect; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/osf.h linux-2.4-lbd/fs/partitions/osf.h --- linux-2.4.20-rc1/fs/partitions/osf.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/osf.h Wed Sep 25 10:28:14 2002 @@ -5,5 +5,5 @@ #define DISKLABELMAGIC (0x82564557UL) int osf_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int current_minor); + sector_t first_sector, int current_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/sgi.c linux-2.4-lbd/fs/partitions/sgi.c --- linux-2.4.20-rc1/fs/partitions/sgi.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/sgi.c Wed Sep 25 10:28:14 2002 @@ -17,7 +17,7 @@ #include "check.h" #include "sgi.h" -int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long first_sector, int current_minor) +int sgi_partition(struct gendisk *hd, struct block_device *bdev, sector_t first_sector, int current_minor) { int i, csum, magic; unsigned int *ui, start, blocks, cs; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/sgi.h linux-2.4-lbd/fs/partitions/sgi.h --- linux-2.4.20-rc1/fs/partitions/sgi.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/sgi.h Wed Sep 25 10:28:14 2002 @@ -3,7 +3,7 @@ */ extern int sgi_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); #define SGI_LABEL_MAGIC 0x0be5a941 diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/sun.c linux-2.4-lbd/fs/partitions/sun.c --- linux-2.4.20-rc1/fs/partitions/sun.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/sun.c Fri Oct 11 12:15:16 2002 @@ -24,7 +24,7 @@ extern void md_autodetect_dev(kdev_t dev); #endif -int sun_partition(struct gendisk *hd, struct block_device *bdev, unsigned long first_sector, int first_part_minor) +int sun_partition(struct gendisk *hd, struct block_device *bdev, sector_t first_sector, int first_part_minor) { int i, csum; unsigned short *ush; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/sun.h linux-2.4-lbd/fs/partitions/sun.h --- linux-2.4.20-rc1/fs/partitions/sun.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/sun.h Wed Sep 25 10:28:14 2002 @@ -5,5 +5,5 @@ #define SUN_LABEL_MAGIC 0xDABE int sun_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/ultrix.c linux-2.4-lbd/fs/partitions/ultrix.c --- linux-2.4.20-rc1/fs/partitions/ultrix.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/ultrix.c Wed Sep 25 10:28:14 2002 @@ -15,7 +15,7 @@ #include "check.h" int ultrix_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor) + sector_t first_sector, int first_part_minor) { int i; Sector sect; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/partitions/ultrix.h linux-2.4-lbd/fs/partitions/ultrix.h --- linux-2.4.20-rc1/fs/partitions/ultrix.h Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/partitions/ultrix.h Wed Sep 25 10:28:14 2002 @@ -3,5 +3,5 @@ */ int ultrix_partition(struct gendisk *hd, struct block_device *bdev, - unsigned long first_sector, int first_part_minor); + sector_t first_sector, int first_part_minor); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/qnx4/inode.c linux-2.4-lbd/fs/qnx4/inode.c --- linux-2.4.20-rc1/fs/qnx4/inode.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/qnx4/inode.c Wed Sep 25 10:28:15 2002 @@ -204,7 +204,7 @@ return NULL; } -int qnx4_get_block( struct inode *inode, long iblock, struct buffer_head *bh, int create ) +int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create ) { unsigned long phys; @@ -424,7 +424,7 @@ return cont_prepare_write(page,from,to,qnx4_get_block, &page->mapping->host->u.qnx4_i.mmu_private); } -static int qnx4_bmap(struct address_space *mapping, long block) +static sector_t qnx4_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,qnx4_get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/reiserfs/inode.c linux-2.4-lbd/fs/reiserfs/inode.c --- linux-2.4.20-rc1/fs/reiserfs/inode.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/reiserfs/inode.c Wed Sep 25 10:28:16 2002 @@ -17,7 +17,7 @@ #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ -static int reiserfs_get_block (struct inode * inode, long block, +static int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create); void reiserfs_delete_inode (struct inode * inode) @@ -217,7 +217,7 @@ // Please improve the english/clarity in the comment above, as it is // hard to understand. -static int _get_block_create_0 (struct inode * inode, long block, +static int _get_block_create_0 (struct inode * inode, sector_t block, struct buffer_head * bh_result, int args) { @@ -226,7 +226,7 @@ struct buffer_head * bh; struct item_head * ih, tmp_ih; int fs_gen ; - int blocknr; + sector_t blocknr; char * p = NULL; int chars; int ret ; @@ -379,9 +379,11 @@ // this is called to create file map. So, _get_block_create_0 will not // read direct item -int reiserfs_bmap (struct inode * inode, long block, +int reiserfs_bmap (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) { + if (unlikely(sizeof(sector_t) > 4 && (block >> 32))) + return -EFBIG; if (!file_capable (inode, block)) return -EFBIG; @@ -409,12 +411,12 @@ ** don't want to send create == GET_BLOCK_NO_HOLE to reiserfs_get_block, ** don't use this function. */ -static int reiserfs_get_block_create_0 (struct inode * inode, long block, +static int reiserfs_get_block_create_0 (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) { return reiserfs_get_block(inode, block, bh_result, GET_BLOCK_NO_HOLE) ; } -static int reiserfs_get_block_direct_io (struct inode * inode, long block, +static int reiserfs_get_block_direct_io (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) { int ret ; @@ -514,7 +516,7 @@ return reiserfs_new_unf_blocknrs (th, inode, allocated_block_nr, path, block); } -static int reiserfs_get_block (struct inode * inode, long block, +static int reiserfs_get_block (struct inode * inode, sector_t block, struct buffer_head * bh_result, int create) { int repeat, retval; @@ -544,6 +546,11 @@ th.t_trans_id = 0 ; version = get_inode_item_key_version (inode); + if (unlikely(sizeof(block) > 4 && (block >> 32))) { + unlock_kernel(); + return -EIO; + } + if (block < 0) { unlock_kernel(); return -EIO; @@ -558,12 +565,11 @@ ** log anything, so we don't need to start a transaction */ if (!(create & GET_BLOCK_CREATE)) { - int ret ; /* find number of block-th logical block of the file */ - ret = _get_block_create_0 (inode, block, bh_result, + retval = _get_block_create_0 (inode, block, bh_result, create | GET_BLOCK_READ_DIRECT) ; unlock_kernel() ; - return ret; + return retval; } inode->u.reiserfs_i.i_flags |= i_pack_on_close_mask; @@ -856,8 +862,9 @@ pop_journal_writer(windex) ; unlock_kernel() ; reiserfs_check_path(&path) ; - return retval; -} + + return retval; +} // @@ -2035,8 +2042,8 @@ } -static int reiserfs_aop_bmap(struct address_space *as, long block) { - return generic_block_bmap(as, block, reiserfs_bmap) ; +static sector_t reiserfs_aop_bmap(struct address_space *as, sector_t block) { + return generic_block_bmap(as, block, reiserfs_bmap) ; } static int reiserfs_commit_write(struct file *f, struct page *page, @@ -2120,7 +2127,7 @@ } static int reiserfs_direct_io(int rw, struct inode *inode, - struct kiobuf *iobuf, unsigned long blocknr, + struct kiobuf *iobuf, sector_t blocknr, int blocksize) { return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/reiserfs/journal.c linux-2.4-lbd/fs/reiserfs/journal.c --- linux-2.4.20-rc1/fs/reiserfs/journal.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/reiserfs/journal.c Wed Sep 25 10:28:17 2002 @@ -1010,15 +1010,16 @@ ** is not marked JDirty_wait */ if ((!was_jwait) && !buffer_locked(saved_bh)) { -printk("journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction\n", saved_bh->b_blocknr, +printk("journal-813: BAD! buffer %llu %cdirty %cjwait, not in a newer tranasction\n", + (unsigned long long)saved_bh->b_blocknr, was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ; } /* kupdate_one_transaction waits on the buffers it is writing, so we ** should never see locked buffers here */ if (buffer_locked(saved_bh)) { - printk("clm-2083: locked buffer %lu in flush_journal_list\n", - saved_bh->b_blocknr) ; + printk("clm-2083: locked buffer %llu in flush_journal_list\n", + (unsigned long long)saved_bh->b_blocknr) ; wait_on_buffer(saved_bh) ; if (!buffer_uptodate(saved_bh)) { reiserfs_panic(s, "journal-923: buffer write failed\n") ; @@ -1031,8 +1032,8 @@ submit_logged_buffer(saved_bh) ; count++ ; } else { - printk("clm-2082: Unable to flush buffer %lu in flush_journal_list\n", - saved_bh->b_blocknr) ; + printk("clm-2082: Unable to flush buffer %llu in flush_journal_list\n", + (unsigned long long)saved_bh->b_blocknr) ; } free_cnode: last = cn ; @@ -2171,7 +2172,9 @@ ** could get to disk too early. NOT GOOD. */ if (!prepared || buffer_locked(bh)) { - printk("journal-1777: buffer %lu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", bh->b_blocknr, prepared ? ' ' : '!', + printk("journal-1777: buffer %llu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", + (unsigned long long)bh->b_blocknr, + prepared ? ' ' : '!', buffer_locked(bh) ? ' ' : '!', buffer_dirty(bh) ? ' ' : '!', buffer_journal_dirty(bh) ? ' ' : '!') ; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/reiserfs/prints.c linux-2.4-lbd/fs/reiserfs/prints.c --- linux-2.4.20-rc1/fs/reiserfs/prints.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/reiserfs/prints.c Wed Sep 25 10:28:17 2002 @@ -138,8 +138,8 @@ static void sprintf_buffer_head (char * buf, struct buffer_head * bh) { - sprintf (buf, "dev %s, size %d, blocknr %ld, count %d, list %d, state 0x%lx, page %p, (%s, %s, %s)", - kdevname (bh->b_dev), bh->b_size, bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list, + sprintf (buf, "dev %s, size %d, blocknr %llu, count %d, list %d, state 0x%lx, page %p, (%s, %s, %s)", + kdevname (bh->b_dev), bh->b_size, (unsigned long long)bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list, bh->b_state, bh->b_page, buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE", buffer_dirty (bh) ? "DIRTY" : "CLEAN", @@ -365,7 +365,7 @@ if (tb) { while (tb->insert_size[h]) { bh = PATH_H_PBUFFER (path, h); - printk ("block %lu (level=%d), position %d\n", bh ? bh->b_blocknr : 0, + printk ("block %llu (level=%d), position %d\n", bh ? (unsigned long long)bh->b_blocknr : 0ULL, bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h)); h ++; } @@ -375,8 +375,8 @@ printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n"); while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) { bh = PATH_OFFSET_PBUFFER (path, offset); - printk ("%6d %10p (%9lu, %7d) %8d %7d\n", offset, - bh, bh ? bh->b_blocknr : 0, bh ? atomic_read (&(bh->b_count)) : 0, + printk ("%6d %10p (%9llu, %7d) %8d %7d\n", offset, + bh, (unsigned long long)(bh ? bh->b_blocknr : 0), bh ? atomic_read (&(bh->b_count)) : 0, PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1); offset --; @@ -506,8 +506,8 @@ return 1; } - printk ("%s\'s super block in block %ld\n======================\n", - kdevname (bh->b_dev), bh->b_blocknr); + printk ("%s\'s super block in block %llu\n======================\n", + kdevname (bh->b_dev), (unsigned long long)bh->b_blocknr); printk ("Reiserfs version %s\n", version ); printk ("Block count %u\n", sb_block_count(rs)); printk ("Blocksize %d\n", sb_blocksize(rs)); @@ -545,8 +545,8 @@ if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8)) return 1; - printk ("Desc block %lu (j_trans_id %d, j_mount_id %d, j_len %d)", - bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len); + printk ("Desc block %llu (j_trans_id %d, j_mount_id %d, j_len %d)", + (unsigned long long)bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len); return 0; } @@ -571,7 +571,7 @@ if (print_internal (bh, first, last)) if (print_super_block (bh)) if (print_desc_block (bh)) - printk ("Block %ld contains unformatted data\n", bh->b_blocknr); + printk ("Block %llu contains unformatted data\n", (unsigned long long)bh->b_blocknr); } @@ -606,19 +606,19 @@ tbFh = 0; } sprintf (print_tb_buf + strlen (print_tb_buf), - "* %d * %3ld(%2d) * %3ld(%2d) * %3ld(%2d) * %5ld * %5ld * %5ld * %5ld * %5ld *\n", + "* %d * %3llu(%2d) * %3llu(%2d) * %3llu(%2d) * %5llu * %5llu * %5llu * %5llu * %5llu *\n", h, - (tbSh) ? (tbSh->b_blocknr):(-1), + (unsigned long long)((tbSh) ? (tbSh->b_blocknr):(-1)), (tbSh) ? atomic_read (&(tbSh->b_count)) : -1, - (tb->L[h]) ? (tb->L[h]->b_blocknr):(-1), + (unsigned long long)((tb->L[h]) ? (tb->L[h]->b_blocknr):(-1)), (tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1, - (tb->R[h]) ? (tb->R[h]->b_blocknr):(-1), + (unsigned long long)((tb->R[h]) ? (tb->R[h]->b_blocknr):(-1)), (tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -1, - (tbFh) ? (tbFh->b_blocknr):(-1), - (tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1), - (tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1), - (tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1), - (tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1)); + (unsigned long long)((tbFh) ? (tbFh->b_blocknr):(-1)), + (unsigned long long)((tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1)), + (unsigned long long)((tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1)), + (unsigned long long)((tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1)), + (unsigned long long)((tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1))); } sprintf (print_tb_buf + strlen (print_tb_buf), @@ -645,7 +645,7 @@ h = 0; for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++) sprintf (print_tb_buf + strlen (print_tb_buf), - "%p (%lu %d)%s", tb->FEB[i], tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0, + "%p (%llu %d)%s", tb->FEB[i], (unsigned long long)(tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0), tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0, (i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", "); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/reiserfs/super.c linux-2.4-lbd/fs/reiserfs/super.c --- linux-2.4.20-rc1/fs/reiserfs/super.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/reiserfs/super.c Wed Sep 25 10:28:18 2002 @@ -848,8 +848,8 @@ rs = (struct reiserfs_super_block *)bh->b_data; if (!is_reiserfs_magic_string (rs)) { printk ("read_super_block: " - "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", - kdevname(s->s_dev), bh->b_blocknr, size); + "can't find a reiserfs filesystem on (dev %s, block %llu, size %d)\n", + kdevname(s->s_dev), (unsigned long long)bh->b_blocknr, size); brelse (bh); return 1; } @@ -879,8 +879,8 @@ if (!is_reiserfs_magic_string (rs) || sb_blocksize(rs) != s->s_blocksize) { printk ("read_super_block: " - "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", - kdevname(s->s_dev), bh->b_blocknr, size); + "can't find a reiserfs filesystem on (dev %s, block %llu, size %d)\n", + kdevname(s->s_dev), (unsigned long long)bh->b_blocknr, size); brelse (bh); printk ("read_super_block: can't find a reiserfs filesystem on dev %s.\n", kdevname(s->s_dev)); return 1; @@ -894,8 +894,8 @@ bh->b_blocknr < (sb_journal_block(rs) + JOURNAL_BLOCK_COUNT)) { brelse(bh) ; printk("super-459: read_super_block: " - "super found at block %lu is within its own log. " - "It must not be of this format type.\n", bh->b_blocknr) ; + "super found at block %llu is within its own log. " + "It must not be of this format type.\n", (unsigned long long)bh->b_blocknr) ; return 1 ; } @@ -936,7 +936,7 @@ wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ; if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) { printk("reread_meta_blocks, error reading bitmap block number %d at - %ld\n", i, SB_AP_BITMAP(s)[i].bh->b_blocknr) ; + %llu\n", i, (unsigned long long)SB_AP_BITMAP(s)[i].bh->b_blocknr) ; return 1 ; } } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/sysv/itree.c linux-2.4-lbd/fs/sysv/itree.c --- linux-2.4.20-rc1/fs/sysv/itree.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/sysv/itree.c Wed Sep 25 10:28:18 2002 @@ -191,7 +191,7 @@ return -EAGAIN; } -static int get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) +static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { int err = -EIO; int offsets[DEPTH]; @@ -425,7 +425,7 @@ { return block_prepare_write(page,from,to,get_block); } -static int sysv_bmap(struct address_space *mapping, long block) +static sector_t sysv_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,get_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/udf/inode.c linux-2.4-lbd/fs/udf/inode.c --- linux-2.4.20-rc1/fs/udf/inode.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/udf/inode.c Wed Sep 25 10:28:18 2002 @@ -61,7 +61,7 @@ static void udf_update_extents(struct inode *, long_ad [EXTENT_MERGE_SIZE], int, int, lb_addr, uint32_t, struct buffer_head **); -static int udf_get_block(struct inode *, long, struct buffer_head *, int); +static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); /* * udf_put_inode @@ -146,7 +146,7 @@ return block_prepare_write(page, from, to, udf_get_block); } -static int udf_bmap(struct address_space *mapping, long block) +static sector_t udf_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,udf_get_block); } @@ -311,7 +311,7 @@ return dbh; } -static int udf_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create) +static int udf_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create) { int err, new; struct buffer_head *bh; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/fs/ufs/inode.c linux-2.4-lbd/fs/ufs/inode.c --- linux-2.4.20-rc1/fs/ufs/inode.c Fri Dec 13 10:46:08 2002 +++ linux-2.4-lbd/fs/ufs/inode.c Wed Sep 25 10:28:18 2002 @@ -308,7 +308,7 @@ return result; } -static int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create) +static int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create) { struct super_block * sb; struct ufs_sb_private_info * uspi; @@ -463,7 +463,7 @@ { return block_prepare_write(page,from,to,ufs_getfrag_block); } -static int ufs_bmap(struct address_space *mapping, long block) +static sector_t ufs_bmap(struct address_space *mapping, sector_t block) { return generic_block_bmap(mapping,block,ufs_getfrag_block); } diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/asm-i386/types.h linux-2.4-lbd/include/asm-i386/types.h --- linux-2.4.20-rc1/include/asm-i386/types.h Fri Dec 13 10:46:11 2002 +++ linux-2.4-lbd/include/asm-i386/types.h Thu Oct 24 14:56:54 2002 @@ -52,6 +52,10 @@ #endif typedef u64 dma64_addr_t; +#ifdef CONFIG_LBD +typedef u64 sector_t; +#define HAVE_ARCH_SECTOR_T +#endif #endif /* __KERNEL__ */ #endif diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/asm-ppc/types.h linux-2.4-lbd/include/asm-ppc/types.h --- linux-2.4.20-rc1/include/asm-ppc/types.h Fri Dec 13 10:46:16 2002 +++ linux-2.4-lbd/include/asm-ppc/types.h Wed Sep 25 10:30:00 2002 @@ -48,6 +48,12 @@ typedef u32 dma_addr_t; typedef u64 dma64_addr_t; +#ifdef CONFIG_LBD +typedef u64 sector_t; +#define HAVE_ARCH_SECTOR_T +#endif + + #endif /* __KERNEL__ */ /* diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/blkdev.h linux-2.4-lbd/include/linux/blkdev.h --- linux-2.4.20-rc1/include/linux/blkdev.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/blkdev.h Wed Oct 30 09:59:06 2002 @@ -34,9 +34,10 @@ int cmd; /* READ or WRITE */ int errors; unsigned long start_time; - unsigned long sector; + sector_t sector; unsigned long nr_sectors; - unsigned long hard_sector, hard_nr_sectors; + sector_t hard_sector; + unsigned long hard_nr_sectors; unsigned int nr_segments; unsigned int nr_hw_segments; unsigned long current_nr_sectors, hard_cur_sectors; @@ -196,8 +197,8 @@ extern struct sec_size * blk_sec[MAX_BLKDEV]; extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; -extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size); -extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, long size); +extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, sector_t size); +extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, sector_t size); extern void generic_make_request(int rw, struct buffer_head * bh); extern inline request_queue_t *blk_get_queue(kdev_t dev); extern void blkdev_release_request(struct request *); @@ -213,7 +214,7 @@ extern void generic_unplug_device(void *); extern inline int blk_seg_merge_ok(struct buffer_head *, struct buffer_head *); -extern int * blk_size[MAX_BLKDEV]; +extern sector_t * blk_size[MAX_BLKDEV]; extern int * blksize_size[MAX_BLKDEV]; @@ -277,5 +278,19 @@ } return retval; } + +#ifdef CONFIG_LBD +# include +# define sector_div(a, b) do_div(a, b) +#else +# define sector_div(n, b)( \ +{ \ + int _res; \ + _res = (n) % (b); \ + (n) /= (b); \ + _res; \ +} \ +) +#endif #endif diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/fs.h linux-2.4-lbd/include/linux/fs.h --- linux-2.4.20-rc1/include/linux/fs.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/fs.h Wed Oct 30 09:47:24 2002 @@ -242,7 +242,7 @@ struct buffer_head { /* First cache line: */ struct buffer_head *b_next; /* Hash queue list */ - unsigned long b_blocknr; /* block number */ + sector_t b_blocknr; /* block number */ unsigned short b_size; /* block size */ unsigned short b_list; /* List that this buffer appears */ kdev_t b_dev; /* device (B_FREE = free) */ @@ -391,11 +391,11 @@ int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); int (*commit_write)(struct file *, struct page *, unsigned, unsigned); /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ - int (*bmap)(struct address_space *, long); + sector_t (*bmap)(struct address_space *, sector_t); int (*flushpage) (struct page *, unsigned long); int (*releasepage) (struct page *, int); #define KERNEL_HAS_O_DIRECT /* this is for modules out of the kernel */ - int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int); + int (*direct_IO)(int, struct inode *, struct kiobuf *, sector_t, int); }; struct address_space { @@ -452,7 +452,7 @@ time_t i_ctime; unsigned int i_blkbits; unsigned long i_blksize; - unsigned long i_blocks; + sector_t i_blocks; unsigned long i_version; struct semaphore i_sem; struct semaphore i_zombie; @@ -1241,7 +1241,7 @@ extern int filemap_fdatasync(struct address_space *); extern int filemap_fdatawait(struct address_space *); extern void sync_supers(kdev_t); -extern int bmap(struct inode *, int); +extern sector_t bmap(struct inode *, sector_t); extern int notify_change(struct dentry *, struct iattr *); extern int permission(struct inode *, int); extern int vfs_permission(struct inode *, int); @@ -1373,8 +1373,8 @@ extern void remove_inode_hash(struct inode *); extern struct file * get_empty_filp(void); extern void file_move(struct file *f, struct list_head *list); -extern struct buffer_head * get_hash_table(kdev_t, int, int); -extern struct buffer_head * getblk(kdev_t, int, int); +extern struct buffer_head * get_hash_table(kdev_t, sector_t, int); +extern struct buffer_head * getblk(kdev_t, sector_t, int); extern void ll_rw_block(int, int, struct buffer_head * bh[]); extern void submit_bh(int, struct buffer_head *); extern int is_read_only(kdev_t); @@ -1393,16 +1393,16 @@ extern int set_blocksize(kdev_t, int); extern int sb_set_blocksize(struct super_block *, int); extern int sb_min_blocksize(struct super_block *, int); -extern struct buffer_head * bread(kdev_t, int, int); -static inline struct buffer_head * sb_bread(struct super_block *sb, int block) +extern struct buffer_head * bread(kdev_t, sector_t, int); +static inline struct buffer_head * sb_bread(struct super_block *sb, sector_t block) { return bread(sb->s_dev, block, sb->s_blocksize); } -static inline struct buffer_head * sb_getblk(struct super_block *sb, int block) +static inline struct buffer_head * sb_getblk(struct super_block *sb, sector_t block) { return getblk(sb->s_dev, block, sb->s_blocksize); } -static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, int block) +static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, sector_t block) { return get_hash_table(sb->s_dev, block, sb->s_blocksize); } @@ -1410,9 +1410,9 @@ extern void put_unused_buffer_head(struct buffer_head * bh); extern struct buffer_head * get_unused_buffer_head(int async); -extern int brw_page(int, struct page *, kdev_t, int [], int); +extern int brw_page(int, struct page *, kdev_t, sector_t [], int); -typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int); +typedef int (get_block_t)(struct inode*,sector_t,struct buffer_head*,int); /* Generic buffer handling for block filesystems.. */ extern int try_to_release_page(struct page * page, int gfp_mask); @@ -1429,10 +1429,10 @@ extern int block_commit_write(struct page *page, unsigned from, unsigned to); extern int block_sync_page(struct page *); -int generic_block_bmap(struct address_space *, long, get_block_t *); +sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); int generic_commit_write(struct file *, struct page *, unsigned, unsigned); int block_truncate_page(struct address_space *, loff_t, get_block_t *); -extern int generic_direct_IO(int, struct inode *, struct kiobuf *, unsigned long, int, get_block_t *); +extern int generic_direct_IO(int, struct inode *, struct kiobuf *, sector_t, int, get_block_t *); extern int waitfor_one_page(struct page *); extern int writeout_one_page(struct page *); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/genhd.h linux-2.4-lbd/include/linux/genhd.h --- linux-2.4.20-rc1/include/linux/genhd.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/genhd.h Wed Oct 30 09:47:24 2002 @@ -59,8 +59,8 @@ # include struct hd_struct { - unsigned long start_sect; - unsigned long nr_sects; + sector_t start_sect; + sector_t nr_sects; devfs_handle_t de; /* primary (master) devfs entry */ #ifdef CONFIG_DEVFS_FS int number; @@ -94,7 +94,7 @@ int max_p; /* maximum partitions per device */ struct hd_struct *part; /* [indexed by minor] */ - int *sizes; /* [idem], device size in blocks */ + sector_t *sizes; /* [idem], device size in blocks */ int nr_real; /* number of real devices */ void *real_devices; /* internal use */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/ide.h linux-2.4-lbd/include/linux/ide.h --- linux-2.4.20-rc1/include/linux/ide.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/ide.h Wed Oct 30 09:59:31 2002 @@ -689,7 +689,7 @@ typedef int (ide_cleanup_proc)(ide_drive_t *); typedef int (ide_standby_proc)(ide_drive_t *); typedef int (ide_flushcache_proc)(ide_drive_t *); -typedef ide_startstop_t (ide_do_request_proc)(ide_drive_t *, struct request *, unsigned long); +typedef ide_startstop_t (ide_do_request_proc)(ide_drive_t *, struct request *, sector_t); typedef void (ide_end_request_proc)(byte, ide_hwgroup_t *); typedef int (ide_ioctl_proc)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); typedef int (ide_open_proc)(struct inode *, struct file *, ide_drive_t *); @@ -697,7 +697,7 @@ typedef int (ide_check_media_change_proc)(ide_drive_t *); typedef void (ide_revalidate_proc)(ide_drive_t *); typedef void (ide_pre_reset_proc)(ide_drive_t *); -typedef unsigned long (ide_capacity_proc)(ide_drive_t *); +typedef sector_t (ide_capacity_proc)(ide_drive_t *); typedef ide_startstop_t (ide_special_proc)(ide_drive_t *); typedef void (ide_setting_proc)(ide_drive_t *); typedef int (ide_reinit_proc)(ide_drive_t *); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/iobuf.h linux-2.4-lbd/include/linux/iobuf.h --- linux-2.4.20-rc1/include/linux/iobuf.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/iobuf.h Wed Oct 30 09:59:06 2002 @@ -41,7 +41,7 @@ struct page ** maplist; struct buffer_head ** bh; - unsigned long * blocks; + sector_t * blocks; /* Dynamic state for IO completion: */ atomic_t io_count; /* IOs still in progress */ @@ -73,6 +73,6 @@ /* fs/buffer.c */ int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], - kdev_t dev, unsigned long b[], int size); + kdev_t dev, sector_t b[], int size); #endif /* __LINUX_IOBUF_H */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/iso_fs.h linux-2.4-lbd/include/linux/iso_fs.h --- linux-2.4.20-rc1/include/linux/iso_fs.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/iso_fs.h Thu Oct 24 14:57:49 2002 @@ -219,7 +219,7 @@ int get_acorn_filename(struct iso_directory_record *, char *, struct inode *); extern struct dentry *isofs_lookup(struct inode *, struct dentry *); -extern struct buffer_head *isofs_bread(struct inode *inode, unsigned int block); +extern struct buffer_head *isofs_bread(struct inode *inode, sector_t block); extern int isofs_get_blocks(struct inode *, long, struct buffer_head **, unsigned long); extern struct inode_operations isofs_dir_inode_operations; @@ -234,7 +234,7 @@ #define brelse leak_check_brelse extern void * leak_check_malloc(unsigned int size); extern void leak_check_free_s(void * obj, int size); -extern struct buffer_head * leak_check_bread(struct super_block *sb, int block); +extern struct buffer_head * leak_check_bread(struct super_block *sb, sector_t block); extern void leak_check_brelse(struct buffer_head * bh); #endif /* LEAK_CHECK */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/loop.h linux-2.4-lbd/include/linux/loop.h --- linux-2.4.20-rc1/include/linux/loop.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/loop.h Wed Sep 25 10:30:45 2002 @@ -34,7 +34,7 @@ int lo_flags; int (*transfer)(struct loop_device *, int cmd, char *raw_buf, char *loop_buf, int size, - int real_block); + sector_t real_block); char lo_name[LO_NAME_SIZE]; char lo_encrypt_key[LO_KEY_SIZE]; __u32 lo_init[2]; @@ -129,7 +129,7 @@ struct loop_func_table { int number; /* filter type */ int (*transfer)(struct loop_device *lo, int cmd, char *raw_buf, - char *loop_buf, int size, int real_block); + char *loop_buf, int size, sector_t real_block); int (*init)(struct loop_device *, struct loop_info *); /* release is called from loop_unregister_transfer or clr_fd */ int (*release)(struct loop_device *); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/msdos_fs.h linux-2.4-lbd/include/linux/msdos_fs.h --- linux-2.4.20-rc1/include/linux/msdos_fs.h Fri Dec 13 10:46:19 2002 +++ linux-2.4-lbd/include/linux/msdos_fs.h Wed Oct 30 09:50:07 2002 @@ -273,7 +273,7 @@ extern struct inode_operations fat_file_inode_operations; extern ssize_t fat_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos); -extern int fat_get_block(struct inode *inode, long iblock, +extern int fat_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); extern ssize_t fat_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/qnx4_fs.h linux-2.4-lbd/include/linux/qnx4_fs.h --- linux-2.4.20-rc1/include/linux/qnx4_fs.h Fri Dec 13 10:46:23 2002 +++ linux-2.4-lbd/include/linux/qnx4_fs.h Wed Sep 25 10:30:47 2002 @@ -118,7 +118,7 @@ extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry); extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int); extern int qnx4_sync_inode(struct inode *inode); -extern int qnx4_get_block(struct inode *inode, long iblock, struct buffer_head *bh, int create); +extern int qnx4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create); #endif /* __KERNEL__ */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/raid/linear.h linux-2.4-lbd/include/linux/raid/linear.h --- linux-2.4.20-rc1/include/linux/raid/linear.h Fri Dec 13 10:46:24 2002 +++ linux-2.4-lbd/include/linux/raid/linear.h Wed Oct 30 10:01:51 2002 @@ -5,8 +5,8 @@ struct dev_info { kdev_t dev; - unsigned long size; - unsigned long offset; + sector_t size; + sector_t offset; }; typedef struct dev_info dev_info_t; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/raid/md.h linux-2.4-lbd/include/linux/raid/md.h --- linux-2.4.20-rc1/include/linux/raid/md.h Fri Dec 13 10:46:24 2002 +++ linux-2.4-lbd/include/linux/raid/md.h Wed Oct 30 09:59:59 2002 @@ -59,7 +59,7 @@ #define MD_MINOR_VERSION 90 #define MD_PATCHLEVEL_VERSION 0 -extern int md_size[MAX_MD_DEVS]; +extern sector_t md_size[MAX_MD_DEVS]; extern struct hd_struct md_hd_struct[MAX_MD_DEVS]; extern void add_mddev_mapping (mddev_t *mddev, kdev_t dev, void *data); diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/raid/md_k.h linux-2.4-lbd/include/linux/raid/md_k.h --- linux-2.4.20-rc1/include/linux/raid/md_k.h Fri Dec 13 10:46:24 2002 +++ linux-2.4-lbd/include/linux/raid/md_k.h Wed Sep 25 10:30:52 2002 @@ -164,14 +164,14 @@ kdev_t dev; /* Device number */ kdev_t old_dev; /* "" when it was last imported */ - unsigned long size; /* Device size (in blocks) */ + sector_t size; /* Device size (in blocks) */ mddev_t *mddev; /* RAID array if running */ unsigned long last_events; /* IO event timestamp */ struct block_device *bdev; /* block device handle */ mdp_super_t *sb; - unsigned long sb_offset; + sector_t sb_offset; int alias_device; /* device alias to the same disk */ int faulty; /* if faulty do not issue IO requests */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/include/linux/types.h linux-2.4-lbd/include/linux/types.h --- linux-2.4.20-rc1/include/linux/types.h Fri Dec 13 10:46:23 2002 +++ linux-2.4-lbd/include/linux/types.h Thu Oct 24 14:56:54 2002 @@ -127,4 +127,8 @@ char f_fpack[6]; }; +#ifndef HAVE_ARCH_SECTOR_T +typedef unsigned long sector_t; +#endif + #endif /* _LINUX_TYPES_H */ diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/lbd linux-2.4-lbd/lbd --- linux-2.4.20-rc1/lbd Thu Jan 1 10:00:00 1970 +++ linux-2.4-lbd/lbd Thu Oct 31 09:20:26 2002 @@ -0,0 +1,4384 @@ +# This is a BitKeeper generated patch for the following project: +# Project Name: Linux kernel tree +# This patch format is intended for GNU patch command version 2.5 or higher. +# This patch includes the following deltas: +# ChangeSet v2.4.20-rc1 -> 1.775 +# drivers/block/ps2esdi.c 1.19 -> 1.20 +# drivers/scsi/megaraid.c 1.19 -> 1.20 +# drivers/ide/ide-probe.c 1.12 -> 1.13 +# drivers/block/cciss.h 1.7 -> 1.8 +# drivers/md/raid1.c 1.15 -> 1.16 +# drivers/ide/ide-disk.c 1.11 -> 1.14 +# drivers/scsi/ips.c 1.16 -> 1.17 +# fs/partitions/atari.h 1.2 -> 1.3 +# fs/reiserfs/file.c 1.11 -> 1.12 +# drivers/scsi/ide-scsi.c 1.6 -> 1.7 +# drivers/scsi/ppa.c 1.6 -> 1.7 +# include/asm-i386/types.h 1.3 -> 1.4 +# drivers/mtd/devices/blkmtd.c 1.4 -> 1.5 +# fs/reiserfs/journal.c 1.24 -> 1.25 +# include/linux/raid/md_k.h 1.9 -> 1.10 +# drivers/scsi/aha152x.c 1.13 -> 1.14 +# drivers/md/lvm.c 1.17 -> 1.18 +# drivers/block/blkpg.c 1.9 -> 1.11 +# fs/partitions/msdos.c 1.10 -> 1.11 +# fs/partitions/acorn.c 1.3 -> 1.4 +# drivers/char/raw.c 1.7 -> 1.8 +# include/linux/raid/md.h 1.4 -> 1.5 +# fs/ext2/inode.c 1.15 -> 1.16 +# fs/jbd/revoke.c 1.4 -> 1.5 +# drivers/block/ll_rw_blk.c 1.39.1.1 -> 1.41 +# drivers/scsi/ibmmca.c 1.4 -> 1.5 +# fs/partitions/ultrix.c 1.2 -> 1.3 +# mm/page_io.c 1.9 -> 1.10 +# drivers/ieee1394/sbp2.c 1.10.1.2 -> 1.13 +# drivers/block/cpqarray.c 1.25 -> 1.26 +# include/linux/genhd.h 1.12 -> 1.13 +# drivers/block/floppy.c 1.12 -> 1.13 +# fs/bfs/file.c 1.2 -> 1.3 +# fs/jbd/journal.c 1.7.1.1 -> 1.9 +# drivers/ide/ide-tape.c 1.10 -> 1.11 +# fs/partitions/osf.h 1.2 -> 1.3 +# drivers/scsi/in2000.c 1.4 -> 1.5 +# fs/partitions/sgi.c 1.2 -> 1.3 +# include/linux/ide.h 1.6 -> 1.7 +# fs/ufs/inode.c 1.5 -> 1.6 +# fs/partitions/mac.c 1.3 -> 1.4 +# drivers/scsi/sd.c 1.22 -> 1.25 +# fs/partitions/osf.c 1.3 -> 1.4 +# include/linux/blkdev.h 1.22 -> 1.24 +# drivers/block/nbd.c 1.13 -> 1.14 +# fs/freevxfs/vxfs_kcompat.h 1.2 -> 1.3 +# drivers/ide/ide-floppy.c 1.11 -> 1.12 +# drivers/scsi/sr.c 1.14 -> 1.17 +# include/linux/msdos_fs.h 1.4 -> 1.5 +# include/linux/fs.h 1.66.1.3 -> 1.69 +# drivers/block/Config.in 1.8 -> 1.10 +# drivers/scsi/ini9100u.c 1.4 -> 1.5 +# fs/fat/file.c 1.3 -> 1.5 +# include/linux/iobuf.h 1.3 -> 1.4 +# drivers/block/xd.c 1.13 -> 1.14 +# fs/sysv/itree.c 1.2 -> 1.3 +# fs/partitions/sgi.h 1.2 -> 1.3 +# drivers/md/md.c 1.33 -> 1.36 +# drivers/scsi/advansys.c 1.8 -> 1.9 +# fs/freevxfs/vxfs_subr.c 1.5 -> 1.6 +# drivers/scsi/inia100.c 1.4 -> 1.5 +# fs/partitions/ldm.h 1.6 -> 1.7 +# fs/fat/misc.c 1.3 -> 1.5 +# fs/adfs/inode.c 1.4 -> 1.5 +# fs/jfs/inode.c 1.6.1.1 -> 1.8 +# fs/qnx4/inode.c 1.9 -> 1.10 +# fs/reiserfs/inode.c 1.35.1.4 -> 1.38 +# include/linux/types.h 1.2 -> 1.4 +# fs/hfs/file.c 1.4 -> 1.5 +# fs/jbd/commit.c 1.4.1.1 -> 1.6 +# fs/partitions/atari.c 1.2 -> 1.3 +# include/asm-ppc/types.h 1.4 -> 1.5 +# fs/partitions/sun.c 1.2.1.1 -> 1.4 +# fs/partitions/check.c 1.16 -> 1.19 +# fs/partitions/ldm.c 1.6 -> 1.7 +# fs/partitions/check.h 1.2 -> 1.3 +# drivers/mtd/mtdblock.c 1.8 -> 1.9 +# drivers/scsi/3w-xxxx.c 1.13.1.2 -> 1.16 +# drivers/scsi/atp870u.c 1.8 -> 1.9 +# fs/efs/inode.c 1.3 -> 1.4 +# include/asm-ia64/sal.h 1.6.1.1 -> 1.8 +# drivers/scsi/aic7xxx_old.c 1.14 -> 1.15 +# include/linux/raid/linear.h 1.1 -> 1.2 +# drivers/md/linear.c 1.3 -> 1.6 +# fs/partitions/efi.h 1.1.1.1 -> 1.3 +# fs/partitions/sun.h 1.2 -> 1.3 +# fs/hfs/hfs.h 1.2 -> 1.3 +# drivers/ide/ide-cd.c 1.16.1.1 -> 1.19 +# fs/partitions/ultrix.h 1.2 -> 1.3 +# fs/hpfs/file.c 1.2 -> 1.3 +# fs/fat/inode.c 1.13 -> 1.14 +# fs/reiserfs/super.c 1.25.1.1 -> 1.27 +# drivers/ide/ataraid.c 1.4 -> 1.5 +# drivers/md/multipath.c 1.4 -> 1.7 +# arch/ia64/kernel/efivars.c 1.5.1.1 -> 1.7 +# drivers/block/genhd.c 1.22.1.2 -> 1.25 +# arch/ia64/kernel/mca.c 1.6.1.1 -> 1.8 +# fs/affs/file.c 1.8 -> 1.9 +# fs/partitions/amiga.c 1.2 -> 1.3 +# fs/hfs/inode.c 1.4 -> 1.5 +# drivers/scsi/qlogicfas.c 1.7 -> 1.8 +# include/linux/loop.h 1.5 -> 1.6 +# include/linux/qnx4_fs.h 1.1 -> 1.2 +# fs/ext3/ialloc.c 1.3.1.1 -> 1.5 +# drivers/scsi/scsi_lib.c 1.15 -> 1.16 +# fs/partitions/efi.c 1.2 -> 1.3 +# fs/block_dev.c 1.31 -> 1.32 +# drivers/scsi/scsi.c 1.17 -> 1.18 +# fs/befs/linuxvfs.c 1.1 -> 1.2 +# fs/udf/inode.c 1.8 -> 1.9 +# fs/minix/inode.c 1.8 -> 1.9 +# drivers/md/raid0.c 1.3 -> 1.6 +# fs/buffer.c 1.71.1.3 -> 1.76 +# drivers/block/loop.c 1.24 -> 1.26 +# fs/efs/file.c 1.1 -> 1.2 +# drivers/scsi/sd.h 1.2 -> 1.3 +# fs/hpfs/hpfs_fn.h 1.3 -> 1.4 +# fs/partitions/msdos.h 1.2 -> 1.3 +# drivers/block/rd.c 1.29.1.1 -> 1.31 +# fs/reiserfs/prints.c 1.12 -> 1.13 +# include/linux/iso_fs.h 1.4 -> 1.5 +# fs/partitions/acorn.h 1.2 -> 1.3 +# fs/minix/itree_common.c 1.5 -> 1.6 +# drivers/block/cpqarray.h 1.5 -> 1.6 +# fs/ext3/inode.c 1.7.1.3 -> 1.11 +# drivers/block/umem.c 1.5 -> 1.6 +# fs/affs/super.c 1.9 -> 1.10 +# fs/partitions/amiga.h 1.2 -> 1.3 +# fs/jfs/jfs_metapage.c 1.6.1.1 -> 1.8 +# drivers/message/i2o/i2o_block.c 1.17 -> 1.18 +# drivers/md/lvm-snap.c 1.11 -> 1.12 +# fs/partitions/mac.h 1.3 -> 1.4 +# drivers/block/DAC960.c 1.17 -> 1.18 +# drivers/block/DAC960.h 1.5 -> 1.6 +# Documentation/Configure.help 1.123.1.18 -> 1.129 +# fs/adfs/adfs.h 1.1 -> 1.2 +# fs/isofs/inode.c 1.9 -> 1.10 +# drivers/block/cciss.c 1.26 -> 1.28 +# drivers/ide/ide.c 1.22.1.1 -> 1.25 +# drivers/scsi/wd7000.c 1.4 -> 1.5 +# fs/inode.c 1.35 -> 1.36 +# drivers/scsi/imm.c 1.5 -> 1.6 +# drivers/scsi/qla1280.c 1.6 -> 1.7 +# +# The following is the BitKeeper ChangeSet Log +# -------------------------------------------- +# 02/10/29 okir@suse.de 1.771 +# [PATCH] Fix NFS IRIX compatibility braindamage +# +# -------------------------------------------- +# 02/10/30 peterc@gelato.unsw.edu.au 1.772 +# Merge gelato.unsw.edu.au:/usr/src/linux-2.4 +# into gelato.unsw.edu.au:/usr/src/linux-2.4-lbd +# -------------------------------------------- +# 02/10/30 peterc@gelato.unsw.edu.au 1.773 +# BLKGETSIZED and BLKGETSIZE64 changes --- use the generic version, and return -EFBIG if the +# result won't fit. +# -------------------------------------------- +# 02/10/30 peterc@gelato.unsw.edu.au 1.774 +# IDE fixes for large block device, when calculating and storing disc +# capacities. +# -------------------------------------------- +# 02/10/30 peterc@gelato.unsw.edu.au 1.775 +# FIx size calculation and reporting, for large block devices. +# -------------------------------------------- +# +diff -Nru a/Documentation/Configure.help b/Documentation/Configure.help +--- a/Documentation/Configure.help Thu Oct 31 09:20:25 2002 ++++ b/Documentation/Configure.help Thu Oct 31 09:20:25 2002 +@@ -564,6 +564,11 @@ + + If unsure, say N. + ++Large disc support ++CONFIG_LBD ++ If you have mass-storage devices bigger than 2TB and want to access them, ++ say Y here, and your kernel will use 64-bit sector offsets throughout. ++ + ATA/IDE/MFM/RLL support + CONFIG_IDE + If you say Y here, your kernel will be able to manage low cost mass +diff -Nru a/drivers/block/Config.in b/drivers/block/Config.in +--- a/drivers/block/Config.in Thu Oct 31 09:20:22 2002 ++++ b/drivers/block/Config.in Thu Oct 31 09:20:22 2002 +@@ -50,4 +50,7 @@ + + bool 'Per partition statistics in /proc/partitions' CONFIG_BLK_STATS + ++if [ "$CONFIG_X86" = "y" -o "$CONFIG_PPC" = "y" ]; then ++ bool 'Support for discs bigger than 2TB?' CONFIG_LBD ++fi + endmenu +diff -Nru a/drivers/block/DAC960.c b/drivers/block/DAC960.c +--- a/drivers/block/DAC960.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/DAC960.c Thu Oct 31 09:20:25 2002 +@@ -5479,12 +5479,17 @@ + Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)].start_sect; + return (copy_to_user(UserGeometry, &Geometry, + sizeof(DiskGeometry_T)) ? -EFAULT : 0); +- case BLKGETSIZE: ++ case BLKGETSIZE: { + /* Get Device Size. */ +- if ((unsigned long *) Argument == NULL) return -EINVAL; +- return put_user(Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] +- .nr_sects, +- (unsigned long *) Argument); ++ unsigned long sz; ++ if ((unsigned long *) Argument == NULL) return -EINVAL; ++ sz = Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] ++ .nr_sects; ++ if ((sector_t)sz != Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)] ++ .nr_sects) ++ return -EFBIG; ++ return put_user(sz, (unsigned long *) Argument); ++ } + case BLKGETSIZE64: + if ((u64 *) Argument == NULL) return -EINVAL; + return put_user((u64) Controller->GenericDiskInfo +diff -Nru a/drivers/block/DAC960.h b/drivers/block/DAC960.h +--- a/drivers/block/DAC960.h Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/DAC960.h Thu Oct 31 09:20:25 2002 +@@ -2473,7 +2473,7 @@ + } V2; + } FW; + DiskPartition_T DiskPartitions[DAC960_MinorCount]; +- int PartitionSizes[DAC960_MinorCount]; ++ sector_t PartitionSizes[DAC960_MinorCount]; + int BlockSizes[DAC960_MinorCount]; + int MaxSectorsPerRequest[DAC960_MinorCount]; + unsigned char ProgressBuffer[DAC960_ProgressBufferSize]; +diff -Nru a/drivers/block/blkpg.c b/drivers/block/blkpg.c +--- a/drivers/block/blkpg.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/blkpg.c Thu Oct 31 09:20:21 2002 +@@ -65,8 +65,9 @@ + */ + int add_partition(kdev_t dev, struct blkpg_partition *p) { + struct gendisk *g; +- long long ppstart, pplength; +- long pstart, plength; ++ long long ppstart; ++ long long pplength; ++ sector_t pstart, plength; + int i, drive, first_minor, end_minor, minor; + + /* convert bytes to sectors, check for fit in a hd_struct */ +@@ -246,10 +247,12 @@ + if (g) + ullval = g->part[MINOR(dev)].nr_sects; + +- if (cmd == BLKGETSIZE) ++ if (cmd == BLKGETSIZE) { ++ if ((unsigned long)ullval != ullval) ++ return -EFBIG; + return put_user((unsigned long)ullval, (unsigned long *)arg); +- else +- return put_user(ullval << 9, (u64 *)arg); ++ } ++ return put_user(ullval << 9, (u64 *)arg); + #if 0 + case BLKRRPART: /* Re-read partition tables */ + if (!capable(CAP_SYS_ADMIN)) +diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c +--- a/drivers/block/cciss.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/cciss.c Thu Oct 31 09:20:25 2002 +@@ -430,7 +430,7 @@ + driver_geo.heads = 0xff; + driver_geo.sectors = 0x3f; + driver_geo.cylinders = +- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); ++ (int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); + } + driver_geo.start= + hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect; +@@ -450,7 +450,7 @@ + driver_geo.heads = 0xff; + driver_geo.sectors = 0x3f; + driver_geo.cylinders = +- hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); ++ (int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f); + } + driver_geo.start= + hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect; +@@ -459,16 +459,12 @@ + return -EFAULT; + return(0); + } +- case BLKGETSIZE: +- put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, (unsigned long *)arg); +- return 0; +- case BLKGETSIZE64: +- put_user((u64)hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects << 9, (u64*)arg); +- return 0; + case BLKRRPART: + if(!capable(CAP_SYS_ADMIN)) + return -EPERM; + return revalidate_logvol(inode->i_rdev, 1); ++ case BLKGETSIZE64: ++ case BLKGETSIZE: + case BLKFLSBUF: + case BLKBSZSET: + case BLKBSZGET: +diff -Nru a/drivers/block/cciss.h b/drivers/block/cciss.h +--- a/drivers/block/cciss.h Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/cciss.h Thu Oct 31 09:20:21 2002 +@@ -82,7 +82,7 @@ + struct gendisk gendisk; + // indexed by minor numbers + struct hd_struct hd[256]; +- int sizes[256]; ++ sector_t sizes[256]; + int blocksizes[256]; + int hardsizes[256]; + #ifdef CONFIG_CISS_SCSI_TAPE +diff -Nru a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c +--- a/drivers/block/cpqarray.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/cpqarray.c Thu Oct 31 09:20:21 2002 +@@ -1287,12 +1287,6 @@ + + case IDAGETDRVINFO: + return copy_to_user(&io->c.drv,&hba[ctlr]->drv[dsk],sizeof(drv_info_t)); +- case BLKGETSIZE: +- if (!arg) return -EINVAL; +- return put_user(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects, +- (unsigned long *)arg); +- case BLKGETSIZE64: +- return put_user((u64)(hba[ctlr]->hd[MINOR(inode->i_rdev)].nr_sects) << 9, (u64*)arg); + case BLKRRPART: + return revalidate_logvol(inode->i_rdev, 1); + case IDAPASSTHRU: +@@ -1360,6 +1354,8 @@ + return(0); + } + ++ case BLKGETSIZE: ++ case BLKGETSIZE64: + case BLKFLSBUF: + case BLKBSZSET: + case BLKBSZGET: +diff -Nru a/drivers/block/cpqarray.h b/drivers/block/cpqarray.h +--- a/drivers/block/cpqarray.h Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/cpqarray.h Thu Oct 31 09:20:25 2002 +@@ -123,7 +123,7 @@ + struct gendisk gendisk; + // Index by Minor Numbers + struct hd_struct hd[256]; +- int sizes[256]; ++ sector_t sizes[256]; + int blocksizes[256]; + int hardsizes[256]; + }; +diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c +--- a/drivers/block/floppy.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/floppy.c Thu Oct 31 09:20:21 2002 +@@ -480,7 +480,7 @@ + */ + static struct floppy_struct user_params[N_DRIVE]; + +-static int floppy_sizes[256]; ++static sector_t floppy_sizes[256]; + static int floppy_blocksizes[256]; + + /* +@@ -582,7 +582,7 @@ + static struct floppy_struct *_floppy = floppy_type; + static unsigned char current_drive; + static long current_count_sectors; +-static unsigned char sector_t; /* sector in track */ ++static unsigned char sector; /* sector in track */ + static unsigned char in_sector_offset; /* offset within physical sector, + * expressed in units of 512 bytes */ + +@@ -2383,7 +2383,7 @@ + printk("rt=%d t=%d\n", R_TRACK, TRACK); + printk("heads=%d eoc=%d\n", heads, eoc); + printk("spt=%d st=%d ss=%d\n", SECT_PER_TRACK, +- sector_t, ssize); ++ sector, ssize); + printk("in_sector_offset=%d\n", in_sector_offset); + } + #endif +@@ -2430,7 +2430,7 @@ + } else if (CT(COMMAND) == FD_READ){ + buffer_track = raw_cmd->track; + buffer_drive = current_drive; +- INFBOUND(buffer_max, nr_sectors + sector_t); ++ INFBOUND(buffer_max, nr_sectors + sector); + } + cont->redo(); + } +@@ -2459,13 +2459,13 @@ + /* Compute the maximal transfer size */ + static int transfer_size(int ssize, int max_sector, int max_size) + { +- SUPBOUND(max_sector, sector_t + max_size); ++ SUPBOUND(max_sector, sector + max_size); + + /* alignment */ + max_sector -= (max_sector % _floppy->sect) % ssize; + + /* transfer size, beginning not aligned */ +- current_count_sectors = max_sector - sector_t ; ++ current_count_sectors = max_sector - sector ; + + return max_sector; + } +@@ -2485,8 +2485,8 @@ + CURRENT->nr_sectors); + + if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE && +- buffer_max > sector_t + CURRENT->nr_sectors) +- current_count_sectors = minimum(buffer_max - sector_t, ++ buffer_max > sector + CURRENT->nr_sectors) ++ current_count_sectors = minimum(buffer_max - sector, + CURRENT->nr_sectors); + + remaining = current_count_sectors << 9; +@@ -2506,7 +2506,7 @@ + + buffer_max = maximum(max_sector, buffer_max); + +- dma_buffer = floppy_track_buffer + ((sector_t - buffer_min) << 9); ++ dma_buffer = floppy_track_buffer + ((sector - buffer_min) << 9); + + bh = CURRENT->bh; + size = CURRENT->current_nr_sectors << 9; +@@ -2520,8 +2520,8 @@ + dma_buffer < floppy_track_buffer){ + DPRINT("buffer overrun in copy buffer %d\n", + (int) ((floppy_track_buffer - dma_buffer) >>9)); +- printk("sector_t=%d buffer_min=%d\n", +- sector_t, buffer_min); ++ printk("sector=%d buffer_min=%d\n", ++ sector, buffer_min); + printk("current_count_sectors=%ld\n", + current_count_sectors); + if (CT(COMMAND) == FD_READ) +@@ -2614,7 +2614,7 @@ + + static int make_raw_rw_request(void) + { +- int aligned_sector_t; ++ int aligned_sector; + int max_sector, max_size, tracksize, ssize; + + if(max_buffer_sectors == 0) { +@@ -2641,8 +2641,8 @@ + + max_sector = _floppy->sect * _floppy->head; + +- TRACK = CURRENT->sector / max_sector; +- sector_t = CURRENT->sector % max_sector; ++ TRACK = (long)CURRENT->sector / max_sector; ++ sector = (long)CURRENT->sector % max_sector; + if (_floppy->track && TRACK >= _floppy->track) { + if (CURRENT->current_nr_sectors & 1) { + current_count_sectors = 1; +@@ -2650,17 +2650,17 @@ + } else + return 0; + } +- HEAD = sector_t / _floppy->sect; ++ HEAD = sector / _floppy->sect; + + if (((_floppy->stretch & FD_SWAPSIDES) || TESTF(FD_NEED_TWADDLE)) && +- sector_t < _floppy->sect) ++ sector < _floppy->sect) + max_sector = _floppy->sect; + + /* 2M disks have phantom sectors on the first track */ + if ((_floppy->rate & FD_2M) && (!TRACK) && (!HEAD)){ + max_sector = 2 * _floppy->sect / 3; +- if (sector_t >= max_sector){ +- current_count_sectors = minimum(_floppy->sect - sector_t, ++ if (sector >= max_sector){ ++ current_count_sectors = minimum(_floppy->sect - sector, + CURRENT->nr_sectors); + return 1; + } +@@ -2682,7 +2682,7 @@ + GAP = _floppy->gap; + CODE2SIZE; + SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE; +- SECTOR = ((sector_t % _floppy->sect) << 2 >> SIZECODE) + 1; ++ SECTOR = ((sector % _floppy->sect) << 2 >> SIZECODE) + 1; + + /* tracksize describes the size which can be filled up with sectors + * of size ssize. +@@ -2690,11 +2690,11 @@ + tracksize = _floppy->sect - _floppy->sect % ssize; + if (tracksize < _floppy->sect){ + SECT_PER_TRACK ++; +- if (tracksize <= sector_t % _floppy->sect) ++ if (tracksize <= sector % _floppy->sect) + SECTOR--; + + /* if we are beyond tracksize, fill up using smaller sectors */ +- while (tracksize <= sector_t % _floppy->sect){ ++ while (tracksize <= sector % _floppy->sect){ + while(tracksize + ssize > _floppy->sect){ + SIZECODE--; + ssize >>= 1; +@@ -2710,12 +2710,12 @@ + max_sector = _floppy->sect; + } + +- in_sector_offset = (sector_t % _floppy->sect) % ssize; +- aligned_sector_t = sector_t - in_sector_offset; ++ in_sector_offset = (sector % _floppy->sect) % ssize; ++ aligned_sector = sector - in_sector_offset; + max_size = CURRENT->nr_sectors; + if ((raw_cmd->track == buffer_track) && + (current_drive == buffer_drive) && +- (sector_t >= buffer_min) && (sector_t < buffer_max)) { ++ (sector >= buffer_min) && (sector < buffer_max)) { + /* data already in track buffer */ + if (CT(COMMAND) == FD_READ) { + copy_buffer(1, max_sector, buffer_max); +@@ -2723,8 +2723,8 @@ + } + } else if (in_sector_offset || CURRENT->nr_sectors < ssize){ + if (CT(COMMAND) == FD_WRITE){ +- if (sector_t + CURRENT->nr_sectors > ssize && +- sector_t + CURRENT->nr_sectors < ssize + ssize) ++ if (sector + CURRENT->nr_sectors > ssize && ++ sector + CURRENT->nr_sectors < ssize + ssize) + max_size = ssize + ssize; + else + max_size = ssize; +@@ -2737,7 +2737,7 @@ + int direct, indirect; + + indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) - +- sector_t; ++ sector; + + /* + * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide +@@ -2752,7 +2752,7 @@ + if (CROSS_64KB(CURRENT->buffer, max_size << 9)) + max_size = (K_64 - + ((unsigned long)CURRENT->buffer) % K_64)>>9; +- direct = transfer_size(ssize,max_sector,max_size) - sector_t; ++ direct = transfer_size(ssize,max_sector,max_size) - sector; + /* + * We try to read tracks, but if we get too many errors, we + * go back to reading just one sector at a time. +@@ -2771,8 +2771,8 @@ + raw_cmd->length = current_count_sectors << 9; + if (raw_cmd->length == 0){ + DPRINT("zero dma transfer attempted from make_raw_request\n"); +- DPRINT("indirect=%d direct=%d sector_t=%d", +- indirect, direct, sector_t); ++ DPRINT("indirect=%d direct=%d sector=%d", ++ indirect, direct, sector); + return 0; + } + /* check_dma_crossing(raw_cmd->kernel_data, +@@ -2790,19 +2790,19 @@ + /* claim buffer track if needed */ + if (buffer_track != raw_cmd->track || /* bad track */ + buffer_drive !=current_drive || /* bad drive */ +- sector_t > buffer_max || +- sector_t < buffer_min || ++ sector > buffer_max || ++ sector < buffer_min || + ((CT(COMMAND) == FD_READ || + (!in_sector_offset && CURRENT->nr_sectors >= ssize))&& + max_sector > 2 * max_buffer_sectors + buffer_min && +- max_size + sector_t > 2 * max_buffer_sectors + buffer_min) ++ max_size + sector > 2 * max_buffer_sectors + buffer_min) + /* not enough space */){ + buffer_track = -1; + buffer_drive = current_drive; +- buffer_max = buffer_min = aligned_sector_t; ++ buffer_max = buffer_min = aligned_sector; + } + raw_cmd->kernel_data = floppy_track_buffer + +- ((aligned_sector_t-buffer_min)<<9); ++ ((aligned_sector-buffer_min)<<9); + + if (CT(COMMAND) == FD_WRITE){ + /* copy write buffer to track buffer. +@@ -2818,7 +2818,7 @@ + copy_buffer(ssize, max_sector, 2*max_buffer_sectors+buffer_min); + } else + transfer_size(ssize, max_sector, +- 2*max_buffer_sectors+buffer_min-aligned_sector_t); ++ 2*max_buffer_sectors+buffer_min-aligned_sector); + + /* round up current_count_sectors to get dma xfer size */ + raw_cmd->length = in_sector_offset+current_count_sectors; +@@ -2830,8 +2830,8 @@ + if ((raw_cmd->length < current_count_sectors << 9) || + (raw_cmd->kernel_data != CURRENT->buffer && + CT(COMMAND) == FD_WRITE && +- (aligned_sector_t + (raw_cmd->length >> 9) > buffer_max || +- aligned_sector_t < buffer_min)) || ++ (aligned_sector + (raw_cmd->length >> 9) > buffer_max || ++ aligned_sector < buffer_min)) || + raw_cmd->length % (128 << SIZECODE) || + raw_cmd->length <= 0 || current_count_sectors <= 0){ + DPRINT("fractionary current count b=%lx s=%lx\n", +@@ -2842,7 +2842,7 @@ + floppy_track_buffer) >> 9), + current_count_sectors); + printk("st=%d ast=%d mse=%d msi=%d\n", +- sector_t, aligned_sector_t, max_sector, max_size); ++ sector, aligned_sector, max_sector, max_size); + printk("ssize=%x SIZECODE=%d\n", ssize, SIZECODE); + printk("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n", + COMMAND, SECTOR, HEAD, TRACK); +@@ -2860,8 +2860,8 @@ + raw_cmd->kernel_data + raw_cmd->length > + floppy_track_buffer + (max_buffer_sectors << 10)){ + DPRINT("buffer overrun in schedule dma\n"); +- printk("sector_t=%d buffer_min=%d current_count=%ld\n", +- sector_t, buffer_min, ++ printk("sector=%d buffer_min=%d current_count=%ld\n", ++ sector, buffer_min, + raw_cmd->length >> 9); + printk("current_count_sectors=%ld\n", + current_count_sectors); +@@ -2983,7 +2983,7 @@ + + if (usage_count == 0) { + printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT); +- printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd); ++ printk("sect=%llu cmd=%d\n", (unsigned long long)CURRENT->sector, CURRENT->cmd); + return; + } + if (fdc_busy){ +diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c +--- a/drivers/block/genhd.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/genhd.c Thu Oct 31 09:20:25 2002 +@@ -200,9 +200,9 @@ + struct hd_struct *hd = &gp->part[n]; + + disk_round_stats(hd); +- seq_printf(s, "%4d %4d %10d %s " ++ seq_printf(s, "%4d %4d %10llu %s " + "%d %d %d %d %d %d %d %d %d %d %d\n", +- gp->major, n, gp->sizes[n], ++ gp->major, n, (unsigned long long)gp->sizes[n], + disk_name(gp, n, buf), + hd->rd_ios, hd->rd_merges, + #define MSEC(x) ((x) * 1000 / HZ) +@@ -212,8 +212,8 @@ + hd->ios_in_flight, MSEC(hd->io_ticks), + MSEC(hd->aveq)); + #else +- seq_printf(s, "%4d %4d %10d %s\n", +- gp->major, n, gp->sizes[n], ++ seq_printf(s, "%4d %4d %10llu %s\n", ++ gp->major, n, (unsigned long long)gp->sizes[n], + disk_name(gp, n, buf)); + #endif /* CONFIG_BLK_STATS */ + } +diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c +--- a/drivers/block/ll_rw_blk.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/ll_rw_blk.c Thu Oct 31 09:20:21 2002 +@@ -83,10 +83,10 @@ + * + * if (!blk_size[MAJOR]) then no minor size checking is done. + */ +-int * blk_size[MAX_BLKDEV]; ++sector_t * blk_size[MAX_BLKDEV]; + + /* +- * blksize_size contains the size of all block-devices: ++ * blksize_size contains the block size of all block-devices: + * + * blksize_size[MAJOR][MINOR] + * +@@ -902,7 +902,8 @@ + static int __make_request(request_queue_t * q, int rw, + struct buffer_head * bh) + { +- unsigned int sector, count; ++ sector_t sector; ++ unsigned count; + int max_segments = MAX_SEGMENTS; + struct request * req, *freereq = NULL; + int rw_ahead, max_sectors, el_ret; +@@ -1077,7 +1078,7 @@ + } + + /** +- * generic_make_request: hand a buffer head to it's device driver for I/O ++ * generic_make_request: hand a buffer head to its device driver for I/O + * @rw: READ, WRITE, or READA - what sort of I/O is desired. + * @bh: The buffer head describing the location in memory and on the device. + * +@@ -1113,7 +1114,7 @@ + void generic_make_request (int rw, struct buffer_head * bh) + { + int major = MAJOR(bh->b_rdev); +- int minorsize = 0; ++ sector_t minorsize = 0; + request_queue_t *q; + + if (!bh->b_end_io) +@@ -1123,8 +1124,8 @@ + if (blk_size[major]) + minorsize = blk_size[major][MINOR(bh->b_rdev)]; + if (minorsize) { +- unsigned long maxsector = (minorsize << 1) + 1; +- unsigned long sector = bh->b_rsector; ++ sector_t maxsector = (minorsize << 1) + 1; ++ sector_t sector = bh->b_rsector; + unsigned int count = bh->b_size >> 9; + + if (maxsector < count || maxsector - count < sector) { +@@ -1136,9 +1137,10 @@ + when mounting a device. */ + printk(KERN_INFO + "attempt to access beyond end of device\n"); +- printk(KERN_INFO "%s: rw=%d, want=%ld, limit=%d\n", ++ printk(KERN_INFO "%s: rw=%d, want=%llu, limit=%llu\n", + kdevname(bh->b_rdev), rw, +- (sector + count)>>1, minorsize); ++ (unsigned long long)((sector + count)>>1), ++ (unsigned long long)minorsize); + + /* Yecch again */ + bh->b_end_io(bh, 0); +@@ -1159,8 +1161,8 @@ + if (!q) { + printk(KERN_ERR + "generic_make_request: Trying to access " +- "nonexistent block-device %s (%ld)\n", +- kdevname(bh->b_rdev), bh->b_rsector); ++ "nonexistent block-device %s (%llu)\n", ++ kdevname(bh->b_rdev), (unsigned long long)bh->b_rsector); + buffer_IO_error(bh); + break; + } +@@ -1346,8 +1348,8 @@ + + req->errors = 0; + if (!uptodate) +- printk("end_request: I/O error, dev %s (%s), sector %lu\n", +- kdevname(req->rq_dev), name, req->sector); ++ printk("end_request: I/O error, dev %s (%s), sector %llu\n", ++ kdevname(req->rq_dev), name, (unsigned long long)req->sector); + + if ((bh = req->bh) != NULL) { + nsect = bh->b_size >> 9; +diff -Nru a/drivers/block/loop.c b/drivers/block/loop.c +--- a/drivers/block/loop.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/loop.c Thu Oct 31 09:20:25 2002 +@@ -80,7 +80,7 @@ + + static int max_loop = 8; + static struct loop_device *loop_dev; +-static int *loop_sizes; ++static sector_t *loop_sizes; + static int *loop_blksizes; + static devfs_handle_t devfs_handle; /* For the directory */ + +@@ -88,7 +88,7 @@ + * Transfer functions + */ + static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, +- char *loop_buf, int size, int real_block) ++ char *loop_buf, int size, sector_t real_block) + { + if (raw_buf != loop_buf) { + if (cmd == READ) +@@ -101,7 +101,7 @@ + } + + static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, +- char *loop_buf, int size, int real_block) ++ char *loop_buf, int size, sector_t real_block) + { + char *in, *out, *key; + int i, keysize; +@@ -154,21 +154,27 @@ + + #define MAX_DISK_SIZE 1024*1024*1024 + +-static int compute_loop_size(struct loop_device *lo, struct dentry * lo_dentry, kdev_t lodev) +-{ +- if (S_ISREG(lo_dentry->d_inode->i_mode)) +- return (lo_dentry->d_inode->i_size - lo->lo_offset) >> BLOCK_SIZE_BITS; +- if (blk_size[MAJOR(lodev)]) +- return blk_size[MAJOR(lodev)][MINOR(lodev)] - +- (lo->lo_offset >> BLOCK_SIZE_BITS); +- return MAX_DISK_SIZE; +-} + +-static void figure_loop_size(struct loop_device *lo) ++static int figure_loop_size(struct loop_device *lo) + { +- loop_sizes[lo->lo_number] = compute_loop_size(lo, +- lo->lo_backing_file->f_dentry, +- lo->lo_device); ++ loff_t size = lo->lo_backing_file->f_dentry->d_inode->i_mapping->host->i_size; ++ sector_t x; ++ ++ /* ++ * Unfortunately, if we want to do I/O on the device, ++ * the number of 512-byte sectors has to fit into a sector_t. ++ */ ++ size = (size - lo->lo_offset) >> 9; ++ x = (sector_t)size; ++ if ((loff_t)x != size) ++ return -EFBIG; ++ /* ++ * Convert sectors to blocks ++ */ ++ size >>= (BLOCK_SIZE_BITS - 9); ++ ++ loop_sizes[lo->lo_number] = (sector_t)size; ++ return 0; + } + + static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize, +@@ -189,7 +195,7 @@ + len = bh->b_size; + data = bh->b_data; + while (len > 0) { +- int IV = index * (PAGE_CACHE_SIZE/bsize) + offset/bsize; ++ sector_t IV = (sector_t)index * (PAGE_CACHE_SIZE/bsize) + offset/bsize; + int transfer_result; + + size = PAGE_CACHE_SIZE - offset; +@@ -247,7 +253,7 @@ + unsigned long count = desc->count; + struct lo_read_data *p = (struct lo_read_data*)desc->buf; + struct loop_device *lo = p->lo; +- int IV = page->index * (PAGE_CACHE_SIZE/p->bsize) + offset/p->bsize; ++ sector_t IV = (sector_t)page->index * (PAGE_CACHE_SIZE/p->bsize) + offset/p->bsize; + + if (size > count) + size = count; +@@ -255,7 +261,7 @@ + kaddr = kmap(page); + if (lo_do_transfer(lo, READ, kaddr + offset, p->data, size, IV)) { + size = 0; +- printk(KERN_ERR "loop: transfer error block %ld\n",page->index); ++ printk(KERN_ERR "loop: transfer error block %lu\n",page->index); + desc->error = -EINVAL; + } + kunmap(page); +@@ -299,15 +305,29 @@ + return bs; + } + +-static inline unsigned long loop_get_iv(struct loop_device *lo, +- unsigned long sector) ++static inline int loop_get_bs_shift(struct loop_device *lo) + { + int bs = loop_get_bs(lo); ++ int i; ++ /* ++ * Assume power-of-two block size ++ */ ++ for (i = -1; bs; i++) ++ bs >>= 1; ++ return i; ++} ++ ++static inline unsigned long loop_get_iv(struct loop_device *lo, ++ sector_t sector) ++{ ++ int bs = loop_get_bs_shift(lo); + unsigned long offset, IV; + +- IV = sector / (bs >> 9) + lo->lo_offset / bs; +- offset = ((sector % (bs >> 9)) << 9) + lo->lo_offset % bs; +- if (offset >= bs) ++ IV = (sector >> (bs - 9)) + (lo->lo_offset >> bs); ++ ++ offset = ((sector & ((1 << (bs-9)) - 1))<<9) + (lo->lo_offset & ((1 << bs)-1)); ++ ++ if (offset >= (1 << bs)) + IV++; + + return IV; +@@ -540,7 +560,7 @@ + bh->b_end_io(bh, !ret); + } else { + struct buffer_head *rbh = bh->b_private; +- unsigned long IV = loop_get_iv(lo, rbh->b_rsector); ++ sector_t IV = loop_get_iv(lo, rbh->b_rsector); + + ret = lo_do_transfer(lo, READ, bh->b_data, rbh->b_data, + bh->b_size, IV); +@@ -678,7 +698,11 @@ + lo->lo_backing_file = file; + lo->transfer = NULL; + lo->ioctl = NULL; +- figure_loop_size(lo); ++ if (figure_loop_size(lo)) { ++ error = -EFBIG; ++ fput(file); ++ goto out_putf; ++ } + lo->old_gfp_mask = inode->i_mapping->gfp_mask; + inode->i_mapping->gfp_mask = GFP_NOIO; + +@@ -779,6 +803,7 @@ + { + struct loop_info info; + int err; ++ loff_t offset; + unsigned int type; + + if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid && +@@ -798,10 +823,18 @@ + err = loop_release_xfer(lo); + if (!err) + err = loop_init_xfer(lo, type, &info); ++ ++ offset = lo->lo_offset; ++ if (offset != info.lo_offset) { ++ lo->lo_offset = info.lo_offset; ++ if (figure_loop_size(lo)){ ++ err = -EFBIG; ++ lo->lo_offset = offset; ++ } ++ } + if (err) + return err; + +- lo->lo_offset = info.lo_offset; + strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE); + + lo->transfer = xfer_funcs[type]->transfer; +@@ -876,12 +909,19 @@ + err = loop_get_status(lo, (struct loop_info *) arg); + break; + case BLKGETSIZE: ++ { ++ unsigned long val; + if (lo->lo_state != Lo_bound) { + err = -ENXIO; + break; + } +- err = put_user((unsigned long)loop_sizes[lo->lo_number] << 1, (unsigned long *) arg); ++ val = loop_sizes[lo->lo_number] << 1; ++ if ((sector_t) val != (loop_sizes[lo->lo_number] << 1)) ++ err = -EFBIG; ++ else ++ err = put_user(val, (unsigned long *) arg); + break; ++ } + case BLKGETSIZE64: + if (lo->lo_state != Lo_bound) { + err = -ENXIO; +diff -Nru a/drivers/block/nbd.c b/drivers/block/nbd.c +--- a/drivers/block/nbd.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/block/nbd.c Thu Oct 31 09:20:22 2002 +@@ -57,7 +57,7 @@ + + static int nbd_blksizes[MAX_NBD]; + static int nbd_blksize_bits[MAX_NBD]; +-static int nbd_sizes[MAX_NBD]; ++static sector_t nbd_sizes[MAX_NBD]; + static u64 nbd_bytesizes[MAX_NBD]; + + static struct nbd_device nbd_dev[MAX_NBD]; +diff -Nru a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c +--- a/drivers/block/ps2esdi.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/block/ps2esdi.c Thu Oct 31 09:20:21 2002 +@@ -116,7 +116,7 @@ + static int no_int_yet; + static int access_count[MAX_HD]; + static char ps2esdi_valid[MAX_HD]; +-static int ps2esdi_sizes[MAX_HD << 6]; ++static sector_t ps2esdi_sizes[MAX_HD << 6]; + static int ps2esdi_blocksizes[MAX_HD << 6]; + static int ps2esdi_maxsect[MAX_HD << 6]; + static int ps2esdi_drives; +@@ -517,7 +517,7 @@ + /* is request is valid */ + else { + printk("Grrr. error. ps2esdi_drives: %d, %lu %lu\n", ps2esdi_drives, +- CURRENT->sector, ps2esdi[MINOR(CURRENT->rq_dev)].nr_sects); ++ (unsigned long)CURRENT->sector, (unsigned long)ps2esdi[MINOR(CURRENT->rq_dev)].nr_sects); + end_request(FAIL); + } + +diff -Nru a/drivers/block/rd.c b/drivers/block/rd.c +--- a/drivers/block/rd.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/rd.c Thu Oct 31 09:20:25 2002 +@@ -75,7 +75,7 @@ + static unsigned long rd_length[NUM_RAMDISKS]; /* Size of RAM disks in bytes */ + static int rd_hardsec[NUM_RAMDISKS]; /* Size of real blocks in bytes */ + static int rd_blocksizes[NUM_RAMDISKS]; /* Size of 1024 byte blocks :) */ +-static int rd_kbsize[NUM_RAMDISKS]; /* Size in blocks of 1024 bytes */ ++static sector_t rd_kbsize[NUM_RAMDISKS]; /* Size in blocks of 1024 bytes */ + static devfs_handle_t devfs_handle; + static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */ + +diff -Nru a/drivers/block/umem.c b/drivers/block/umem.c +--- a/drivers/block/umem.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/block/umem.c Thu Oct 31 09:20:25 2002 +@@ -160,7 +160,7 @@ + + static int mm_hardsect [MM_MAXCARDS << MM_SHIFT]; + static int mm_blocksizes[MM_MAXCARDS << MM_SHIFT]; +-static int mm_sizes[MM_MAXCARDS << MM_SHIFT]; ++static sector_t mm_sizes[MM_MAXCARDS << MM_SHIFT]; + static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT]; + + static int num_cards = 0; +diff -Nru a/drivers/block/xd.c b/drivers/block/xd.c +--- a/drivers/block/xd.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/block/xd.c Thu Oct 31 09:20:22 2002 +@@ -121,7 +121,7 @@ + }; + + static struct hd_struct xd_struct[XD_MAXDRIVES << 6]; +-static int xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES]; ++static sector_t xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES]; + static int xd_blocksizes[XD_MAXDRIVES << 6]; + static int xd_maxsect[XD_MAXDRIVES << 6]; + +diff -Nru a/drivers/char/raw.c b/drivers/char/raw.c +--- a/drivers/char/raw.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/char/raw.c Thu Oct 31 09:20:21 2002 +@@ -294,7 +294,8 @@ + struct kiobuf * iobuf; + int new_iobuf; + int err = 0; +- unsigned long blocknr, blocks; ++ sector_t blocknr; ++ unsigned long blocks; + size_t transferred; + int iosize; + int i; +diff -Nru a/drivers/ide/ataraid.c b/drivers/ide/ataraid.c +--- a/drivers/ide/ataraid.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/ide/ataraid.c Thu Oct 31 09:20:25 2002 +@@ -47,7 +47,7 @@ + + + struct gendisk ataraid_gendisk; +-static int ataraid_gendisk_sizes[256]; ++static sector_t ataraid_gendisk_sizes[256]; + static int ataraid_readahead[256]; + + static struct block_device_operations ataraid_fops = { +diff -Nru a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c +--- a/drivers/ide/ide-cd.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/ide/ide-cd.c Thu Oct 31 09:20:25 2002 +@@ -1060,8 +1060,8 @@ + paranoid and check. */ + if (rq->current_nr_sectors < (rq->bh->b_size >> SECTOR_BITS) && + (rq->sector % SECTORS_PER_FRAME) != 0) { +- printk ("%s: cdrom_read_from_buffer: buffer botch (%ld)\n", +- drive->name, rq->sector); ++ printk ("%s: cdrom_read_from_buffer: buffer botch (%llu)\n", ++ drive->name, (unsigned long long)rq->sector); + cdrom_end_request (0, drive); + return -1; + } +@@ -1689,8 +1689,9 @@ + * cdrom driver request routine. + */ + static ide_startstop_t +-ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, unsigned long block) ++ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, sector_t sect) + { ++ unsigned long block = (unsigned long)sect; + ide_startstop_t action; + struct cdrom_info *info = drive->driver_data; + +@@ -2934,14 +2935,14 @@ + } + + static +-unsigned long ide_cdrom_capacity (ide_drive_t *drive) ++sector_t ide_cdrom_capacity (ide_drive_t *drive) + { + unsigned long capacity; + + if (cdrom_read_capacity(drive, &capacity, NULL)) + return 0; + +- return capacity * SECTORS_PER_FRAME; ++ return (sector_t)capacity * SECTORS_PER_FRAME; + } + + static +diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c +--- a/drivers/ide/ide-disk.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/ide/ide-disk.c Thu Oct 31 09:20:21 2002 +@@ -352,7 +352,7 @@ + * using LBA if supported, or CHS otherwise, to address sectors. + * It also takes care of issuing special DRIVE_CMDs. + */ +-static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) + { + if (rq->cmd == READ) + goto good_command; +@@ -556,7 +556,7 @@ + * using LBA if supported, or CHS otherwise, to address sectors. + * It also takes care of issuing special DRIVE_CMDs. + */ +-static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block) + { + if (IDE_CONTROL_REG) + OUT_BYTE(drive->ctl,IDE_CONTROL_REG); +@@ -582,10 +582,13 @@ + tasklets[5] = (task_ioreg_t) (block>>8); + tasklets[6] = (task_ioreg_t) (block>>16); + tasklets[7] = (task_ioreg_t) (block>>24); ++#if CONFIG_LBD ++ tasklets[8] = (task_ioreg_t) (block>>32); ++ tasklets[9] = (task_ioreg_t) (block>>40); ++#else + tasklets[8] = (task_ioreg_t) 0; + tasklets[9] = (task_ioreg_t) 0; +-// tasklets[8] = (task_ioreg_t) (block>>32); +-// tasklets[9] = (task_ioreg_t) (block>>40); ++#endif + #ifdef DEBUG + printk("%s: %sing: LBAsect=%lu, sectors=%ld, buffer=0x%08lx, LBAsect=0x%012lx\n", + drive->name, +@@ -626,8 +629,8 @@ + } + } else { + unsigned int sect,head,cyl,track; +- track = block / drive->sect; +- sect = block % drive->sect + 1; ++ track = (unsigned int)block / drive->sect; ++ sect = (unsigned int)block % drive->sect + 1; + OUT_BYTE(sect,IDE_SECTOR_REG); + head = track % drive->head; + cyl = track / drive->head; +@@ -963,8 +966,10 @@ + drive->capacity48 = capacity_2; + drive->capacity = (unsigned long) capacity_2; + return; ++ } ++ + /* Determine capacity, and use LBA if the drive properly supports it */ +- } else if ((id->capability & 2) && lba_capacity_is_ok(id)) { ++ if ((id->capability & 2) && lba_capacity_is_ok(id)) { + capacity = id->lba_capacity; + drive->cyl = capacity / (drive->head * drive->sect); + drive->select.b.lba = 1; +@@ -996,7 +1001,7 @@ + } + } + +-static unsigned long idedisk_capacity (ide_drive_t *drive) ++static sector_t idedisk_capacity (ide_drive_t *drive) + { + if (drive->id->cfs_enable_2 & 0x0400) + return (drive->capacity48 - drive->sect0); +@@ -1326,7 +1331,7 @@ + int i; + + struct hd_driveid *id = drive->id; +- unsigned long capacity; ++ sector_t capacity; + + idedisk_add_settings(drive); + +@@ -1382,17 +1387,28 @@ + + /* + * if possible, give fdisk access to more of the drive, +- * by correcting bios_cyls: ++ * by correcting bios_cyls: + */ + capacity = idedisk_capacity (drive); +- if ((capacity >= (drive->bios_cyl * drive->bios_sect * drive->bios_head)) && +- (!drive->forced_geom) && drive->bios_sect && drive->bios_head) +- drive->bios_cyl = (capacity / drive->bios_sect) / drive->bios_head; +- printk (KERN_INFO "%s: %ld sectors", drive->name, capacity); ++ if ((capacity > (((sector_t)drive->bios_cyl * drive->bios_sect * drive->bios_head))) && ++ (!drive->forced_geom) && drive->bios_sect && drive->bios_head) { ++ sector_t cyl = capacity; ++ sector_div(cyl, drive->bios_head * drive->bios_sect); ++ if (cyl > 0x7fffffffULL) ++ drive->bios_cyl = 0x7fffffffUL; ++ else ++ drive->bios_cyl = cyl; ++ } + + /* Give size in megabytes (MB), not mebibytes (MiB). */ + /* We compute the exact rounded value, avoiding overflow. */ +- printk (" (%ld MB)", (capacity - capacity/625 + 974)/1950); ++ { ++ sector_t mbcap = capacity; ++ sector_div(mbcap, 625); ++ mbcap = capacity - mbcap + 974; ++ sector_div(mbcap, 1950); ++ printk (" (%llu MB)", (unsigned long long)mbcap); ++ } + + /* Only print cache size when it was specified */ + if (id->buf_size) +diff -Nru a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c +--- a/drivers/ide/ide-floppy.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/ide/ide-floppy.c Thu Oct 31 09:20:22 2002 +@@ -1294,14 +1294,15 @@ + /* + * idefloppy_do_request is our request handling function. + */ +-static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, sector_t sect) + { + idefloppy_floppy_t *floppy = drive->driver_data; + idefloppy_pc_t *pc; ++ unsigned long block = sect; + + #if IDEFLOPPY_DEBUG_LOG + printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); +- printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); ++ printk (KERN_INFO "sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); + #endif /* IDEFLOPPY_DEBUG_LOG */ + + if (rq->errors >= ERROR_MAX) { +@@ -1316,7 +1317,7 @@ + switch (rq->cmd) { + case READ: + case WRITE: +- if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { ++ if ((long)rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) { + printk ("%s: unsupported r/w request size\n", drive->name); + idefloppy_end_request (0, HWGROUP(drive)); + return ide_stopped; +@@ -1859,12 +1860,12 @@ + /* + * Return the current floppy capacity to ide.c. + */ +-static unsigned long idefloppy_capacity (ide_drive_t *drive) ++static sector_t idefloppy_capacity (ide_drive_t *drive) + { + idefloppy_floppy_t *floppy = drive->driver_data; + unsigned long capacity = floppy->blocks * floppy->bs_factor; + +- return capacity; ++ return (sector_t)capacity; + } + + /* +diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c +--- a/drivers/ide/ide-probe.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/ide/ide-probe.c Thu Oct 31 09:20:21 2002 +@@ -786,7 +786,7 @@ + if (!gd) + goto err_kmalloc_gd; + memset (gd, 0, sizeof(struct gendisk)); +- gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL); ++ gd->sizes = kmalloc (minors * sizeof(gd->sizes[0]), GFP_KERNEL); + if (!gd->sizes) + goto err_kmalloc_gd_sizes; + gd->part = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL); +diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c +--- a/drivers/ide/ide-tape.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/ide/ide-tape.c Thu Oct 31 09:20:21 2002 +@@ -2609,7 +2609,7 @@ + /* + * idetape_do_request is our request handling function. + */ +-static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t idetape_do_request (ide_drive_t *drive, struct request *rq, sector_t block) + { + idetape_tape_t *tape = drive->driver_data; + idetape_pc_t *pc; +@@ -2620,7 +2620,7 @@ + if (tape->debug_level >= 5) + printk (KERN_INFO "ide-tape: rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); + if (tape->debug_level >= 2) +- printk (KERN_INFO "ide-tape: sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); ++ printk (KERN_INFO "ide-tape: sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); + #endif /* IDETAPE_DEBUG_LOG */ + + if (!IDETAPE_RQ_CMD (rq->cmd)) { +diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c +--- a/drivers/ide/ide.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/ide/ide.c Thu Oct 31 09:20:26 2002 +@@ -1010,7 +1010,8 @@ + } + } + if (HWGROUP(drive) && HWGROUP(drive)->rq) +- printk(", sector=%ld", HWGROUP(drive)->rq->sector); ++ printk(", sector=%llu", ++ (unsigned long long)HWGROUP(drive)->rq->sector); + } + } + #endif /* FANCY_STATUS_DUMPS */ +@@ -3745,7 +3746,7 @@ + return 0; + } + +-static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, sector_t block) + { + ide_end_request(0, HWGROUP(drive)); + return ide_stopped; +@@ -3781,9 +3782,9 @@ + { + } + +-static unsigned long default_capacity (ide_drive_t *drive) ++static sector_t default_capacity (ide_drive_t *drive) + { +- return 0x7fffffff; ++ return (sector_t)0x7fffffff; + } + + static ide_startstop_t default_special (ide_drive_t *drive) +diff -Nru a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c +--- a/drivers/ieee1394/sbp2.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/ieee1394/sbp2.c Thu Oct 31 09:20:21 2002 +@@ -3160,12 +3160,12 @@ + + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (unsigned int)disk->capacity / (heads * sectors); + + if (cylinders > 1024) { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (unsigned int)disk->capacity / (heads * sectors); + } + + geom[0] = heads; +diff -Nru a/drivers/md/linear.c b/drivers/md/linear.c +--- a/drivers/md/linear.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/md/linear.c Thu Oct 31 09:20:25 2002 +@@ -32,8 +32,9 @@ + linear_conf_t *conf; + struct linear_hash *table; + mdk_rdev_t *rdev; +- int size, i, j, nb_zone; +- unsigned int curr_offset; ++ s64 size; ++ int i, j, nb_zone; ++ sector_t curr_offset; + + MOD_INC_USE_COUNT; + +@@ -54,10 +55,16 @@ + curr_offset = 0; + ITERATE_RDEV_ORDERED(mddev,rdev,j) { + dev_info_t *disk = conf->disks + j; ++ long x; + + disk->dev = rdev->dev; + disk->size = rdev->size; + disk->offset = curr_offset; ++ x = disk->size; ++ if (unlikely((sector_t)x != disk->size)) { ++ printk("linear: Array members must be smaller than 2TB, aborting\n"); ++ goto out; ++ } + + curr_offset += disk->size; + +@@ -65,10 +72,14 @@ + conf->smallest = disk; + } + +- nb_zone = conf->nr_zones = +- md_size[mdidx(mddev)] / conf->smallest->size + +- ((md_size[mdidx(mddev)] % conf->smallest->size) ? 1 : 0); +- ++ ++ ++ { ++ sector_t sz = md_size[mdidx(mddev)]; ++ unsigned round = sector_div(sz, (long)conf->smallest->size); ++ nb_zone = conf->nr_zones = sz + (round != 0); ++ } ++ + conf->hash_table = kmalloc (sizeof (struct linear_hash) * nb_zone, + GFP_KERNEL); + if (!conf->hash_table) +@@ -87,7 +98,6 @@ + table[-1].dev1 = disk; + } + size += disk->size; +- + while (size>0) { + table->dev0 = disk; + table->dev1 = NULL; +@@ -125,15 +135,21 @@ + linear_conf_t *conf = mddev_to_conf(mddev); + struct linear_hash *hash; + dev_info_t *tmp_dev; +- long block; ++ sector_t block; ++ sector_t hashindex; + + block = bh->b_rsector >> 1; +- hash = conf->hash_table + (block / conf->smallest->size); ++ ++ BUG_ON((sector_t)block != ((sector_t)bh->b_rsector >> 1)); ++ ++ hashindex = block; ++ sector_div(hashindex, (long)conf->smallest->size); ++ hash = conf->hash_table + hashindex; + + if (block >= (hash->dev0->size + hash->dev0->offset)) { + if (!hash->dev1) { +- printk ("linear_make_request : hash->dev1==NULL for block %ld\n", +- block); ++ printk ("linear_make_request : hash->dev1==NULL for block %llu\n", ++ (unsigned long long)block); + buffer_IO_error(bh); + return 0; + } +@@ -143,7 +159,11 @@ + + if (block >= (tmp_dev->size + tmp_dev->offset) + || block < tmp_dev->offset) { +- printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, kdevname(tmp_dev->dev), tmp_dev->size, tmp_dev->offset); ++ printk ("linear_make_request: Block %llu out of bounds on dev %s size %ld offset %ld\n", ++ (unsigned long long)block, ++ kdevname(tmp_dev->dev), ++ (long)tmp_dev->size, ++ (long)tmp_dev->offset); + buffer_IO_error(bh); + return 0; + } +diff -Nru a/drivers/md/lvm-snap.c b/drivers/md/lvm-snap.c +--- a/drivers/md/lvm-snap.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/md/lvm-snap.c Thu Oct 31 09:20:25 2002 +@@ -71,7 +71,7 @@ + + + static inline int __brw_kiovec(int rw, int nr, struct kiobuf *iovec[], +- kdev_t dev, unsigned long b[], int size, ++ kdev_t dev, sector_t b[], int size, + lv_t *lv) { + return brw_kiovec(rw, nr, iovec, dev, b, size); + } +@@ -218,8 +218,8 @@ + reason); + } + +-static inline int lvm_snapshot_prepare_blocks(unsigned long *blocks, +- unsigned long start, ++static inline int lvm_snapshot_prepare_blocks(sector_t *blocks, ++ sector_t start, + int nr_sectors, + int blocksize) + { +@@ -231,7 +231,7 @@ + return 0; + + nr_blocks = nr_sectors / sectors_per_block; +- start /= sectors_per_block; ++ sector_div(start, sectors_per_block); + + for (i = 0; i < nr_blocks; i++) + blocks[i] = start++; +@@ -356,7 +356,7 @@ + unsigned long phys_start; + int idx = lv_snap->lv_remap_ptr, chunk_size = lv_snap->lv_chunk_size; + struct kiobuf * iobuf = lv_snap->lv_iobuf; +- unsigned long *blocks = iobuf->blocks; ++ sector_t *blocks = iobuf->blocks; + int blksize_snap, blksize_org, min_blksize, max_blksize; + int max_sectors, nr_sectors; + +@@ -621,7 +621,7 @@ + uint pvn; + ulong snap_pe_start, COW_table_sector_offset, + COW_entries_per_pe, COW_chunks_per_pe, COW_entries_per_block; +- ulong blocks[1]; ++ sector_t blocks[1]; + kdev_t snap_phys_dev; + lv_block_exception_t *be; + struct kiobuf *COW_table_iobuf = lv_snap->lv_COW_table_iobuf; +diff -Nru a/drivers/md/lvm.c b/drivers/md/lvm.c +--- a/drivers/md/lvm.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/md/lvm.c Thu Oct 31 09:20:21 2002 +@@ -417,7 +417,7 @@ + static struct hd_struct lvm_hd_struct[MAX_LV]; + static int lvm_blocksizes[MAX_LV]; + static int lvm_hardsectsizes[MAX_LV]; +-static int lvm_size[MAX_LV]; ++static sector_t lvm_size[MAX_LV]; + + static struct gendisk lvm_gendisk = + { +diff -Nru a/drivers/md/md.c b/drivers/md/md.c +--- a/drivers/md/md.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/md/md.c Thu Oct 31 09:20:22 2002 +@@ -109,7 +109,7 @@ + static int md_maxreadahead[MAX_MD_DEVS]; + static mdk_thread_t *md_recovery_thread; + +-int md_size[MAX_MD_DEVS]; ++sector_t md_size[MAX_MD_DEVS]; + + static struct block_device_operations md_fops; + static devfs_handle_t devfs_handle; +@@ -282,10 +282,10 @@ + return dname->name; + } + +-static unsigned int calc_dev_sboffset(kdev_t dev, mddev_t *mddev, ++static sector_t calc_dev_sboffset(kdev_t dev, mddev_t *mddev, + int persistent) + { +- unsigned int size = 0; ++ sector_t size = 0; + + if (blk_size[MAJOR(dev)]) + size = blk_size[MAJOR(dev)][MINOR(dev)]; +@@ -294,9 +294,9 @@ + return size; + } + +-static unsigned int calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent) ++static sector_t calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent) + { +- unsigned int size; ++ sector_t size; + + size = calc_dev_sboffset(dev, mddev, persistent); + if (!mddev->sb) { +@@ -304,13 +304,13 @@ + return size; + } + if (mddev->sb->chunk_size) +- size &= ~(mddev->sb->chunk_size/1024 - 1); ++ size &= ~((sector_t)mddev->sb->chunk_size/1024 - 1); + return size; + } + + static unsigned int zoned_raid_size(mddev_t *mddev) + { +- unsigned int mask; ++ sector_t mask; + mdk_rdev_t * rdev; + struct md_list_head *tmp; + +@@ -321,7 +321,7 @@ + /* + * do size and offset calculations. + */ +- mask = ~(mddev->sb->chunk_size/1024 - 1); ++ mask = ~((sector_t)mddev->sb->chunk_size/1024 - 1); + + ITERATE_RDEV(mddev,rdev,tmp) { + rdev->size &= mask; +@@ -331,7 +331,7 @@ + } + + /* +- * We check wether all devices are numbered from 0 to nb_dev-1. The ++ * We check whether all devices are numbered from 0 to nb_dev-1. The + * order is guaranteed even after device name changes. + * + * Some personalities (raid0, linear) use this. Personalities that +@@ -474,7 +474,7 @@ + struct buffer_head *bh = NULL; + kdev_t dev = rdev->dev; + mdp_super_t *sb; +- unsigned long sb_offset; ++ sector_t sb_offset; + + if (!rdev->sb) { + MD_BUG(); +@@ -784,7 +784,7 @@ + { + printk(KERN_INFO "md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ", + partition_name(rdev->dev), partition_name(rdev->old_dev), +- rdev->size, rdev->faulty, rdev->desc_nr); ++ (long)rdev->size, rdev->faulty, rdev->desc_nr); + if (rdev->sb) { + printk(KERN_INFO "md: rdev superblock:\n"); + print_sb(rdev->sb); +@@ -892,7 +892,7 @@ + { + struct buffer_head *bh; + kdev_t dev; +- unsigned long sb_offset, size; ++ sector_t sb_offset, size; + mdp_super_t *sb; + + if (!rdev->sb) { +@@ -911,8 +911,8 @@ + dev = rdev->dev; + sb_offset = calc_dev_sboffset(dev, rdev->mddev, 1); + if (rdev->sb_offset != sb_offset) { +- printk(KERN_INFO "%s's sb offset has changed from %ld to %ld, skipping\n", +- partition_name(dev), rdev->sb_offset, sb_offset); ++ printk(KERN_INFO "%s's sb offset has changed from %llu to %llu, skipping\n", ++ partition_name(dev), (unsigned long long)rdev->sb_offset, (unsigned long long)sb_offset); + goto skip; + } + /* +@@ -922,12 +922,13 @@ + */ + size = calc_dev_size(dev, rdev->mddev, 1); + if (size != rdev->size) { +- printk(KERN_INFO "%s's size has changed from %ld to %ld since import, skipping\n", +- partition_name(dev), rdev->size, size); ++ printk(KERN_INFO "%s's size has changed from %llu to %llu since import, skipping\n", ++ partition_name(dev), (unsigned long long)rdev->size, ++ (unsigned long long)size); + goto skip; + } + +- printk(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset); ++ printk(KERN_INFO "(write) %s's sb offset: %llu\n", partition_name(dev), (unsigned long long)sb_offset); + fsync_dev(dev); + set_blocksize(dev, MD_SB_BYTES); + bh = getblk(dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES); +@@ -1071,7 +1072,7 @@ + { + int err; + mdk_rdev_t *rdev; +- unsigned int size; ++ sector_t size; + + if (find_rdev_all(newdev)) + return -EEXIST; +@@ -1538,9 +1539,9 @@ + rdev->size = calc_dev_size(rdev->dev, mddev, persistent); + if (rdev->size < sb->chunk_size / 1024) { + printk(KERN_WARNING +- "md: Dev %s smaller than chunk_size: %ldk < %dk\n", ++ "md: Dev %s smaller than chunk_size: %lluk < %dk\n", + partition_name(rdev->dev), +- rdev->size, sb->chunk_size / 1024); ++ (unsigned long long)rdev->size, sb->chunk_size / 1024); + return -EINVAL; + } + } +@@ -2180,7 +2181,8 @@ + + static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) + { +- int err, size, persistent; ++ int err, persistent; ++ sector_t size; + mdk_rdev_t *rdev; + unsigned int nr; + kdev_t dev; +@@ -2611,20 +2613,7 @@ + #endif + + case BLKGETSIZE: /* Return device size */ +- if (!arg) { +- err = -EINVAL; +- MD_BUG(); +- goto abort; +- } +- err = md_put_user(md_hd_struct[minor].nr_sects, +- (unsigned long *) arg); +- goto done; +- + case BLKGETSIZE64: /* Return device size */ +- err = md_put_user((u64)md_hd_struct[minor].nr_sects << 9, +- (u64 *) arg); +- goto done; +- + case BLKRAGET: + case BLKRASET: + case BLKFLSBUF: +@@ -2861,7 +2850,7 @@ + + default: + printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, " +- "upgrade your software to use new ictls.\n", ++ "upgrade your software to use new ioctls.\n", + current->comm, current->pid); + err = -EINVAL; + goto abort_unlock; +@@ -3161,7 +3150,8 @@ + static int md_status_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) + { +- int sz = 0, j, size; ++ int sz = 0, j; ++ sector_t size; + struct md_list_head *tmp, *tmp2; + mdk_rdev_t *rdev; + mddev_t *mddev; +@@ -3202,10 +3192,10 @@ + + if (mddev->nb_dev) { + if (mddev->pers) +- sz += sprintf(page + sz, "\n %d blocks", +- md_size[mdidx(mddev)]); ++ sz += sprintf(page + sz, "\n %llu blocks", ++ (unsigned long long)md_size[mdidx(mddev)]); + else +- sz += sprintf(page + sz, "\n %d blocks", size); ++ sz += sprintf(page + sz, "\n %llu blocks", (unsigned long long)size); + } + + if (!mddev->pers) { +diff -Nru a/drivers/md/multipath.c b/drivers/md/multipath.c +--- a/drivers/md/multipath.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/md/multipath.c Thu Oct 31 09:20:25 2002 +@@ -216,8 +216,8 @@ + /* + * oops, IO error: + */ +- printk(KERN_ERR "multipath: %s: rescheduling block %lu\n", +- partition_name(bh->b_dev), bh->b_blocknr); ++ printk(KERN_ERR "multipath: %s: rescheduling block %llu\n", ++ partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + multipath_reschedule_retry(mp_bh); + return; + } +@@ -670,10 +670,10 @@ + + + #define IO_ERROR KERN_ALERT \ +-"multipath: %s: unrecoverable IO read error for block %lu\n" ++"multipath: %s: unrecoverable IO read error for block %llu\n" + + #define REDIRECT_SECTOR KERN_ERR \ +-"multipath: %s: redirecting sector %lu to another IO path\n" ++"multipath: %s: redirecting sector %llu to another IO path\n" + + /* + * This is a kernel thread which: +@@ -708,11 +708,11 @@ + + multipath_map (mddev, &bh->b_dev); + if (bh->b_dev == dev) { +- printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); ++ printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + multipath_end_bh_io(mp_bh, 0); + } else { + printk (REDIRECT_SECTOR, +- partition_name(bh->b_dev), bh->b_blocknr); ++ partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + bh->b_rdev = bh->b_dev; + bh->b_rsector = bh->b_blocknr; + generic_make_request (mp_bh->cmd, bh); +diff -Nru a/drivers/md/raid0.c b/drivers/md/raid0.c +--- a/drivers/md/raid0.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/md/raid0.c Thu Oct 31 09:20:25 2002 +@@ -41,7 +41,10 @@ + printk("raid0: looking at %s\n", partition_name(rdev1->dev)); + c = 0; + ITERATE_RDEV_ORDERED(mddev,rdev2,j2) { +- printk("raid0: comparing %s(%ld) with %s(%ld)\n", partition_name(rdev1->dev), rdev1->size, partition_name(rdev2->dev), rdev2->size); ++ printk("raid0: comparing %s(%llu) with %s(%llu)\n", partition_name(rdev1->dev), ++ (unsigned long long)rdev1->size, ++ partition_name(rdev2->dev), ++ (unsigned long long)rdev2->size); + if (rdev2 == rdev1) { + printk("raid0: END\n"); + break; +@@ -95,7 +98,7 @@ + c++; + if (!smallest || (rdev->size size)) { + smallest = rdev; +- printk(" (%ld) is smallest!.\n", rdev->size); ++ printk(" (%llu) is smallest!.\n", (unsigned long long)rdev->size); + } + } else + printk(" nope.\n"); +@@ -120,7 +123,8 @@ + + static int raid0_run (mddev_t *mddev) + { +- unsigned long cur=0, i=0, size, zone0_size, nb_zone; ++ unsigned long cur=0, i=0, zone0_size, nb_zone; ++ sector_t size; + raid0_conf_t *conf; + + MOD_INC_USE_COUNT; +@@ -138,13 +142,18 @@ + if (create_strip_zones (mddev)) + goto out_free_conf; + +- printk("raid0 : md_size is %d blocks.\n", md_size[mdidx(mddev)]); ++ printk("raid0 : md_size is %llu blocks.\n", (unsigned long long)md_size[mdidx(mddev)]); + printk("raid0 : conf->smallest->size is %ld blocks.\n", conf->smallest->size); +- nb_zone = md_size[mdidx(mddev)]/conf->smallest->size + +- (md_size[mdidx(mddev)] % conf->smallest->size ? 1 : 0); +- printk("raid0 : nb_zone is %ld.\n", nb_zone); +- conf->nr_zones = nb_zone; + ++ { ++#if __GNUC__ < 3 /* work around bug in gcc 2.9[56] */ ++ volatile ++#endif ++ sector_t sz = md_size[mdidx(mddev)]; ++ unsigned round = sector_div(sz, conf->smallest->size); ++ conf->nr_zones = nb_zone = sz + (round != 0); ++ } ++ printk("raid0 : nb_zone is %ld.\n", nb_zone); + printk("raid0 : Allocating %ld bytes for hash.\n", + nb_zone*sizeof(struct raid0_hash)); + +diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c +--- a/drivers/md/raid1.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/md/raid1.c Thu Oct 31 09:20:21 2002 +@@ -441,8 +441,8 @@ + /* + * oops, read error: + */ +- printk(KERN_ERR "raid1: %s: rescheduling block %lu\n", +- partition_name(bh->b_dev), bh->b_blocknr); ++ printk(KERN_ERR "raid1: %s: rescheduling block %llu\n", ++ partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + raid1_reschedule_retry(r1_bh); + return; + } +@@ -1137,10 +1137,10 @@ + + + #define IO_ERROR KERN_ALERT \ +-"raid1: %s: unrecoverable I/O read error for block %lu\n" ++"raid1: %s: unrecoverable I/O read error for block %llu\n" + + #define REDIRECT_SECTOR KERN_ERR \ +-"raid1: %s: redirecting sector %lu to another mirror\n" ++"raid1: %s: redirecting sector %llu to another mirror\n" + + /* + * This is a kernel thread which: +@@ -1251,7 +1251,7 @@ + * as reconstruct is about to be aborted + */ + +- printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); ++ printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + md_done_sync(mddev, bh->b_size>>9, 0); + } + +@@ -1261,11 +1261,11 @@ + dev = bh->b_dev; + raid1_map (mddev, &bh->b_dev); + if (bh->b_dev == dev) { +- printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr); ++ printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + raid1_end_bh_io(r1_bh, 0); + } else { + printk (REDIRECT_SECTOR, +- partition_name(bh->b_dev), bh->b_blocknr); ++ partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr); + bh->b_rdev = bh->b_dev; + bh->b_rsector = bh->b_blocknr; + generic_make_request (r1_bh->cmd, bh); +diff -Nru a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c +--- a/drivers/message/i2o/i2o_block.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/message/i2o/i2o_block.c Thu Oct 31 09:20:25 2002 +@@ -125,7 +125,7 @@ + + static int i2ob_blksizes[MAX_I2OB<<4]; + static int i2ob_hardsizes[MAX_I2OB<<4]; +-static int i2ob_sizes[MAX_I2OB<<4]; ++static sector_t i2ob_sizes[MAX_I2OB<<4]; + static int i2ob_media_change_flag[MAX_I2OB]; + static u32 i2ob_max_sectors[MAX_I2OB<<4]; + +diff -Nru a/drivers/mtd/devices/blkmtd.c b/drivers/mtd/devices/blkmtd.c +--- a/drivers/mtd/devices/blkmtd.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/mtd/devices/blkmtd.c Thu Oct 31 09:20:21 2002 +@@ -167,7 +167,7 @@ + int sectornr, sectors, i; + struct kiobuf *iobuf; + kdev_t dev; +- unsigned long *blocks; ++ sector_t *blocks; + + if(!rawdevice) { + printk("blkmtd: readpage: PANIC file->private_data == NULL\n"); +@@ -227,7 +227,7 @@ + + /* Pre 2.4.4 doesn't have space for the block list in the kiobuf */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4) +- blocks = kmalloc(KIO_MAX_SECTORS * sizeof(unsigned long)); ++ blocks = kmalloc(KIO_MAX_SECTORS * sizeof(*blocks)); + if(blocks == NULL) { + printk("blkmtd: cant allocate iobuf blocks\n"); + free_kiovec(1, &iobuf); +diff -Nru a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c +--- a/drivers/mtd/mtdblock.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/mtd/mtdblock.c Thu Oct 31 09:20:25 2002 +@@ -57,7 +57,7 @@ + + static spinlock_t mtdblks_lock; + +-static int mtd_sizes[MAX_MTD_DEVICES]; ++static sector_t mtd_sizes[MAX_MTD_DEVICES]; + static int mtd_blksizes[MAX_MTD_DEVICES]; + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14) +diff -Nru a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c +--- a/drivers/scsi/3w-xxxx.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/3w-xxxx.c Thu Oct 31 09:20:25 2002 +@@ -2256,12 +2256,12 @@ + + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + if (disk->capacity >= 0x200000) { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + } + + dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_biosparam(): heads = %d, sectors = %d, cylinders = %d\n", heads, sectors, cylinders); +diff -Nru a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c +--- a/drivers/scsi/advansys.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/advansys.c Thu Oct 31 09:20:25 2002 +@@ -6219,7 +6219,7 @@ + ip[1] = 32; + } + } +- ip[2] = dp->capacity / (ip[0] * ip[1]); ++ ip[2] = (long)dp->capacity / (ip[0] * ip[1]); + ASC_DBG(1, "advansys_biosparam: end\n"); + return 0; + } +diff -Nru a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c +--- a/drivers/scsi/aha152x.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/aha152x.c Thu Oct 31 09:20:21 2002 +@@ -1848,7 +1848,7 @@ + /* try default translation */ + info_array[0] = 64; + info_array[1] = 32; +- info_array[2] = disk->capacity / (64 * 32); ++ info_array[2] = (long)disk->capacity / (64 * 32); + + /* for disks >1GB do some guessing */ + if (info_array[2] >= 1024) { +@@ -1863,7 +1863,7 @@ + " using extended translation.\n"); + info_array[0] = 255; + info_array[1] = 63; +- info_array[2] = disk->capacity / (255 * 63); ++ info_array[2] = (long)disk->capacity / (255 * 63); + } else { + printk(KERN_NOTICE + "aha152x: unable to verify geometry for disk with >1GB.\n" +diff -Nru a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c +--- a/drivers/scsi/aic7xxx_old.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/aic7xxx_old.c Thu Oct 31 09:20:25 2002 +@@ -11752,13 +11752,13 @@ + + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + if ((p->flags & AHC_EXTEND_TRANS_A) && (cylinders > 1024)) + { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + } + + geom[0] = heads; +diff -Nru a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c +--- a/drivers/scsi/atp870u.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/atp870u.c Thu Oct 31 09:20:25 2002 +@@ -2850,12 +2850,12 @@ + + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + if (cylinders > 1024) { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + } + ip[0] = heads; + ip[1] = sectors; +diff -Nru a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c +--- a/drivers/scsi/ibmmca.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/ibmmca.c Thu Oct 31 09:20:21 2002 +@@ -2386,15 +2386,15 @@ + { + info[0] = 64; + info[1] = 32; +- info[2] = disk->capacity / (info[0] * info[1]); ++ info[2] = (long)disk->capacity / (info[0] * info[1]); + if (info[2] >= 1024) { + info[0] = 128; + info[1] = 63; +- info[2] = disk->capacity / (info[0] * info[1]); ++ info[2] = (long)disk->capacity / (info[0] * info[1]); + if (info[2] >= 1024) { + info[0] = 255; + info[1] = 63; +- info[2] = disk->capacity / (info[0] * info[1]); ++ info[2] = (long)disk->capacity / (info[0] * info[1]); + if (info[2] >= 1024) + info[2] = 1023; + } +diff -Nru a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c +--- a/drivers/scsi/ide-scsi.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/ide-scsi.c Thu Oct 31 09:20:21 2002 +@@ -454,11 +454,11 @@ + /* + * idescsi_do_request is our request handling function. + */ +-static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, unsigned long block) ++static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block) + { + #if IDESCSI_DEBUG_LOG + printk (KERN_INFO "rq_status: %d, rq_dev: %u, cmd: %d, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->cmd,rq->errors); +- printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); ++ printk (KERN_INFO "sector: %llu, nr_sectors: %ld, current_nr_sectors: %ld\n",(unsigned long long)rq->sector,rq->nr_sectors,rq->current_nr_sectors); + #endif /* IDESCSI_DEBUG_LOG */ + + if (rq->cmd == IDESCSI_PC_RQ) { +diff -Nru a/drivers/scsi/imm.c b/drivers/scsi/imm.c +--- a/drivers/scsi/imm.c Thu Oct 31 09:20:26 2002 ++++ b/drivers/scsi/imm.c Thu Oct 31 09:20:26 2002 +@@ -1129,11 +1129,11 @@ + { + ip[0] = 0x40; + ip[1] = 0x20; +- ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); ++ ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); + if (ip[2] > 1024) { + ip[0] = 0xff; + ip[1] = 0x3f; +- ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); ++ ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); + } + return 0; + } +diff -Nru a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c +--- a/drivers/scsi/in2000.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/in2000.c Thu Oct 31 09:20:21 2002 +@@ -2174,17 +2174,17 @@ + if (iinfo[2] > 1024) { + iinfo[0] = 64; + iinfo[1] = 63; +- iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); ++ iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); + } + if (iinfo[2] > 1024) { + iinfo[0] = 128; + iinfo[1] = 63; +- iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); ++ iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); + } + if (iinfo[2] > 1024) { + iinfo[0] = 255; + iinfo[1] = 63; +- iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]); ++ iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]); + } + return 0; + } +diff -Nru a/drivers/scsi/ini9100u.c b/drivers/scsi/ini9100u.c +--- a/drivers/scsi/ini9100u.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/scsi/ini9100u.c Thu Oct 31 09:20:22 2002 +@@ -592,16 +592,16 @@ + if (pTcb->TCS_DrvHead) { + info_array[0] = pTcb->TCS_DrvHead; + info_array[1] = pTcb->TCS_DrvSector; +- info_array[2] = disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; ++ info_array[2] = (long)disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; + } else { + if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) { + info_array[0] = 255; + info_array[1] = 63; +- info_array[2] = disk->capacity / 255 / 63; ++ info_array[2] = (long)disk->capacity / 255 / 63; + } else { + info_array[0] = 64; + info_array[1] = 32; +- info_array[2] = disk->capacity >> 11; ++ info_array[2] = (long)disk->capacity >> 11; + } + } + +diff -Nru a/drivers/scsi/inia100.c b/drivers/scsi/inia100.c +--- a/drivers/scsi/inia100.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/inia100.c Thu Oct 31 09:20:25 2002 +@@ -701,16 +701,16 @@ + if (pTcb->TCS_DrvHead) { + info_array[0] = pTcb->TCS_DrvHead; + info_array[1] = pTcb->TCS_DrvSector; +- info_array[2] = disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; ++ info_array[2] = (long)disk->capacity / pTcb->TCS_DrvHead / pTcb->TCS_DrvSector; + } else { + if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) { + info_array[0] = 255; + info_array[1] = 63; +- info_array[2] = disk->capacity / 255 / 63; ++ info_array[2] = (long)disk->capacity / 255 / 63; + } else { + info_array[0] = 64; + info_array[1] = 32; +- info_array[2] = disk->capacity >> 11; ++ info_array[2] = (long)disk->capacity >> 11; + } + } + return 0; +diff -Nru a/drivers/scsi/ips.c b/drivers/scsi/ips.c +--- a/drivers/scsi/ips.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/ips.c Thu Oct 31 09:20:21 2002 +@@ -1870,7 +1870,7 @@ + sectors = IPS_COMP_SECTORS; + } + +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + DEBUG_VAR(2, "Geometry: heads: %d, sectors: %d, cylinders: %d", + heads, sectors, cylinders); +diff -Nru a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c +--- a/drivers/scsi/megaraid.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/megaraid.c Thu Oct 31 09:20:21 2002 +@@ -4236,13 +4236,13 @@ + /* Default heads (64) & sectors (32) */ + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + /* Handle extended translation size for logical drives > 1Gb */ + if (disk->capacity >= 0x200000) { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + } + + /* return result */ +@@ -4260,13 +4260,13 @@ + /* Default heads (64) & sectors (32) */ + heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + + /* Handle extended translation size for logical drives > 1Gb */ + if (disk->capacity >= 0x200000) { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + } + + /* return result */ +diff -Nru a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c +--- a/drivers/scsi/ppa.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/ppa.c Thu Oct 31 09:20:21 2002 +@@ -1004,11 +1004,11 @@ + { + ip[0] = 0x40; + ip[1] = 0x20; +- ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); ++ ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); + if (ip[2] > 1024) { + ip[0] = 0xff; + ip[1] = 0x3f; +- ip[2] = (disk->capacity + 1) / (ip[0] * ip[1]); ++ ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]); + if (ip[2] > 1023) + ip[2] = 1023; + } +diff -Nru a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c +--- a/drivers/scsi/qla1280.c Thu Oct 31 09:20:26 2002 ++++ b/drivers/scsi/qla1280.c Thu Oct 31 09:20:26 2002 +@@ -1483,14 +1483,14 @@ + { + int heads, sectors, cylinders; + +- heads = 64; ++ heads = 64; + sectors = 32; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + if (cylinders > 1024) + { + heads = 255; + sectors = 63; +- cylinders = disk->capacity / (heads * sectors); ++ cylinders = (long)disk->capacity / (heads * sectors); + /* if (cylinders > 1023) + cylinders = 1023; */ + } +diff -Nru a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c +--- a/drivers/scsi/qlogicfas.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/qlogicfas.c Thu Oct 31 09:20:25 2002 +@@ -653,11 +653,11 @@ + /* This should mimic the DOS Qlogic driver's behavior exactly */ + ip[0] = 0x40; + ip[1] = 0x20; +- ip[2] = disk->capacity / (ip[0] * ip[1]); ++ ip[2] = (long)disk->capacity / (ip[0] * ip[1]); + if (ip[2] > 1024) { + ip[0] = 0xff; + ip[1] = 0x3f; +- ip[2] = disk->capacity / (ip[0] * ip[1]); ++ ip[2] = (long)disk->capacity / (ip[0] * ip[1]); + #if 0 + if (ip[2] > 1023) + ip[2] = 1023; +diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c +--- a/drivers/scsi/scsi.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/scsi.c Thu Oct 31 09:20:25 2002 +@@ -2477,7 +2477,7 @@ + for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { + for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->next) { + /* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */ +- printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4ld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", ++ printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4lld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", + i++, + + SCpnt->host->host_no, +@@ -2486,7 +2486,7 @@ + SCpnt->lun, + + kdevname(SCpnt->request.rq_dev), +- SCpnt->request.sector, ++ (unsigned long long)SCpnt->request.sector, + SCpnt->request.nr_sectors, + SCpnt->request.current_nr_sectors, + SCpnt->request.rq_status, +diff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c +--- a/drivers/scsi/scsi_lib.c Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/scsi_lib.c Thu Oct 31 09:20:25 2002 +@@ -371,8 +371,8 @@ + req = &SCpnt->request; + req->errors = 0; + if (!uptodate) { +- printk(" I/O error: dev %s, sector %lu\n", +- kdevname(req->rq_dev), req->sector); ++ printk(" I/O error: dev %s, sector %llu\n", ++ kdevname(req->rq_dev), (unsigned long long)req->sector); + } + do { + if ((bh = req->bh) != NULL) { +diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c +--- a/drivers/scsi/sd.c Thu Oct 31 09:20:21 2002 ++++ b/drivers/scsi/sd.c Thu Oct 31 09:20:22 2002 +@@ -91,7 +91,7 @@ + + static Scsi_Disk *rscsi_disks; + static struct gendisk *sd_gendisks; +-static int *sd_sizes; ++static sector_t *sd_sizes; + static int *sd_blocksizes; + static int *sd_hardsizes; /* Hardware sector size */ + static int *sd_max_sectors; +@@ -218,7 +218,7 @@ + + diskinfo[0] = 0x40; + diskinfo[1] = 0x20; +- diskinfo[2] = rscsi_disks[DEVICE_NR(dev)].capacity >> 11; ++ diskinfo[2] = (int)rscsi_disks[DEVICE_NR(dev)].capacity >> 11; + + /* override with calculated, extended default, or driver values */ + +@@ -294,7 +294,8 @@ + + static int sd_init_command(Scsi_Cmnd * SCpnt) + { +- int dev, block, this_count; ++ int dev, this_count; ++ sector_t block; + struct hd_struct *ppnt; + Scsi_Disk *dpnt; + #if CONFIG_SCSI_LOGGING +@@ -603,7 +604,7 @@ + int this_count = SCpnt->bufflen >> 9; + int good_sectors = (result == 0 ? this_count : 0); + int block_sectors = 1; +- long error_sector; ++ sector_t error_sector; + + SCSI_LOG_HLCOMPLETE(1, sd_devname(DEVICE_NR(SCpnt->request.rq_dev), nbuff)); + +@@ -624,7 +625,7 @@ + SCpnt->sense_buffer[0] == 0xF0) { /* Sense data is valid */ + switch (SCpnt->sense_buffer[2]) { + case MEDIUM_ERROR: +- error_sector = (SCpnt->sense_buffer[3] << 24) | ++ error_sector = ((sector_t)SCpnt->sense_buffer[3] << 24) | + (SCpnt->sense_buffer[4] << 16) | + (SCpnt->sense_buffer[5] << 8) | + SCpnt->sense_buffer[6]; +@@ -953,7 +954,7 @@ + */ + rscsi_disks[i].ready = 1; + +- rscsi_disks[i].capacity = 1 + ((buffer[0] << 24) | ++ rscsi_disks[i].capacity = 1 + (((sector_t)buffer[0] << 24) | + (buffer[1] << 16) | + (buffer[2] << 8) | + buffer[3]); +@@ -1001,27 +1002,35 @@ + */ + int m; + int hard_sector = sector_size; +- int sz = rscsi_disks[i].capacity * (hard_sector/256); ++ sector_t sz = rscsi_disks[i].capacity * (hard_sector/256); ++ sector_t mb = sz >>= 1; ++ sector_div(sz, 1250); ++ mb -= sz - 974; ++ ++ sector_div(mb, 1950); + + /* There are 16 minors allocated for each major device */ + for (m = i << 4; m < ((i + 1) << 4); m++) { + sd_hardsizes[m] = hard_sector; + } + ++ { ++ ++ } + printk("SCSI device %s: " +- "%d %d-byte hdwr sectors (%d MB)\n", +- nbuff, rscsi_disks[i].capacity, +- hard_sector, (sz/2 - sz/1250 + 974)/1950); ++ "%llu %d-byte hdwr sectors (%llu MB)\n", ++ nbuff, (unsigned long long)rscsi_disks[i].capacity, ++ hard_sector, (unsigned long long)mb); + } + + /* Rescale capacity to 512-byte units */ + if (sector_size == 4096) + rscsi_disks[i].capacity <<= 3; +- if (sector_size == 2048) ++ else if (sector_size == 2048) + rscsi_disks[i].capacity <<= 2; +- if (sector_size == 1024) ++ else if (sector_size == 1024) + rscsi_disks[i].capacity <<= 1; +- if (sector_size == 256) ++ else if (sector_size == 256) + rscsi_disks[i].capacity >>= 1; + } + +@@ -1123,20 +1132,20 @@ + memset(rscsi_disks, 0, sd_template.dev_max * sizeof(Scsi_Disk)); + + /* for every (necessary) major: */ +- sd_sizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); ++ sd_sizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_sizes), GFP_ATOMIC); + if (!sd_sizes) + goto cleanup_disks; +- memset(sd_sizes, 0, (sd_template.dev_max << 4) * sizeof(int)); ++ memset(sd_sizes, 0, (sd_template.dev_max << 4) * sizeof(*sd_sizes)); + +- sd_blocksizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); ++ sd_blocksizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_blocksizes), GFP_ATOMIC); + if (!sd_blocksizes) + goto cleanup_sizes; +- +- sd_hardsizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); ++ ++ sd_hardsizes = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_hardsizes), GFP_ATOMIC); + if (!sd_hardsizes) + goto cleanup_blocksizes; + +- sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC); ++ sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_max_sectors), GFP_ATOMIC); + if (!sd_max_sectors) + goto cleanup_max_sectors; + +diff -Nru a/drivers/scsi/sd.h b/drivers/scsi/sd.h +--- a/drivers/scsi/sd.h Thu Oct 31 09:20:25 2002 ++++ b/drivers/scsi/sd.h Thu Oct 31 09:20:25 2002 +@@ -24,7 +24,7 @@ + #endif + + typedef struct scsi_disk { +- unsigned capacity; /* size in blocks */ ++ sector_t capacity; /* size in blocks */ + Scsi_Device *device; + unsigned char ready; /* flag ready for FLOPTICAL */ + unsigned char write_prot; /* flag write_protect for rmvable dev */ +diff -Nru a/drivers/scsi/sr.c b/drivers/scsi/sr.c +--- a/drivers/scsi/sr.c Thu Oct 31 09:20:22 2002 ++++ b/drivers/scsi/sr.c Thu Oct 31 09:20:22 2002 +@@ -85,7 +85,7 @@ + }; + + Scsi_CD *scsi_CDs; +-static int *sr_sizes; ++static sector_t *sr_sizes; + + static int *sr_blocksizes; + static int *sr_hardsizes; +@@ -198,7 +198,7 @@ + int good_sectors = (result == 0 ? this_count : 0); + int block_sectors = 0; + int device_nr = DEVICE_NR(SCpnt->request.rq_dev); +- long error_sector; ++ sector_t error_sector; + + #ifdef DEBUG + printk("sr.c done: %x %p\n", result, SCpnt->request.bh->b_data); +@@ -216,7 +216,7 @@ + case MEDIUM_ERROR: + case VOLUME_OVERFLOW: + case ILLEGAL_REQUEST: +- error_sector = (SCpnt->sense_buffer[3] << 24) | ++ error_sector = ((sector_t)SCpnt->sense_buffer[3] << 24) | + (SCpnt->sense_buffer[4] << 16) | + (SCpnt->sense_buffer[5] << 8) | + SCpnt->sense_buffer[6]; +@@ -293,7 +293,7 @@ + /* + * need front pad + */ +- if ((fsize = SCpnt->request.sector % (s_size >> 9))) { ++ if ((fsize = (unsigned long)SCpnt->request.sector % (s_size >> 9))) { + fsize <<= 9; + sg_ent++; + if ((front = scsi_malloc(fsize)) == NULL) +@@ -425,12 +425,12 @@ + return 0; + } + +- block = SCpnt->request.sector / (s_size >> 9); ++ block = (long)SCpnt->request.sector / (s_size >> 9); + + /* + * request doesn't start on hw block boundary, add scatter pads + */ +- if ((SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) ++ if (((long)SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) + if (sr_scatter_pad(SCpnt, s_size)) + return 0; + +@@ -824,16 +824,16 @@ + goto cleanup_devfs; + memset(scsi_CDs, 0, sr_template.dev_max * sizeof(Scsi_CD)); + +- sr_sizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); ++ sr_sizes = kmalloc(sr_template.dev_max * sizeof(sr_sizes[0]), GFP_ATOMIC); + if (!sr_sizes) + goto cleanup_cds; +- memset(sr_sizes, 0, sr_template.dev_max * sizeof(int)); ++ memset(sr_sizes, 0, sr_template.dev_max * sizeof(sr_sizes[0])); + +- sr_blocksizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); ++ sr_blocksizes = kmalloc(sr_template.dev_max * sizeof(sr_blocksizes[0]), GFP_ATOMIC); + if (!sr_blocksizes) + goto cleanup_sizes; + +- sr_hardsizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC); ++ sr_hardsizes = kmalloc(sr_template.dev_max * sizeof(sr_hardsizes[0]), GFP_ATOMIC); + if (!sr_hardsizes) + goto cleanup_blocksizes; + /* +diff -Nru a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c +--- a/drivers/scsi/wd7000.c Thu Oct 31 09:20:26 2002 ++++ b/drivers/scsi/wd7000.c Thu Oct 31 09:20:26 2002 +@@ -1739,7 +1739,7 @@ + */ + ip[0] = 64; + ip[1] = 32; +- ip[2] = disk->capacity / (64 * 32); ++ ip[2] = (long)disk->capacity / (64 * 32); + + /* + * for disks >1GB do some guessing +@@ -1758,7 +1758,7 @@ + + ip[0] = 255; + ip[1] = 63; +- ip[2] = disk->capacity / (255 * 63); ++ ip[2] = (long)disk->capacity / (255 * 63); + } + else { + ip[0] = info[0]; +diff -Nru a/fs/adfs/adfs.h b/fs/adfs/adfs.h +--- a/fs/adfs/adfs.h Thu Oct 31 09:20:25 2002 ++++ b/fs/adfs/adfs.h Thu Oct 31 09:20:25 2002 +@@ -66,7 +66,7 @@ + + /* Inode stuff */ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) +-int adfs_get_block(struct inode *inode, long block, ++int adfs_get_block(struct inode *inode, sector_t block, + struct buffer_head *bh, int create); + #else + int adfs_bmap(struct inode *inode, int block); +diff -Nru a/fs/adfs/inode.c b/fs/adfs/inode.c +--- a/fs/adfs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/adfs/inode.c Thu Oct 31 09:20:25 2002 +@@ -27,7 +27,7 @@ + * not support creation of new blocks, so we return -EIO for this case. + */ + int +-adfs_get_block(struct inode *inode, long block, struct buffer_head *bh, int create) ++adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh, int create) + { + if (block < 0) + goto abort_negative; +@@ -71,7 +71,7 @@ + &page->mapping->host->u.adfs_i.mmu_private); + } + +-static int _adfs_bmap(struct address_space *mapping, long block) ++static sector_t _adfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping, block, adfs_get_block); + } +diff -Nru a/fs/affs/file.c b/fs/affs/file.c +--- a/fs/affs/file.c Thu Oct 31 09:20:25 2002 ++++ b/fs/affs/file.c Thu Oct 31 09:20:25 2002 +@@ -38,7 +38,7 @@ + static struct buffer_head *affs_alloc_extblock(struct inode *inode, struct buffer_head *bh, u32 ext); + static inline struct buffer_head *affs_get_extblock(struct inode *inode, u32 ext); + static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext); +-static int affs_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create); ++static int affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create); + + static ssize_t affs_file_write(struct file *filp, const char *buf, size_t count, loff_t *ppos); + static int affs_file_open(struct inode *inode, struct file *filp); +@@ -332,17 +332,21 @@ + } + + static int +-affs_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create) ++affs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + struct super_block *sb = inode->i_sb; + struct buffer_head *ext_bh; ++ long block = iblock; + u32 ext; + +- pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, block); ++ pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, (long)block); + + if (block < 0) + goto err_small; + ++ if (unlikely(iblock != block)) ++ goto err_big; ++ + if (block >= AFFS_INODE->i_blkcnt) { + if (block > AFFS_INODE->i_blkcnt || !create) + goto err_big; +@@ -423,7 +427,7 @@ + return cont_prepare_write(page, from, to, affs_get_block, + &page->mapping->host->u.affs_i.mmu_private); + } +-static int _affs_bmap(struct address_space *mapping, long block) ++static sector_t _affs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,affs_get_block); + } +diff -Nru a/fs/affs/super.c b/fs/affs/super.c +--- a/fs/affs/super.c Thu Oct 31 09:20:25 2002 ++++ b/fs/affs/super.c Thu Oct 31 09:20:25 2002 +@@ -29,7 +29,6 @@ + #include + #include + +-extern int *blk_size[]; + extern struct timezone sys_tz; + + static int affs_statfs(struct super_block *sb, struct statfs *buf); +diff -Nru a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c +--- a/fs/befs/linuxvfs.c Thu Oct 31 09:20:25 2002 ++++ b/fs/befs/linuxvfs.c Thu Oct 31 09:20:25 2002 +@@ -27,9 +27,9 @@ + #define VFS_BLOCK_SIZE 512 + + static int befs_readdir(struct file *, void *, filldir_t); +-static int befs_get_block(struct inode *, long, struct buffer_head *, int); ++static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int); + static int befs_readpage(struct file *file, struct page *page); +-static int befs_bmap(struct address_space *mapping, long block); ++static sector_t befs_bmap(struct address_space *mapping, sector_t block); + static struct dentry *befs_lookup(struct inode *, struct dentry *); + static void befs_read_inode(struct inode *ino); + static void befs_clear_inode(struct inode *ino); +@@ -97,8 +97,8 @@ + return block_read_full_page(page, befs_get_block); + } + +-static int +-befs_bmap(struct address_space *mapping, long block) ++static sector_t ++befs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping, block, befs_get_block); + } +@@ -115,7 +115,7 @@ + */ + + static int +-befs_get_block(struct inode *inode, long block, ++befs_get_block(struct inode *inode, sector_t sect, + struct buffer_head *bh_result, int create) + { + struct super_block *sb = inode->i_sb; +@@ -123,6 +123,7 @@ + befs_block_run run = BAD_IADDR; + int res = 0; + ulong disk_off; ++ long block = (unsigned long)sect; + + befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", + inode->i_ino, block); +diff -Nru a/fs/bfs/file.c b/fs/bfs/file.c +--- a/fs/bfs/file.c Thu Oct 31 09:20:21 2002 ++++ b/fs/bfs/file.c Thu Oct 31 09:20:21 2002 +@@ -54,7 +54,7 @@ + return 0; + } + +-static int bfs_get_block(struct inode * inode, long block, ++static int bfs_get_block(struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) + { + long phys; +@@ -151,7 +151,7 @@ + return block_prepare_write(page, from, to, bfs_get_block); + } + +-static int bfs_bmap(struct address_space *mapping, long block) ++static sector_t bfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping, block, bfs_get_block); + } +diff -Nru a/fs/block_dev.c b/fs/block_dev.c +--- a/fs/block_dev.c Thu Oct 31 09:20:25 2002 ++++ b/fs/block_dev.c Thu Oct 31 09:20:25 2002 +@@ -22,14 +22,14 @@ + + #include + +-static unsigned long max_block(kdev_t dev) ++static sector_t max_block(kdev_t dev) + { +- unsigned int retval = ~0U; ++ sector_t retval = ~0; + int major = MAJOR(dev); + + if (blk_size[major]) { + int minor = MINOR(dev); +- unsigned int blocks = blk_size[major][minor]; ++ sector_t blocks = blk_size[major][minor]; + if (blocks) { + unsigned int size = block_size(dev); + unsigned int sizebits = blksize_bits(size); +@@ -44,7 +44,7 @@ + + static loff_t blkdev_size(kdev_t dev) + { +- unsigned int blocks = ~0U; ++ sector_t blocks = ~0; + int major = MAJOR(dev); + + if (blk_size[major]) { +@@ -120,7 +120,7 @@ + return sb_set_blocksize(sb, size); + } + +-static int blkdev_get_block(struct inode * inode, long iblock, struct buffer_head * bh, int create) ++static int blkdev_get_block(struct inode * inode, sector_t iblock, struct buffer_head * bh, int create) + { + if (iblock >= max_block(inode->i_rdev)) + return -EIO; +@@ -131,7 +131,7 @@ + return 0; + } + +-static int blkdev_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize) ++static int blkdev_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, sector_t blocknr, int blocksize) + { + return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, blkdev_get_block); + } +diff -Nru a/fs/buffer.c b/fs/buffer.c +--- a/fs/buffer.c Thu Oct 31 09:20:25 2002 ++++ b/fs/buffer.c Thu Oct 31 09:20:25 2002 +@@ -558,7 +558,7 @@ + spin_unlock(&lru_list_lock); + } + +-struct buffer_head * get_hash_table(kdev_t dev, int block, int size) ++struct buffer_head * get_hash_table(kdev_t dev, sector_t block, int size) + { + struct buffer_head *bh, **p = &hash(dev, block); + +@@ -947,7 +947,7 @@ + * 14.02.92: changed it to sync dirty buffers a bit: better performance + * when the filesystem starts to get full of dirty blocks (I hope). + */ +-struct buffer_head * getblk(kdev_t dev, int block, int size) ++struct buffer_head * getblk(kdev_t dev, sector_t block, int size) + { + for (;;) { + struct buffer_head * bh; +@@ -1114,7 +1114,7 @@ + * Reads a specified block, and returns buffer head that + * contains it. It returns NULL if the block was unreadable. + */ +-struct buffer_head * bread(kdev_t dev, int block, int size) ++struct buffer_head * bread(kdev_t dev, sector_t block, int size) + { + struct buffer_head * bh; + +@@ -1546,7 +1546,7 @@ + unsigned from, unsigned to, get_block_t *get_block) + { + unsigned block_start, block_end; +- unsigned long block; ++ sector_t block; + int err = 0; + unsigned blocksize, bbits; + struct buffer_head *bh, *head, *wait[2], **wait_bh=wait; +@@ -1558,7 +1558,7 @@ + head = page->buffers; + + bbits = inode->i_blkbits; +- block = page->index << (PAGE_CACHE_SHIFT - bbits); ++ block = (sector_t)page->index << (PAGE_CACHE_SHIFT - bbits); + + for(bh = head, block_start = 0; bh != head || !block_start; + block++, block_start=block_end, bh = bh->b_this_page) { +@@ -1686,7 +1686,7 @@ + int block_read_full_page(struct page *page, get_block_t *get_block) + { + struct inode *inode = page->mapping->host; +- unsigned long iblock, lblock; ++ sector_t iblock, lblock; + struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE]; + unsigned int blocksize, blocks; + int nr, i; +@@ -1699,7 +1699,7 @@ + head = page->buffers; + + blocks = PAGE_CACHE_SIZE >> inode->i_blkbits; +- iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); ++ iblock = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); + lblock = (inode->i_size+blocksize-1) >> inode->i_blkbits; + bh = head; + nr = 0; +@@ -2081,7 +2081,7 @@ + } + EXPORT_SYMBOL(waitfor_one_page); + +-int generic_block_bmap(struct address_space *mapping, long block, get_block_t *get_block) ++sector_t generic_block_bmap(struct address_space *mapping, sector_t block, get_block_t *get_block) + { + struct buffer_head tmp; + struct inode *inode = mapping->host; +@@ -2091,10 +2091,12 @@ + return tmp.b_blocknr; + } + +-int generic_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize, get_block_t * get_block) ++int generic_direct_IO(int rw, struct inode * inode, ++ struct kiobuf * iobuf, sector_t blocknr, ++ int blocksize, get_block_t * get_block) + { + int i, nr_blocks, retval; +- unsigned long * blocks = iobuf->blocks; ++ sector_t *blocks = iobuf->blocks; + int length; + + length = iobuf->length; +@@ -2122,7 +2124,7 @@ + BUG(); + if (!buffer_mapped(&bh)) { + /* there was an hole in the filesystem */ +- blocks[i] = -1UL; ++ blocks[i] = ~(sector_t)0; + continue; + } + } else { +@@ -2207,7 +2209,7 @@ + */ + + int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], +- kdev_t dev, unsigned long b[], int size) ++ kdev_t dev, sector_t b[], int size) + { + int err; + int length; +@@ -2217,7 +2219,7 @@ + int pageind; + int bhind; + int offset; +- unsigned long blocknr; ++ sector_t blocknr; + struct kiobuf * iobuf = NULL; + struct page * map; + struct buffer_head *tmp, **bhs = NULL; +@@ -2342,7 +2344,7 @@ + * FIXME: we need a swapper_inode->get_block function to remove + * some of the bmap kludges and interface ugliness here. + */ +-int brw_page(int rw, struct page *page, kdev_t dev, int b[], int size) ++int brw_page(int rw, struct page *page, kdev_t dev, sector_t b[], int size) + { + struct buffer_head *head, *bh; + +diff -Nru a/fs/efs/file.c b/fs/efs/file.c +--- a/fs/efs/file.c Thu Oct 31 09:20:25 2002 ++++ b/fs/efs/file.c Thu Oct 31 09:20:25 2002 +@@ -8,7 +8,7 @@ + + #include + +-int efs_get_block(struct inode *inode, long iblock, ++int efs_get_block(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create) + { + int error = -EROFS; +diff -Nru a/fs/efs/inode.c b/fs/efs/inode.c +--- a/fs/efs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/efs/inode.c Thu Oct 31 09:20:25 2002 +@@ -12,12 +12,12 @@ + #include + + +-extern int efs_get_block(struct inode *, long, struct buffer_head *, int); ++extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int); + static int efs_readpage(struct file *file, struct page *page) + { + return block_read_full_page(page,efs_get_block); + } +-static int _efs_bmap(struct address_space *mapping, long block) ++static sector_t _efs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,efs_get_block); + } +diff -Nru a/fs/ext2/inode.c b/fs/ext2/inode.c +--- a/fs/ext2/inode.c Thu Oct 31 09:20:21 2002 ++++ b/fs/ext2/inode.c Thu Oct 31 09:20:21 2002 +@@ -496,7 +496,7 @@ + * reachable from inode. + */ + +-static int ext2_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) ++static int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + int err = -EIO; + int offsets[4]; +@@ -579,11 +579,12 @@ + { + return block_prepare_write(page,from,to,ext2_get_block); + } +-static int ext2_bmap(struct address_space *mapping, long block) ++static sector_t ext2_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,ext2_get_block); + } +-static int ext2_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize) ++static int ext2_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, ++ sector_t blocknr, int blocksize) + { + return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, ext2_get_block); + } +diff -Nru a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c +--- a/fs/ext3/ialloc.c Thu Oct 31 09:20:25 2002 ++++ b/fs/ext3/ialloc.c Thu Oct 31 09:20:25 2002 +@@ -564,8 +564,8 @@ + is_bad_inode(inode) || NEXT_ORPHAN(inode) > max_ino) { + ext3_warning(sb, __FUNCTION__, + "bad orphan inode %ld! e2fsck was run?\n", ino); +- printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%ld) = %d\n", +- bit, bh->b_blocknr, ext3_test_bit(bit, bh->b_data)); ++ printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", ++ bit, (unsigned long long)bh->b_blocknr, ext3_test_bit(bit, bh->b_data)); + printk(KERN_NOTICE "inode=%p\n", inode); + if (inode) { + printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", +diff -Nru a/fs/ext3/inode.c b/fs/ext3/inode.c +--- a/fs/ext3/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/ext3/inode.c Thu Oct 31 09:20:25 2002 +@@ -825,7 +825,7 @@ + /* + * The BKL is not held on entry here. + */ +-static int ext3_get_block(struct inode *inode, long iblock, ++static int ext3_get_block(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create) + { + handle_t *handle = 0; +@@ -1165,7 +1165,7 @@ + * So, if we see any bmap calls here on a modified, data-journaled file, + * take extra steps to flush any blocks which might be in the cache. + */ +-static int ext3_bmap(struct address_space *mapping, long block) ++static sector_t ext3_bmap(struct address_space *mapping, sector_t block) + { + struct inode *inode = mapping->host; + journal_t *journal; +diff -Nru a/fs/fat/file.c b/fs/fat/file.c +--- a/fs/fat/file.c Thu Oct 31 09:20:22 2002 ++++ b/fs/fat/file.c Thu Oct 31 09:20:22 2002 +@@ -48,11 +48,13 @@ + } + + +-int fat_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) ++int fat_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + struct super_block *sb = inode->i_sb; + unsigned long phys; + ++ BUG_ON(sizeof(iblock) > 4 && (iblock>>32)); ++ + phys = fat_bmap(inode, iblock); + if (phys) { + bh_result->b_dev = inode->i_dev; +@@ -66,7 +68,7 @@ + BUG(); + return -EIO; + } +- if (!(iblock % MSDOS_SB(inode->i_sb)->cluster_size)) { ++ if (!((unsigned long)iblock % MSDOS_SB(inode->i_sb)->cluster_size)) { + if (fat_add_cluster(inode) < 0) + return -ENOSPC; + } +diff -Nru a/fs/fat/inode.c b/fs/fat/inode.c +--- a/fs/fat/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/fat/inode.c Thu Oct 31 09:20:25 2002 +@@ -869,7 +869,7 @@ + return cont_prepare_write(page,from,to,fat_get_block, + &MSDOS_I(page->mapping->host)->mmu_private); + } +-static int _fat_bmap(struct address_space *mapping, long block) ++static sector_t _fat_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,fat_get_block); + } +diff -Nru a/fs/fat/misc.c b/fs/fat/misc.c +--- a/fs/fat/misc.c Thu Oct 31 09:20:25 2002 ++++ b/fs/fat/misc.c Thu Oct 31 09:20:25 2002 +@@ -182,10 +182,10 @@ + mark_inode_dirty(inode); + } + if (file_cluster +- != inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) { ++ != (long)inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) { + printk ("file_cluster badly computed!!! %d <> %ld\n", + file_cluster, +- inode->i_blocks / cluster_size / (sb->s_blocksize / 512)); ++ (long)inode->i_blocks / cluster_size / (sb->s_blocksize / 512)); + fat_cache_inval_inode(inode); + } + inode->i_blocks += (1 << MSDOS_SB(sb)->cluster_bits) / 512; +diff -Nru a/fs/freevxfs/vxfs_kcompat.h b/fs/freevxfs/vxfs_kcompat.h +--- a/fs/freevxfs/vxfs_kcompat.h Thu Oct 31 09:20:22 2002 ++++ b/fs/freevxfs/vxfs_kcompat.h Thu Oct 31 09:20:22 2002 +@@ -7,10 +7,8 @@ + + #include + +-typedef long sector_t; +- + /* Dito. */ +-static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) ++static inline void map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block) + { + bh->b_state |= 1 << BH_Mapped; + bh->b_dev = sb->s_dev; +diff -Nru a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c +--- a/fs/freevxfs/vxfs_subr.c Thu Oct 31 09:20:25 2002 ++++ b/fs/freevxfs/vxfs_subr.c Thu Oct 31 09:20:25 2002 +@@ -42,7 +42,7 @@ + + + static int vxfs_readpage(struct file *, struct page *); +-static int vxfs_bmap(struct address_space *, long); ++static sector_t vxfs_bmap(struct address_space *, sector_t); + + struct address_space_operations vxfs_aops = { + .readpage = vxfs_readpage, +@@ -185,8 +185,8 @@ + * Locking status: + * We are under the bkl. + */ +-static int +-vxfs_bmap(struct address_space *mapping, long block) ++static sector_t ++vxfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping, block, vxfs_getblk); + } +diff -Nru a/fs/hfs/file.c b/fs/hfs/file.c +--- a/fs/hfs/file.c Thu Oct 31 09:20:25 2002 ++++ b/fs/hfs/file.c Thu Oct 31 09:20:25 2002 +@@ -106,7 +106,7 @@ + * block number. This function just calls hfs_extent_map() to do the + * real work and then stuffs the appropriate info into the buffer_head. + */ +-int hfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) ++int hfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + unsigned long phys; + +diff -Nru a/fs/hfs/hfs.h b/fs/hfs/hfs.h +--- a/fs/hfs/hfs.h Thu Oct 31 09:20:25 2002 ++++ b/fs/hfs/hfs.h Thu Oct 31 09:20:25 2002 +@@ -495,7 +495,7 @@ + extern void hfs_extent_free(struct hfs_fork *); + + /* file.c */ +-extern int hfs_get_block(struct inode *, long, struct buffer_head *, int); ++extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); + + /* mdb.c */ + extern struct hfs_mdb *hfs_mdb_get(hfs_sysmdb, int, hfs_s32); +diff -Nru a/fs/hfs/inode.c b/fs/hfs/inode.c +--- a/fs/hfs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/hfs/inode.c Thu Oct 31 09:20:25 2002 +@@ -235,7 +235,7 @@ + return cont_prepare_write(page,from,to,hfs_get_block, + &page->mapping->host->u.hfs_i.mmu_private); + } +-static int hfs_bmap(struct address_space *mapping, long block) ++static sector_t hfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,hfs_get_block); + } +diff -Nru a/fs/hpfs/file.c b/fs/hpfs/file.c +--- a/fs/hpfs/file.c Thu Oct 31 09:20:25 2002 ++++ b/fs/hpfs/file.c Thu Oct 31 09:20:25 2002 +@@ -68,7 +68,7 @@ + hpfs_write_inode(i); + } + +-int hpfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) ++int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + secno s; + s = hpfs_bmap(inode, iblock); +@@ -108,7 +108,7 @@ + return cont_prepare_write(page,from,to,hpfs_get_block, + &page->mapping->host->u.hpfs_i.mmu_private); + } +-static int _hpfs_bmap(struct address_space *mapping, long block) ++static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,hpfs_get_block); + } +diff -Nru a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h +--- a/fs/hpfs/hpfs_fn.h Thu Oct 31 09:20:25 2002 ++++ b/fs/hpfs/hpfs_fn.h Thu Oct 31 09:20:25 2002 +@@ -261,7 +261,7 @@ + int hpfs_file_fsync(struct file *, struct dentry *, int); + secno hpfs_bmap(struct inode *, unsigned); + void hpfs_truncate(struct inode *); +-int hpfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create); ++int hpfs_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create); + ssize_t hpfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos); + + /* inode.c */ +diff -Nru a/fs/inode.c b/fs/inode.c +--- a/fs/inode.c Thu Oct 31 09:20:26 2002 ++++ b/fs/inode.c Thu Oct 31 09:20:26 2002 +@@ -1112,9 +1112,9 @@ + * file. + */ + +-int bmap(struct inode * inode, int block) ++sector_t bmap(struct inode * inode, sector_t block) + { +- int res = 0; ++ sector_t res = 0; + if (inode->i_mapping->a_ops->bmap) + res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block); + return res; +diff -Nru a/fs/isofs/inode.c b/fs/isofs/inode.c +--- a/fs/isofs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/isofs/inode.c Thu Oct 31 09:20:25 2002 +@@ -976,7 +976,7 @@ + /* + * Used by the standard interfaces. + */ +-static int isofs_get_block(struct inode *inode, long iblock, ++static int isofs_get_block(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create) + { + if ( create ) { +@@ -984,10 +984,11 @@ + return -EROFS; + } + +- return isofs_get_blocks(inode, iblock, &bh_result, 1) ? 0 : -EIO; ++ BUG_ON(sizeof(iblock) > 4 && (iblock >> 32)); ++ return isofs_get_blocks(inode, (long)iblock, &bh_result, 1) ? 0 : -EIO; + } + +-static int isofs_bmap(struct inode *inode, int block) ++static int isofs_bmap(struct inode *inode, sector_t block) + { + struct buffer_head dummy; + int error; +@@ -1000,7 +1001,7 @@ + return 0; + } + +-struct buffer_head *isofs_bread(struct inode *inode, unsigned int block) ++struct buffer_head *isofs_bread(struct inode *inode, sector_t block) + { + unsigned int blknr = isofs_bmap(inode, block); + if (!blknr) +@@ -1013,7 +1014,7 @@ + return block_read_full_page(page,isofs_get_block); + } + +-static int _isofs_bmap(struct address_space *mapping, long block) ++static sector_t _isofs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,isofs_get_block); + } +diff -Nru a/fs/jbd/commit.c b/fs/jbd/commit.c +--- a/fs/jbd/commit.c Thu Oct 31 09:20:25 2002 ++++ b/fs/jbd/commit.c Thu Oct 31 09:20:25 2002 +@@ -359,8 +359,8 @@ + } + + bh = jh2bh(descriptor); +- jbd_debug(4, "JBD: got buffer %ld (%p)\n", +- bh->b_blocknr, bh->b_data); ++ jbd_debug(4, "JBD: got buffer %llu (%p)\n", ++ (unsigned long long)bh->b_blocknr, bh->b_data); + header = (journal_header_t *)&bh->b_data[0]; + header->h_magic = htonl(JFS_MAGIC_NUMBER); + header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK); +diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c +--- a/fs/jbd/journal.c Thu Oct 31 09:20:21 2002 ++++ b/fs/jbd/journal.c Thu Oct 31 09:20:21 2002 +@@ -1505,9 +1505,9 @@ + + if (buffer_dirty(bh)) { + printk ("%sUnexpected dirty buffer encountered at " +- "%s:%d (%s blocknr %lu)\n", ++ "%s:%d (%s blocknr %llu)\n", + KERN_WARNING, function, line, +- kdevname(bh->b_dev), bh->b_blocknr); ++ kdevname(bh->b_dev), (unsigned long long)bh->b_blocknr); + #ifdef JBD_PARANOID_WRITES + J_ASSERT_BH (bh, !buffer_dirty(bh)); + #endif +diff -Nru a/fs/jbd/revoke.c b/fs/jbd/revoke.c +--- a/fs/jbd/revoke.c Thu Oct 31 09:20:21 2002 ++++ b/fs/jbd/revoke.c Thu Oct 31 09:20:21 2002 +@@ -389,7 +389,7 @@ + record = find_revoke_record(journal, bh->b_blocknr); + if (record) { + jbd_debug(4, "cancelled existing revoke on " +- "blocknr %lu\n", bh->b_blocknr); ++ "blocknr %llu\n", (unsigned long long)bh->b_blocknr); + list_del(&record->hash); + kmem_cache_free(revoke_record_cache, record); + did_revoke = 1; +diff -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c +--- a/fs/jfs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/jfs/inode.c Thu Oct 31 09:20:25 2002 +@@ -195,7 +195,7 @@ + set_cflag(COMMIT_Dirty, inode); + } + +-static int jfs_get_block(struct inode *ip, long lblock, ++static int jfs_get_block(struct inode *ip, sector_t lblock, + struct buffer_head *bh_result, int create) + { + s64 lblock64 = lblock; +@@ -318,13 +318,13 @@ + return block_prepare_write(page, from, to, jfs_get_block); + } + +-static int jfs_bmap(struct address_space *mapping, long block) ++static sector_t jfs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping, block, jfs_get_block); + } + + static int jfs_direct_IO(int rw, struct inode *inode, struct kiobuf *iobuf, +- unsigned long blocknr, int blocksize) ++ sector_t blocknr, int blocksize) + { + return generic_direct_IO(rw, inode, iobuf, blocknr, + blocksize, jfs_get_block); +diff -Nru a/fs/minix/inode.c b/fs/minix/inode.c +--- a/fs/minix/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/minix/inode.c Thu Oct 31 09:20:25 2002 +@@ -292,7 +292,7 @@ + return 0; + } + +-static int minix_get_block(struct inode *inode, long block, ++static int minix_get_block(struct inode *inode, sector_t block, + struct buffer_head *bh_result, int create) + { + if (INODE_VERSION(inode) == MINIX_V1) +@@ -313,7 +313,7 @@ + { + return block_prepare_write(page,from,to,minix_get_block); + } +-static int minix_bmap(struct address_space *mapping, long block) ++static sector_t minix_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,minix_get_block); + } +diff -Nru a/fs/minix/itree_common.c b/fs/minix/itree_common.c +--- a/fs/minix/itree_common.c Thu Oct 31 09:20:25 2002 ++++ b/fs/minix/itree_common.c Thu Oct 31 09:20:25 2002 +@@ -140,7 +140,7 @@ + return -EAGAIN; + } + +-static inline int get_block(struct inode * inode, long block, ++static inline int get_block(struct inode * inode, sector_t block, + struct buffer_head *bh_result, int create) + { + int err = -EIO; +diff -Nru a/fs/partitions/acorn.c b/fs/partitions/acorn.c +--- a/fs/partitions/acorn.c Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/acorn.c Thu Oct 31 09:20:21 2002 +@@ -462,7 +462,7 @@ + * Returns: -1 on error, 0 if not ADFS format, 1 if ok. + */ + int acorn_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sect, int first_minor) ++ sector_t first_sect, int first_minor) + { + int i; + +diff -Nru a/fs/partitions/acorn.h b/fs/partitions/acorn.h +--- a/fs/partitions/acorn.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/acorn.h Thu Oct 31 09:20:25 2002 +@@ -51,5 +51,5 @@ + + + int acorn_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sect, int first_minor); ++ sector_t first_sect, int first_minor); + +diff -Nru a/fs/partitions/amiga.c b/fs/partitions/amiga.c +--- a/fs/partitions/amiga.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/amiga.c Thu Oct 31 09:20:25 2002 +@@ -32,7 +32,7 @@ + + int + amiga_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor) ++ sector_t first_sector, int first_part_minor) + { + Sector sect; + unsigned char *data; +diff -Nru a/fs/partitions/amiga.h b/fs/partitions/amiga.h +--- a/fs/partitions/amiga.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/amiga.h Thu Oct 31 09:20:25 2002 +@@ -4,5 +4,5 @@ + + int + amiga_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + +diff -Nru a/fs/partitions/atari.c b/fs/partitions/atari.c +--- a/fs/partitions/atari.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/atari.c Thu Oct 31 09:20:25 2002 +@@ -41,7 +41,7 @@ + } + + int atari_partition (struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int minor) ++ sector_t first_sector, int minor) + { + int m_lim = minor + hd->max_p; + Sector sect; +diff -Nru a/fs/partitions/atari.h b/fs/partitions/atari.h +--- a/fs/partitions/atari.h Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/atari.h Thu Oct 31 09:20:21 2002 +@@ -32,5 +32,5 @@ + } __attribute__((__packed__)); + + int atari_partition (struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + +diff -Nru a/fs/partitions/check.c b/fs/partitions/check.c +--- a/fs/partitions/check.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/check.c Thu Oct 31 09:20:25 2002 +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + #include "check.h" + +@@ -35,11 +36,10 @@ + #include "ultrix.h" + #include "efi.h" + +-extern int *blk_size[]; + + int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ + +-static int (*check_part[])(struct gendisk *hd, struct block_device *bdev, unsigned long first_sect, int first_minor) = { ++static int (*check_part[])(struct gendisk *hd, struct block_device *bdev, sector_t first_sect, int first_minor) = { + #ifdef CONFIG_ACORN_PARTITION + acorn_partition, + #endif +@@ -204,7 +204,7 @@ + /* + * Add a partitions details to the devices partition description. + */ +-void add_gd_partition(struct gendisk *hd, int minor, int start, int size) ++void add_gd_partition(struct gendisk *hd, int minor, sector_t start, sector_t size) + { + #ifndef CONFIG_DEVFS_FS + char buf[40]; +@@ -227,7 +227,7 @@ + { + devfs_handle_t de = NULL; + static int first_time = 1; +- unsigned long first_sector; ++ sector_t first_sector; + struct block_device *bdev; + char buf[64]; + int i; +@@ -374,14 +374,14 @@ + */ + + void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors, +- struct block_device_operations *ops, long size) ++ struct block_device_operations *ops, sector_t size) + { + if (!gdev) + return; + grok_partitions(gdev, MINOR(dev)>>gdev->minor_shift, minors, size); + } + +-void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size) ++void grok_partitions(struct gendisk *dev, int drive, unsigned minors, sector_t size) + { + int i; + int first_minor = drive << dev->minor_shift; +@@ -415,13 +415,12 @@ + } + } + +-unsigned char *read_dev_sector(struct block_device *bdev, unsigned long n, Sector *p) ++unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) + { + struct address_space *mapping = bdev->bd_inode->i_mapping; +- int sect = PAGE_CACHE_SIZE / 512; + struct page *page; + +- page = read_cache_page(mapping, n/sect, ++ page = read_cache_page(mapping, n >> (PAGE_CACHE_SHIFT-9), + (filler_t *)mapping->a_ops->readpage, NULL); + if (!IS_ERR(page)) { + wait_on_page(page); +@@ -430,7 +429,7 @@ + if (PageError(page)) + goto fail; + p->v = page; +- return (unsigned char *)page_address(page) + 512 * (n % sect); ++ return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9); + fail: + page_cache_release(page); + } +diff -Nru a/fs/partitions/check.h b/fs/partitions/check.h +--- a/fs/partitions/check.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/check.h Thu Oct 31 09:20:25 2002 +@@ -2,11 +2,11 @@ + * add_partition adds a partitions details to the devices partition + * description. + */ +-void add_gd_partition(struct gendisk *hd, int minor, int start, int size); ++void add_gd_partition(struct gendisk *hd, int minor, sector_t start, sector_t size); + + typedef struct {struct page *v;} Sector; + +-unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *); ++unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *); + + static inline void put_dev_sector(Sector p) + { +diff -Nru a/fs/partitions/efi.c b/fs/partitions/efi.c +--- a/fs/partitions/efi.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/efi.c Thu Oct 31 09:20:25 2002 +@@ -778,7 +778,7 @@ + */ + int + efi_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor) ++ sector_t first_sector, int first_part_minor) + { + + kdev_t dev = to_kdev_t(bdev->bd_dev); +diff -Nru a/fs/partitions/efi.h b/fs/partitions/efi.h +--- a/fs/partitions/efi.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/efi.h Thu Oct 31 09:20:25 2002 +@@ -110,6 +110,6 @@ + /* Functions */ + extern int + efi_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + + #endif +diff -Nru a/fs/partitions/ldm.c b/fs/partitions/ldm.c +--- a/fs/partitions/ldm.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/ldm.c Thu Oct 31 09:20:25 2002 +@@ -1480,7 +1480,7 @@ + * Or @bdev is a dynamic disk, but it may be corrupted + */ + int ldm_partition (struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_minor) ++ sector_t first_sector, int first_minor) + { + struct ldmdb *ldb; + unsigned long base; +diff -Nru a/fs/partitions/ldm.h b/fs/partitions/ldm.h +--- a/fs/partitions/ldm.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/ldm.h Thu Oct 31 09:20:25 2002 +@@ -215,7 +215,7 @@ + }; + + int ldm_partition (struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_minor); ++ sector_t first_sector, int first_minor); + + #endif /* _FS_PT_LDM_H_ */ + +diff -Nru a/fs/partitions/mac.c b/fs/partitions/mac.c +--- a/fs/partitions/mac.c Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/mac.c Thu Oct 31 09:20:21 2002 +@@ -25,7 +25,7 @@ + */ + + int mac_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long fsec, int first_part_minor) ++ sector_t fsec, int first_part_minor) + { + Sector sect; + unsigned char *data; +diff -Nru a/fs/partitions/mac.h b/fs/partitions/mac.h +--- a/fs/partitions/mac.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/mac.h Thu Oct 31 09:20:25 2002 +@@ -49,4 +49,4 @@ + /* ... more stuff */ + }; + +-int mac_partition(struct gendisk *hd, struct block_device *bdev, unsigned long fsec, int first_part_minor); ++int mac_partition(struct gendisk *hd, struct block_device *bdev, sector_t fsec, int first_part_minor); +diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c +--- a/fs/partitions/msdos.c Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/msdos.c Thu Oct 31 09:20:21 2002 +@@ -551,7 +551,7 @@ + } + + int msdos_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor) ++ sector_t first_sector, int first_part_minor) + { + int i, minor = first_part_minor; + Sector sect; +diff -Nru a/fs/partitions/msdos.h b/fs/partitions/msdos.h +--- a/fs/partitions/msdos.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/msdos.h Thu Oct 31 09:20:25 2002 +@@ -5,5 +5,5 @@ + #define MSDOS_LABEL_MAGIC 0xAA55 + + int msdos_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + +diff -Nru a/fs/partitions/osf.c b/fs/partitions/osf.c +--- a/fs/partitions/osf.c Thu Oct 31 09:20:22 2002 ++++ b/fs/partitions/osf.c Thu Oct 31 09:20:22 2002 +@@ -18,7 +18,7 @@ + #include "osf.h" + + int osf_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int current_minor) ++ sector_t first_sector, int current_minor) + { + int i; + Sector sect; +diff -Nru a/fs/partitions/osf.h b/fs/partitions/osf.h +--- a/fs/partitions/osf.h Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/osf.h Thu Oct 31 09:20:21 2002 +@@ -5,5 +5,5 @@ + #define DISKLABELMAGIC (0x82564557UL) + + int osf_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int current_minor); ++ sector_t first_sector, int current_minor); + +diff -Nru a/fs/partitions/sgi.c b/fs/partitions/sgi.c +--- a/fs/partitions/sgi.c Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/sgi.c Thu Oct 31 09:20:21 2002 +@@ -17,7 +17,7 @@ + #include "check.h" + #include "sgi.h" + +-int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long first_sector, int current_minor) ++int sgi_partition(struct gendisk *hd, struct block_device *bdev, sector_t first_sector, int current_minor) + { + int i, csum, magic; + unsigned int *ui, start, blocks, cs; +diff -Nru a/fs/partitions/sgi.h b/fs/partitions/sgi.h +--- a/fs/partitions/sgi.h Thu Oct 31 09:20:22 2002 ++++ b/fs/partitions/sgi.h Thu Oct 31 09:20:22 2002 +@@ -3,7 +3,7 @@ + */ + + extern int sgi_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + + #define SGI_LABEL_MAGIC 0x0be5a941 + +diff -Nru a/fs/partitions/sun.c b/fs/partitions/sun.c +--- a/fs/partitions/sun.c Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/sun.c Thu Oct 31 09:20:25 2002 +@@ -24,7 +24,7 @@ + extern void md_autodetect_dev(kdev_t dev); + #endif + +-int sun_partition(struct gendisk *hd, struct block_device *bdev, unsigned long first_sector, int first_part_minor) ++int sun_partition(struct gendisk *hd, struct block_device *bdev, sector_t first_sector, int first_part_minor) + { + int i, csum; + unsigned short *ush; +diff -Nru a/fs/partitions/sun.h b/fs/partitions/sun.h +--- a/fs/partitions/sun.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/sun.h Thu Oct 31 09:20:25 2002 +@@ -5,5 +5,5 @@ + #define SUN_LABEL_MAGIC 0xDABE + + int sun_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + +diff -Nru a/fs/partitions/ultrix.c b/fs/partitions/ultrix.c +--- a/fs/partitions/ultrix.c Thu Oct 31 09:20:21 2002 ++++ b/fs/partitions/ultrix.c Thu Oct 31 09:20:21 2002 +@@ -15,7 +15,7 @@ + #include "check.h" + + int ultrix_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor) ++ sector_t first_sector, int first_part_minor) + { + int i; + Sector sect; +diff -Nru a/fs/partitions/ultrix.h b/fs/partitions/ultrix.h +--- a/fs/partitions/ultrix.h Thu Oct 31 09:20:25 2002 ++++ b/fs/partitions/ultrix.h Thu Oct 31 09:20:25 2002 +@@ -3,5 +3,5 @@ + */ + + int ultrix_partition(struct gendisk *hd, struct block_device *bdev, +- unsigned long first_sector, int first_part_minor); ++ sector_t first_sector, int first_part_minor); + +diff -Nru a/fs/qnx4/inode.c b/fs/qnx4/inode.c +--- a/fs/qnx4/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/qnx4/inode.c Thu Oct 31 09:20:25 2002 +@@ -204,7 +204,7 @@ + return NULL; + } + +-int qnx4_get_block( struct inode *inode, long iblock, struct buffer_head *bh, int create ) ++int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create ) + { + unsigned long phys; + +@@ -424,7 +424,7 @@ + return cont_prepare_write(page,from,to,qnx4_get_block, + &page->mapping->host->u.qnx4_i.mmu_private); + } +-static int qnx4_bmap(struct address_space *mapping, long block) ++static sector_t qnx4_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,qnx4_get_block); + } +diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c +--- a/fs/reiserfs/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/reiserfs/inode.c Thu Oct 31 09:20:25 2002 +@@ -17,7 +17,7 @@ + #define GET_BLOCK_READ_DIRECT 4 /* read the tail if indirect item not found */ + #define GET_BLOCK_NO_ISEM 8 /* i_sem is not held, don't preallocate */ + +-static int reiserfs_get_block (struct inode * inode, long block, ++static int reiserfs_get_block (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create); + + void reiserfs_delete_inode (struct inode * inode) +@@ -217,7 +217,7 @@ + // Please improve the english/clarity in the comment above, as it is + // hard to understand. + +-static int _get_block_create_0 (struct inode * inode, long block, ++static int _get_block_create_0 (struct inode * inode, sector_t block, + struct buffer_head * bh_result, + int args) + { +@@ -226,7 +226,7 @@ + struct buffer_head * bh; + struct item_head * ih, tmp_ih; + int fs_gen ; +- int blocknr; ++ sector_t blocknr; + char * p = NULL; + int chars; + int ret ; +@@ -379,9 +379,11 @@ + + // this is called to create file map. So, _get_block_create_0 will not + // read direct item +-int reiserfs_bmap (struct inode * inode, long block, ++int reiserfs_bmap (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) + { ++ if (unlikely(sizeof(sector_t) > 4 && (block >> 32))) ++ return -EFBIG; + if (!file_capable (inode, block)) + return -EFBIG; + +@@ -409,12 +411,12 @@ + ** don't want to send create == GET_BLOCK_NO_HOLE to reiserfs_get_block, + ** don't use this function. + */ +-static int reiserfs_get_block_create_0 (struct inode * inode, long block, ++static int reiserfs_get_block_create_0 (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) { + return reiserfs_get_block(inode, block, bh_result, GET_BLOCK_NO_HOLE) ; + } + +-static int reiserfs_get_block_direct_io (struct inode * inode, long block, ++static int reiserfs_get_block_direct_io (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) { + int ret ; + +@@ -514,7 +516,7 @@ + return reiserfs_new_unf_blocknrs (th, inode, allocated_block_nr, path, block); + } + +-static int reiserfs_get_block (struct inode * inode, long block, ++static int reiserfs_get_block (struct inode * inode, sector_t block, + struct buffer_head * bh_result, int create) + { + int repeat, retval; +@@ -544,6 +546,11 @@ + th.t_trans_id = 0 ; + version = get_inode_item_key_version (inode); + ++ if (unlikely(sizeof(block) > 4 && (block >> 32))) { ++ unlock_kernel(); ++ return -EIO; ++ } ++ + if (block < 0) { + unlock_kernel(); + return -EIO; +@@ -558,12 +565,11 @@ + ** log anything, so we don't need to start a transaction + */ + if (!(create & GET_BLOCK_CREATE)) { +- int ret ; + /* find number of block-th logical block of the file */ +- ret = _get_block_create_0 (inode, block, bh_result, ++ retval = _get_block_create_0 (inode, block, bh_result, + create | GET_BLOCK_READ_DIRECT) ; + unlock_kernel() ; +- return ret; ++ return retval; + } + + inode->u.reiserfs_i.i_flags |= i_pack_on_close_mask; +@@ -856,8 +862,9 @@ + pop_journal_writer(windex) ; + unlock_kernel() ; + reiserfs_check_path(&path) ; +- return retval; +-} ++ ++ return retval; ++} + + + // +@@ -2035,8 +2042,8 @@ + } + + +-static int reiserfs_aop_bmap(struct address_space *as, long block) { +- return generic_block_bmap(as, block, reiserfs_bmap) ; ++static sector_t reiserfs_aop_bmap(struct address_space *as, sector_t block) { ++ return generic_block_bmap(as, block, reiserfs_bmap) ; + } + + static int reiserfs_commit_write(struct file *f, struct page *page, +@@ -2120,7 +2127,7 @@ + } + + static int reiserfs_direct_io(int rw, struct inode *inode, +- struct kiobuf *iobuf, unsigned long blocknr, ++ struct kiobuf *iobuf, sector_t blocknr, + int blocksize) + { + return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, +diff -Nru a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c +--- a/fs/reiserfs/journal.c Thu Oct 31 09:20:21 2002 ++++ b/fs/reiserfs/journal.c Thu Oct 31 09:20:21 2002 +@@ -1010,15 +1010,16 @@ + ** is not marked JDirty_wait + */ + if ((!was_jwait) && !buffer_locked(saved_bh)) { +-printk("journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction\n", saved_bh->b_blocknr, ++printk("journal-813: BAD! buffer %llu %cdirty %cjwait, not in a newer tranasction\n", ++ (unsigned long long)saved_bh->b_blocknr, + was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ; + } + /* kupdate_one_transaction waits on the buffers it is writing, so we + ** should never see locked buffers here + */ + if (buffer_locked(saved_bh)) { +- printk("clm-2083: locked buffer %lu in flush_journal_list\n", +- saved_bh->b_blocknr) ; ++ printk("clm-2083: locked buffer %llu in flush_journal_list\n", ++ (unsigned long long)saved_bh->b_blocknr) ; + wait_on_buffer(saved_bh) ; + if (!buffer_uptodate(saved_bh)) { + reiserfs_panic(s, "journal-923: buffer write failed\n") ; +@@ -1031,8 +1032,8 @@ + submit_logged_buffer(saved_bh) ; + count++ ; + } else { +- printk("clm-2082: Unable to flush buffer %lu in flush_journal_list\n", +- saved_bh->b_blocknr) ; ++ printk("clm-2082: Unable to flush buffer %llu in flush_journal_list\n", ++ (unsigned long long)saved_bh->b_blocknr) ; + } + free_cnode: + last = cn ; +@@ -2171,7 +2172,9 @@ + ** could get to disk too early. NOT GOOD. + */ + if (!prepared || buffer_locked(bh)) { +- printk("journal-1777: buffer %lu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", bh->b_blocknr, prepared ? ' ' : '!', ++ printk("journal-1777: buffer %llu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", ++ (unsigned long long)bh->b_blocknr, ++ prepared ? ' ' : '!', + buffer_locked(bh) ? ' ' : '!', + buffer_dirty(bh) ? ' ' : '!', + buffer_journal_dirty(bh) ? ' ' : '!') ; +diff -Nru a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c +--- a/fs/reiserfs/prints.c Thu Oct 31 09:20:25 2002 ++++ b/fs/reiserfs/prints.c Thu Oct 31 09:20:25 2002 +@@ -138,8 +138,8 @@ + + static void sprintf_buffer_head (char * buf, struct buffer_head * bh) + { +- sprintf (buf, "dev %s, size %d, blocknr %ld, count %d, list %d, state 0x%lx, page %p, (%s, %s, %s)", +- kdevname (bh->b_dev), bh->b_size, bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list, ++ sprintf (buf, "dev %s, size %d, blocknr %llu, count %d, list %d, state 0x%lx, page %p, (%s, %s, %s)", ++ kdevname (bh->b_dev), bh->b_size, (unsigned long long)bh->b_blocknr, atomic_read (&(bh->b_count)), bh->b_list, + bh->b_state, bh->b_page, + buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE", + buffer_dirty (bh) ? "DIRTY" : "CLEAN", +@@ -365,7 +365,7 @@ + if (tb) { + while (tb->insert_size[h]) { + bh = PATH_H_PBUFFER (path, h); +- printk ("block %lu (level=%d), position %d\n", bh ? bh->b_blocknr : 0, ++ printk ("block %llu (level=%d), position %d\n", bh ? (unsigned long long)bh->b_blocknr : 0ULL, + bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h)); + h ++; + } +@@ -375,8 +375,8 @@ + printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n"); + while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) { + bh = PATH_OFFSET_PBUFFER (path, offset); +- printk ("%6d %10p (%9lu, %7d) %8d %7d\n", offset, +- bh, bh ? bh->b_blocknr : 0, bh ? atomic_read (&(bh->b_count)) : 0, ++ printk ("%6d %10p (%9llu, %7d) %8d %7d\n", offset, ++ bh, (unsigned long long)(bh ? bh->b_blocknr : 0), bh ? atomic_read (&(bh->b_count)) : 0, + PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1); + + offset --; +@@ -506,8 +506,8 @@ + return 1; + } + +- printk ("%s\'s super block in block %ld\n======================\n", +- kdevname (bh->b_dev), bh->b_blocknr); ++ printk ("%s\'s super block in block %llu\n======================\n", ++ kdevname (bh->b_dev), (unsigned long long)bh->b_blocknr); + printk ("Reiserfs version %s\n", version ); + printk ("Block count %u\n", sb_block_count(rs)); + printk ("Blocksize %d\n", sb_blocksize(rs)); +@@ -545,8 +545,8 @@ + if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8)) + return 1; + +- printk ("Desc block %lu (j_trans_id %d, j_mount_id %d, j_len %d)", +- bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len); ++ printk ("Desc block %llu (j_trans_id %d, j_mount_id %d, j_len %d)", ++ (unsigned long long)bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len); + + return 0; + } +@@ -571,7 +571,7 @@ + if (print_internal (bh, first, last)) + if (print_super_block (bh)) + if (print_desc_block (bh)) +- printk ("Block %ld contains unformatted data\n", bh->b_blocknr); ++ printk ("Block %llu contains unformatted data\n", (unsigned long long)bh->b_blocknr); + } + + +@@ -606,19 +606,19 @@ + tbFh = 0; + } + sprintf (print_tb_buf + strlen (print_tb_buf), +- "* %d * %3ld(%2d) * %3ld(%2d) * %3ld(%2d) * %5ld * %5ld * %5ld * %5ld * %5ld *\n", ++ "* %d * %3llu(%2d) * %3llu(%2d) * %3llu(%2d) * %5llu * %5llu * %5llu * %5llu * %5llu *\n", + h, +- (tbSh) ? (tbSh->b_blocknr):(-1), ++ (unsigned long long)((tbSh) ? (tbSh->b_blocknr):(-1)), + (tbSh) ? atomic_read (&(tbSh->b_count)) : -1, +- (tb->L[h]) ? (tb->L[h]->b_blocknr):(-1), ++ (unsigned long long)((tb->L[h]) ? (tb->L[h]->b_blocknr):(-1)), + (tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1, +- (tb->R[h]) ? (tb->R[h]->b_blocknr):(-1), ++ (unsigned long long)((tb->R[h]) ? (tb->R[h]->b_blocknr):(-1)), + (tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -1, +- (tbFh) ? (tbFh->b_blocknr):(-1), +- (tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1), +- (tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1), +- (tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1), +- (tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1)); ++ (unsigned long long)((tbFh) ? (tbFh->b_blocknr):(-1)), ++ (unsigned long long)((tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1)), ++ (unsigned long long)((tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1)), ++ (unsigned long long)((tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1)), ++ (unsigned long long)((tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1))); + } + + sprintf (print_tb_buf + strlen (print_tb_buf), +@@ -645,7 +645,7 @@ + h = 0; + for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++) + sprintf (print_tb_buf + strlen (print_tb_buf), +- "%p (%lu %d)%s", tb->FEB[i], tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0, ++ "%p (%llu %d)%s", tb->FEB[i], (unsigned long long)(tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0), + tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0, + (i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", "); + +diff -Nru a/fs/reiserfs/super.c b/fs/reiserfs/super.c +--- a/fs/reiserfs/super.c Thu Oct 31 09:20:25 2002 ++++ b/fs/reiserfs/super.c Thu Oct 31 09:20:25 2002 +@@ -848,8 +848,8 @@ + rs = (struct reiserfs_super_block *)bh->b_data; + if (!is_reiserfs_magic_string (rs)) { + printk ("read_super_block: " +- "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", +- kdevname(s->s_dev), bh->b_blocknr, size); ++ "can't find a reiserfs filesystem on (dev %s, block %llu, size %d)\n", ++ kdevname(s->s_dev), (unsigned long long)bh->b_blocknr, size); + brelse (bh); + return 1; + } +@@ -879,8 +879,8 @@ + if (!is_reiserfs_magic_string (rs) || + sb_blocksize(rs) != s->s_blocksize) { + printk ("read_super_block: " +- "can't find a reiserfs filesystem on (dev %s, block %lu, size %d)\n", +- kdevname(s->s_dev), bh->b_blocknr, size); ++ "can't find a reiserfs filesystem on (dev %s, block %llu, size %d)\n", ++ kdevname(s->s_dev), (unsigned long long)bh->b_blocknr, size); + brelse (bh); + printk ("read_super_block: can't find a reiserfs filesystem on dev %s.\n", kdevname(s->s_dev)); + return 1; +@@ -894,8 +894,8 @@ + bh->b_blocknr < (sb_journal_block(rs) + JOURNAL_BLOCK_COUNT)) { + brelse(bh) ; + printk("super-459: read_super_block: " +- "super found at block %lu is within its own log. " +- "It must not be of this format type.\n", bh->b_blocknr) ; ++ "super found at block %llu is within its own log. " ++ "It must not be of this format type.\n", (unsigned long long)bh->b_blocknr) ; + return 1 ; + } + +@@ -936,7 +936,7 @@ + wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ; + if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) { + printk("reread_meta_blocks, error reading bitmap block number %d at +- %ld\n", i, SB_AP_BITMAP(s)[i].bh->b_blocknr) ; ++ %llu\n", i, (unsigned long long)SB_AP_BITMAP(s)[i].bh->b_blocknr) ; + return 1 ; + } + } +diff -Nru a/fs/sysv/itree.c b/fs/sysv/itree.c +--- a/fs/sysv/itree.c Thu Oct 31 09:20:22 2002 ++++ b/fs/sysv/itree.c Thu Oct 31 09:20:22 2002 +@@ -191,7 +191,7 @@ + return -EAGAIN; + } + +-static int get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create) ++static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) + { + int err = -EIO; + int offsets[DEPTH]; +@@ -425,7 +425,7 @@ + { + return block_prepare_write(page,from,to,get_block); + } +-static int sysv_bmap(struct address_space *mapping, long block) ++static sector_t sysv_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,get_block); + } +diff -Nru a/fs/udf/inode.c b/fs/udf/inode.c +--- a/fs/udf/inode.c Thu Oct 31 09:20:25 2002 ++++ b/fs/udf/inode.c Thu Oct 31 09:20:25 2002 +@@ -61,7 +61,7 @@ + static void udf_update_extents(struct inode *, + long_ad [EXTENT_MERGE_SIZE], int, int, + lb_addr, uint32_t, struct buffer_head **); +-static int udf_get_block(struct inode *, long, struct buffer_head *, int); ++static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); + + /* + * udf_put_inode +@@ -146,7 +146,7 @@ + return block_prepare_write(page, from, to, udf_get_block); + } + +-static int udf_bmap(struct address_space *mapping, long block) ++static sector_t udf_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,udf_get_block); + } +@@ -311,7 +311,7 @@ + return dbh; + } + +-static int udf_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create) ++static int udf_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_result, int create) + { + int err, new; + struct buffer_head *bh; +diff -Nru a/fs/ufs/inode.c b/fs/ufs/inode.c +--- a/fs/ufs/inode.c Thu Oct 31 09:20:21 2002 ++++ b/fs/ufs/inode.c Thu Oct 31 09:20:21 2002 +@@ -308,7 +308,7 @@ + return result; + } + +-static int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create) ++static int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create) + { + struct super_block * sb; + struct ufs_sb_private_info * uspi; +@@ -463,7 +463,7 @@ + { + return block_prepare_write(page,from,to,ufs_getfrag_block); + } +-static int ufs_bmap(struct address_space *mapping, long block) ++static sector_t ufs_bmap(struct address_space *mapping, sector_t block) + { + return generic_block_bmap(mapping,block,ufs_getfrag_block); + } +diff -Nru a/include/asm-i386/types.h b/include/asm-i386/types.h +--- a/include/asm-i386/types.h Thu Oct 31 09:20:21 2002 ++++ b/include/asm-i386/types.h Thu Oct 31 09:20:21 2002 +@@ -52,6 +52,10 @@ + #endif + typedef u64 dma64_addr_t; + ++#ifdef CONFIG_LBD ++typedef u64 sector_t; ++#define HAVE_ARCH_SECTOR_T ++#endif + #endif /* __KERNEL__ */ + + #endif +diff -Nru a/include/asm-ppc/types.h b/include/asm-ppc/types.h +--- a/include/asm-ppc/types.h Thu Oct 31 09:20:25 2002 ++++ b/include/asm-ppc/types.h Thu Oct 31 09:20:25 2002 +@@ -48,6 +48,12 @@ + typedef u32 dma_addr_t; + typedef u64 dma64_addr_t; + ++#ifdef CONFIG_LBD ++typedef u64 sector_t; ++#define HAVE_ARCH_SECTOR_T ++#endif ++ ++ + #endif /* __KERNEL__ */ + + /* +diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h +--- a/include/linux/blkdev.h Thu Oct 31 09:20:22 2002 ++++ b/include/linux/blkdev.h Thu Oct 31 09:20:22 2002 +@@ -34,9 +34,10 @@ + int cmd; /* READ or WRITE */ + int errors; + unsigned long start_time; +- unsigned long sector; ++ sector_t sector; + unsigned long nr_sectors; +- unsigned long hard_sector, hard_nr_sectors; ++ sector_t hard_sector; ++ unsigned long hard_nr_sectors; + unsigned int nr_segments; + unsigned int nr_hw_segments; + unsigned long current_nr_sectors, hard_cur_sectors; +@@ -196,8 +197,8 @@ + + extern struct sec_size * blk_sec[MAX_BLKDEV]; + extern struct blk_dev_struct blk_dev[MAX_BLKDEV]; +-extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size); +-extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, long size); ++extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, sector_t size); ++extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, sector_t size); + extern void generic_make_request(int rw, struct buffer_head * bh); + extern inline request_queue_t *blk_get_queue(kdev_t dev); + extern void blkdev_release_request(struct request *); +@@ -213,7 +214,7 @@ + extern void generic_unplug_device(void *); + extern inline int blk_seg_merge_ok(struct buffer_head *, struct buffer_head *); + +-extern int * blk_size[MAX_BLKDEV]; ++extern sector_t * blk_size[MAX_BLKDEV]; + + extern int * blksize_size[MAX_BLKDEV]; + +@@ -277,5 +278,19 @@ + } + return retval; + } ++ ++#ifdef CONFIG_LBD ++# include ++# define sector_div(a, b) do_div(a, b) ++#else ++# define sector_div(n, b)( \ ++{ \ ++ int _res; \ ++ _res = (n) % (b); \ ++ (n) /= (b); \ ++ _res; \ ++} \ ++) ++#endif + + #endif +diff -Nru a/include/linux/fs.h b/include/linux/fs.h +--- a/include/linux/fs.h Thu Oct 31 09:20:22 2002 ++++ b/include/linux/fs.h Thu Oct 31 09:20:22 2002 +@@ -242,7 +242,7 @@ + struct buffer_head { + /* First cache line: */ + struct buffer_head *b_next; /* Hash queue list */ +- unsigned long b_blocknr; /* block number */ ++ sector_t b_blocknr; /* block number */ + unsigned short b_size; /* block size */ + unsigned short b_list; /* List that this buffer appears */ + kdev_t b_dev; /* device (B_FREE = free) */ +@@ -391,11 +391,11 @@ + int (*prepare_write)(struct file *, struct page *, unsigned, unsigned); + int (*commit_write)(struct file *, struct page *, unsigned, unsigned); + /* Unfortunately this kludge is needed for FIBMAP. Don't use it */ +- int (*bmap)(struct address_space *, long); ++ sector_t (*bmap)(struct address_space *, sector_t); + int (*flushpage) (struct page *, unsigned long); + int (*releasepage) (struct page *, int); + #define KERNEL_HAS_O_DIRECT /* this is for modules out of the kernel */ +- int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int); ++ int (*direct_IO)(int, struct inode *, struct kiobuf *, sector_t, int); + }; + + struct address_space { +@@ -452,7 +452,7 @@ + time_t i_ctime; + unsigned int i_blkbits; + unsigned long i_blksize; +- unsigned long i_blocks; ++ sector_t i_blocks; + unsigned long i_version; + struct semaphore i_sem; + struct semaphore i_zombie; +@@ -1241,7 +1241,7 @@ + extern int filemap_fdatasync(struct address_space *); + extern int filemap_fdatawait(struct address_space *); + extern void sync_supers(kdev_t); +-extern int bmap(struct inode *, int); ++extern sector_t bmap(struct inode *, sector_t); + extern int notify_change(struct dentry *, struct iattr *); + extern int permission(struct inode *, int); + extern int vfs_permission(struct inode *, int); +@@ -1373,8 +1373,8 @@ + extern void remove_inode_hash(struct inode *); + extern struct file * get_empty_filp(void); + extern void file_move(struct file *f, struct list_head *list); +-extern struct buffer_head * get_hash_table(kdev_t, int, int); +-extern struct buffer_head * getblk(kdev_t, int, int); ++extern struct buffer_head * get_hash_table(kdev_t, sector_t, int); ++extern struct buffer_head * getblk(kdev_t, sector_t, int); + extern void ll_rw_block(int, int, struct buffer_head * bh[]); + extern void submit_bh(int, struct buffer_head *); + extern int is_read_only(kdev_t); +@@ -1393,16 +1393,16 @@ + extern int set_blocksize(kdev_t, int); + extern int sb_set_blocksize(struct super_block *, int); + extern int sb_min_blocksize(struct super_block *, int); +-extern struct buffer_head * bread(kdev_t, int, int); +-static inline struct buffer_head * sb_bread(struct super_block *sb, int block) ++extern struct buffer_head * bread(kdev_t, sector_t, int); ++static inline struct buffer_head * sb_bread(struct super_block *sb, sector_t block) + { + return bread(sb->s_dev, block, sb->s_blocksize); + } +-static inline struct buffer_head * sb_getblk(struct super_block *sb, int block) ++static inline struct buffer_head * sb_getblk(struct super_block *sb, sector_t block) + { + return getblk(sb->s_dev, block, sb->s_blocksize); + } +-static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, int block) ++static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, sector_t block) + { + return get_hash_table(sb->s_dev, block, sb->s_blocksize); + } +@@ -1410,9 +1410,9 @@ + extern void put_unused_buffer_head(struct buffer_head * bh); + extern struct buffer_head * get_unused_buffer_head(int async); + +-extern int brw_page(int, struct page *, kdev_t, int [], int); ++extern int brw_page(int, struct page *, kdev_t, sector_t [], int); + +-typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int); ++typedef int (get_block_t)(struct inode*,sector_t,struct buffer_head*,int); + + /* Generic buffer handling for block filesystems.. */ + extern int try_to_release_page(struct page * page, int gfp_mask); +@@ -1429,10 +1429,10 @@ + extern int block_commit_write(struct page *page, unsigned from, unsigned to); + extern int block_sync_page(struct page *); + +-int generic_block_bmap(struct address_space *, long, get_block_t *); ++sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); + int generic_commit_write(struct file *, struct page *, unsigned, unsigned); + int block_truncate_page(struct address_space *, loff_t, get_block_t *); +-extern int generic_direct_IO(int, struct inode *, struct kiobuf *, unsigned long, int, get_block_t *); ++extern int generic_direct_IO(int, struct inode *, struct kiobuf *, sector_t, int, get_block_t *); + extern int waitfor_one_page(struct page *); + extern int writeout_one_page(struct page *); + +diff -Nru a/include/linux/genhd.h b/include/linux/genhd.h +--- a/include/linux/genhd.h Thu Oct 31 09:20:21 2002 ++++ b/include/linux/genhd.h Thu Oct 31 09:20:21 2002 +@@ -59,8 +59,8 @@ + # include + + struct hd_struct { +- unsigned long start_sect; +- unsigned long nr_sects; ++ sector_t start_sect; ++ sector_t nr_sects; + devfs_handle_t de; /* primary (master) devfs entry */ + #ifdef CONFIG_DEVFS_FS + int number; +@@ -94,7 +94,7 @@ + int max_p; /* maximum partitions per device */ + + struct hd_struct *part; /* [indexed by minor] */ +- int *sizes; /* [idem], device size in blocks */ ++ sector_t *sizes; /* [idem], device size in blocks */ + int nr_real; /* number of real devices */ + + void *real_devices; /* internal use */ +diff -Nru a/include/linux/ide.h b/include/linux/ide.h +--- a/include/linux/ide.h Thu Oct 31 09:20:21 2002 ++++ b/include/linux/ide.h Thu Oct 31 09:20:21 2002 +@@ -689,7 +689,7 @@ + typedef int (ide_cleanup_proc)(ide_drive_t *); + typedef int (ide_standby_proc)(ide_drive_t *); + typedef int (ide_flushcache_proc)(ide_drive_t *); +-typedef ide_startstop_t (ide_do_request_proc)(ide_drive_t *, struct request *, unsigned long); ++typedef ide_startstop_t (ide_do_request_proc)(ide_drive_t *, struct request *, sector_t); + typedef void (ide_end_request_proc)(byte, ide_hwgroup_t *); + typedef int (ide_ioctl_proc)(ide_drive_t *, struct inode *, struct file *, unsigned int, unsigned long); + typedef int (ide_open_proc)(struct inode *, struct file *, ide_drive_t *); +@@ -697,7 +697,7 @@ + typedef int (ide_check_media_change_proc)(ide_drive_t *); + typedef void (ide_revalidate_proc)(ide_drive_t *); + typedef void (ide_pre_reset_proc)(ide_drive_t *); +-typedef unsigned long (ide_capacity_proc)(ide_drive_t *); ++typedef sector_t (ide_capacity_proc)(ide_drive_t *); + typedef ide_startstop_t (ide_special_proc)(ide_drive_t *); + typedef void (ide_setting_proc)(ide_drive_t *); + typedef int (ide_reinit_proc)(ide_drive_t *); +diff -Nru a/include/linux/iobuf.h b/include/linux/iobuf.h +--- a/include/linux/iobuf.h Thu Oct 31 09:20:22 2002 ++++ b/include/linux/iobuf.h Thu Oct 31 09:20:22 2002 +@@ -41,7 +41,7 @@ + + struct page ** maplist; + struct buffer_head ** bh; +- unsigned long * blocks; ++ sector_t * blocks; + + /* Dynamic state for IO completion: */ + atomic_t io_count; /* IOs still in progress */ +@@ -73,6 +73,6 @@ + /* fs/buffer.c */ + + int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], +- kdev_t dev, unsigned long b[], int size); ++ kdev_t dev, sector_t b[], int size); + + #endif /* __LINUX_IOBUF_H */ +diff -Nru a/include/linux/iso_fs.h b/include/linux/iso_fs.h +--- a/include/linux/iso_fs.h Thu Oct 31 09:20:25 2002 ++++ b/include/linux/iso_fs.h Thu Oct 31 09:20:25 2002 +@@ -219,7 +219,7 @@ + int get_acorn_filename(struct iso_directory_record *, char *, struct inode *); + + extern struct dentry *isofs_lookup(struct inode *, struct dentry *); +-extern struct buffer_head *isofs_bread(struct inode *inode, unsigned int block); ++extern struct buffer_head *isofs_bread(struct inode *inode, sector_t block); + extern int isofs_get_blocks(struct inode *, long, struct buffer_head **, unsigned long); + + extern struct inode_operations isofs_dir_inode_operations; +@@ -234,7 +234,7 @@ + #define brelse leak_check_brelse + extern void * leak_check_malloc(unsigned int size); + extern void leak_check_free_s(void * obj, int size); +-extern struct buffer_head * leak_check_bread(struct super_block *sb, int block); ++extern struct buffer_head * leak_check_bread(struct super_block *sb, sector_t block); + extern void leak_check_brelse(struct buffer_head * bh); + #endif /* LEAK_CHECK */ + +diff -Nru a/include/linux/loop.h b/include/linux/loop.h +--- a/include/linux/loop.h Thu Oct 31 09:20:25 2002 ++++ b/include/linux/loop.h Thu Oct 31 09:20:25 2002 +@@ -34,7 +34,7 @@ + int lo_flags; + int (*transfer)(struct loop_device *, int cmd, + char *raw_buf, char *loop_buf, int size, +- int real_block); ++ sector_t real_block); + char lo_name[LO_NAME_SIZE]; + char lo_encrypt_key[LO_KEY_SIZE]; + __u32 lo_init[2]; +@@ -129,7 +129,7 @@ + struct loop_func_table { + int number; /* filter type */ + int (*transfer)(struct loop_device *lo, int cmd, char *raw_buf, +- char *loop_buf, int size, int real_block); ++ char *loop_buf, int size, sector_t real_block); + int (*init)(struct loop_device *, struct loop_info *); + /* release is called from loop_unregister_transfer or clr_fd */ + int (*release)(struct loop_device *); +diff -Nru a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h +--- a/include/linux/msdos_fs.h Thu Oct 31 09:20:22 2002 ++++ b/include/linux/msdos_fs.h Thu Oct 31 09:20:22 2002 +@@ -273,7 +273,7 @@ + extern struct inode_operations fat_file_inode_operations; + extern ssize_t fat_file_read(struct file *filp, char *buf, size_t count, + loff_t *ppos); +-extern int fat_get_block(struct inode *inode, long iblock, ++extern int fat_get_block(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create); + extern ssize_t fat_file_write(struct file *filp, const char *buf, size_t count, + loff_t *ppos); +diff -Nru a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h +--- a/include/linux/qnx4_fs.h Thu Oct 31 09:20:25 2002 ++++ b/include/linux/qnx4_fs.h Thu Oct 31 09:20:25 2002 +@@ -118,7 +118,7 @@ + extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry); + extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int); + extern int qnx4_sync_inode(struct inode *inode); +-extern int qnx4_get_block(struct inode *inode, long iblock, struct buffer_head *bh, int create); ++extern int qnx4_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create); + + #endif /* __KERNEL__ */ + +diff -Nru a/include/linux/raid/linear.h b/include/linux/raid/linear.h +--- a/include/linux/raid/linear.h Thu Oct 31 09:20:25 2002 ++++ b/include/linux/raid/linear.h Thu Oct 31 09:20:25 2002 +@@ -5,8 +5,8 @@ + + struct dev_info { + kdev_t dev; +- unsigned long size; +- unsigned long offset; ++ sector_t size; ++ sector_t offset; + }; + + typedef struct dev_info dev_info_t; +diff -Nru a/include/linux/raid/md.h b/include/linux/raid/md.h +--- a/include/linux/raid/md.h Thu Oct 31 09:20:21 2002 ++++ b/include/linux/raid/md.h Thu Oct 31 09:20:21 2002 +@@ -59,7 +59,7 @@ + #define MD_MINOR_VERSION 90 + #define MD_PATCHLEVEL_VERSION 0 + +-extern int md_size[MAX_MD_DEVS]; ++extern sector_t md_size[MAX_MD_DEVS]; + extern struct hd_struct md_hd_struct[MAX_MD_DEVS]; + + extern void add_mddev_mapping (mddev_t *mddev, kdev_t dev, void *data); +diff -Nru a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h +--- a/include/linux/raid/md_k.h Thu Oct 31 09:20:21 2002 ++++ b/include/linux/raid/md_k.h Thu Oct 31 09:20:21 2002 +@@ -164,14 +164,14 @@ + + kdev_t dev; /* Device number */ + kdev_t old_dev; /* "" when it was last imported */ +- unsigned long size; /* Device size (in blocks) */ ++ sector_t size; /* Device size (in blocks) */ + mddev_t *mddev; /* RAID array if running */ + unsigned long last_events; /* IO event timestamp */ + + struct block_device *bdev; /* block device handle */ + + mdp_super_t *sb; +- unsigned long sb_offset; ++ sector_t sb_offset; + + int alias_device; /* device alias to the same disk */ + int faulty; /* if faulty do not issue IO requests */ +diff -Nru a/include/linux/types.h b/include/linux/types.h +--- a/include/linux/types.h Thu Oct 31 09:20:25 2002 ++++ b/include/linux/types.h Thu Oct 31 09:20:25 2002 +@@ -127,4 +127,8 @@ + char f_fpack[6]; + }; + ++#ifndef HAVE_ARCH_SECTOR_T ++typedef unsigned long sector_t; ++#endif ++ + #endif /* _LINUX_TYPES_H */ +diff -Nru a/mm/page_io.c b/mm/page_io.c +--- a/mm/page_io.c Thu Oct 31 09:20:21 2002 ++++ b/mm/page_io.c Thu Oct 31 09:20:21 2002 +@@ -36,7 +36,7 @@ + static int rw_swap_page_base(int rw, swp_entry_t entry, struct page *page) + { + unsigned long offset; +- int zones[PAGE_SIZE/512]; ++ sector_t zones[PAGE_SIZE/512]; + int zones_used; + kdev_t dev = 0; + int block_size; +@@ -55,7 +55,7 @@ + block_size = PAGE_SIZE; + } else if (swapf) { + int i, j; +- unsigned int block = offset ++ sector_t block = offset + << (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits); + + block_size = swapf->i_sb->s_blocksize; diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.4.20-rc1/mm/page_io.c linux-2.4-lbd/mm/page_io.c --- linux-2.4.20-rc1/mm/page_io.c Fri Dec 13 10:46:26 2002 +++ linux-2.4-lbd/mm/page_io.c Wed Sep 25 10:30:57 2002 @@ -36,7 +36,7 @@ static int rw_swap_page_base(int rw, swp_entry_t entry, struct page *page) { unsigned long offset; - int zones[PAGE_SIZE/512]; + sector_t zones[PAGE_SIZE/512]; int zones_used; kdev_t dev = 0; int block_size; @@ -55,7 +55,7 @@ block_size = PAGE_SIZE; } else if (swapf) { int i, j; - unsigned int block = offset + sector_t block = offset << (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits); block_size = swapf->i_sb->s_blocksize;