diff -Ncr linux-2.4.22-ashuariadevel.backup/Documentation/Configure.help linux-2.4.22-ashuariadevel/Documentation/Configure.help
*** linux-2.4.22-ashuariadevel.backup/Documentation/Configure.help	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/Documentation/Configure.help	2004-02-02 14:35:08.000000000 +0900
***************
*** 610,615 ****
--- 610,620 ----
  
    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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/Config.in linux-2.4.22-ashuariadevel/drivers/block/Config.in
*** linux-2.4.22-ashuariadevel.backup/drivers/block/Config.in	2003-12-09 11:52:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/Config.in	2004-02-02 14:35:08.000000000 +0900
***************
*** 51,54 ****
--- 51,57 ----
  
  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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/DAC960.c linux-2.4.22-ashuariadevel/drivers/block/DAC960.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/DAC960.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/DAC960.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 5499,5510 ****
  	Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)].start_sect;
        return (copy_to_user(UserGeometry, &Geometry,
  			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
!     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);
      case BLKGETSIZE64:
        if ((u64 *) Argument == NULL) return -EINVAL;
        return put_user((u64) Controller->GenericDiskInfo
--- 5499,5515 ----
  	Controller->GenericDiskInfo.part[MINOR(Inode->i_rdev)].start_sect;
        return (copy_to_user(UserGeometry, &Geometry,
  			   sizeof(DiskGeometry_T)) ? -EFAULT : 0);
!     case BLKGETSIZE: {
        /* Get Device Size. */
! 	    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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/DAC960.h linux-2.4.22-ashuariadevel/drivers/block/DAC960.h
*** linux-2.4.22-ashuariadevel.backup/drivers/block/DAC960.h	2001-10-18 06:46:29.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/DAC960.h	2004-02-02 14:35:08.000000000 +0900
***************
*** 2473,2479 ****
      } V2;
    } FW;
    DiskPartition_T DiskPartitions[DAC960_MinorCount];
!   int PartitionSizes[DAC960_MinorCount];
    int BlockSizes[DAC960_MinorCount];
    int MaxSectorsPerRequest[DAC960_MinorCount];
    unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
--- 2473,2479 ----
      } V2;
    } FW;
    DiskPartition_T DiskPartitions[DAC960_MinorCount];
!   sector_t PartitionSizes[DAC960_MinorCount];
    int BlockSizes[DAC960_MinorCount];
    int MaxSectorsPerRequest[DAC960_MinorCount];
    unsigned char ProgressBuffer[DAC960_ProgressBufferSize];
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/blkpg.c linux-2.4.22-ashuariadevel/drivers/block/blkpg.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/blkpg.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/blkpg.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 66,73 ****
   */
  int add_partition(kdev_t dev, struct blkpg_partition *p) {
  	struct gendisk *g;
! 	long long ppstart, pplength;
! 	long pstart, plength;
  	int i, drive, first_minor, end_minor, minor;
  
  	/* convert bytes to sectors, check for fit in a hd_struct */
--- 66,74 ----
   */
  int add_partition(kdev_t dev, struct blkpg_partition *p) {
  	struct gendisk *g;
! 	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 */
***************
*** 247,256 ****
  			if (g)
  				ullval = g->part[MINOR(dev)].nr_sects;
  
! 			if (cmd == BLKGETSIZE)
  				return put_user((unsigned long)ullval, (unsigned long *)arg);
! 			else
! 				return put_user(ullval << 9, (u64 *)arg);
  #if 0
  		case BLKRRPART: /* Re-read partition tables */
  			if (!capable(CAP_SYS_ADMIN)) 
--- 248,259 ----
  			if (g)
  				ullval = g->part[MINOR(dev)].nr_sects;
  
! 			if (cmd == BLKGETSIZE) {
! 				if ((unsigned long)ullval != ullval)
! 					return -EFBIG;
  				return put_user((unsigned long)ullval, (unsigned long *)arg);
! 			}
! 			return put_user(ullval << 9, (u64 *)arg);
  #if 0
  		case BLKRRPART: /* Re-read partition tables */
  			if (!capable(CAP_SYS_ADMIN)) 
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/cciss.c linux-2.4.22-ashuariadevel/drivers/block/cciss.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/cciss.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/cciss.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 505,511 ****
  			driver_geo.heads = 0xff;
  			driver_geo.sectors = 0x3f;
  			driver_geo.cylinders = 
! 				hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
  		}
  		driver_geo.start=
  			hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
--- 505,511 ----
  			driver_geo.heads = 0xff;
  			driver_geo.sectors = 0x3f;
  			driver_geo.cylinders = 
! 				(int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
  		}
  		driver_geo.start=
  			hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
***************
*** 525,531 ****
  			driver_geo.heads = 0xff;
  			driver_geo.sectors = 0x3f;
  			driver_geo.cylinders = 
! 				hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
  		}
  		driver_geo.start= 
  		hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
--- 525,531 ----
  			driver_geo.heads = 0xff;
  			driver_geo.sectors = 0x3f;
  			driver_geo.cylinders = 
! 				(int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
  		}
  		driver_geo.start= 
  		hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/cciss.h linux-2.4.22-ashuariadevel/drivers/block/cciss.h
*** linux-2.4.22-ashuariadevel.backup/drivers/block/cciss.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/cciss.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 84,90 ****
  	struct gendisk   gendisk;
  	   // indexed by minor numbers
  	struct hd_struct hd[256];
! 	int              sizes[256];
  	int              blocksizes[256];
  	int              hardsizes[256];
  	int busy_configuring;
--- 84,90 ----
  	struct gendisk   gendisk;
  	   // indexed by minor numbers
  	struct hd_struct hd[256];
! 	sector_t         sizes[256];
  	int              blocksizes[256];
  	int              hardsizes[256];
  	int busy_configuring;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/cpqarray.h linux-2.4.22-ashuariadevel/drivers/block/cpqarray.h
*** linux-2.4.22-ashuariadevel.backup/drivers/block/cpqarray.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/cpqarray.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 123,129 ****
  	struct gendisk gendisk;
  	// Index by Minor Numbers
  	struct hd_struct	hd[256];
! 	int			sizes[256];
  	int			blocksizes[256];
  	int			hardsizes[256];
  };
--- 123,129 ----
  	struct gendisk gendisk;
  	// Index by Minor Numbers
  	struct hd_struct	hd[256];
! 	sector_t		sizes[256];
  	int			blocksizes[256];
  	int			hardsizes[256];
  };
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/floppy.c linux-2.4.22-ashuariadevel/drivers/block/floppy.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/floppy.c	2003-08-25 20:44:41.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/floppy.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 480,486 ****
   */
  static struct floppy_struct user_params[N_DRIVE];
  
! static int floppy_sizes[256];
  static int floppy_blocksizes[256];
  static int floppy_maxsectors[256];
  
--- 480,486 ----
   */
  static struct floppy_struct user_params[N_DRIVE];
  
! static sector_t floppy_sizes[256];
  static int floppy_blocksizes[256];
  static int floppy_maxsectors[256];
  
***************
*** 583,589 ****
  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 in_sector_offset;	/* offset within physical sector,
  					 * expressed in units of 512 bytes */
  
--- 583,589 ----
  static struct floppy_struct *_floppy = floppy_type;
  static unsigned char current_drive;
  static long current_count_sectors;
! static unsigned char sector; /* sector in track */
  static unsigned char in_sector_offset;	/* offset within physical sector,
  					 * expressed in units of 512 bytes */
  
***************
*** 2405,2411 ****
  		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);
  		printk("in_sector_offset=%d\n", in_sector_offset);
  	}
  #endif
--- 2405,2411 ----
  		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, ssize);
  		printk("in_sector_offset=%d\n", in_sector_offset);
  	}
  #endif
***************
*** 2452,2458 ****
  	} else if (CT(COMMAND) == FD_READ){
  		buffer_track = raw_cmd->track;
  		buffer_drive = current_drive;
! 		INFBOUND(buffer_max, nr_sectors + sector_t);
  	}
  	cont->redo();
  }
--- 2452,2458 ----
  	} else if (CT(COMMAND) == FD_READ){
  		buffer_track = raw_cmd->track;
  		buffer_drive = current_drive;
! 		INFBOUND(buffer_max, nr_sectors + sector);
  	}
  	cont->redo();
  }
***************
*** 2481,2493 ****
  /* Compute the maximal transfer size */
  static int transfer_size(int ssize, int max_sector, int max_size)
  {
! 	SUPBOUND(max_sector, sector_t + max_size);
  
  	/* alignment */
  	max_sector -= (max_sector % _floppy->sect) % ssize;
  
  	/* transfer size, beginning not aligned */
! 	current_count_sectors = max_sector - sector_t ;
  
  	return max_sector;
  }
--- 2481,2493 ----
  /* Compute the maximal transfer size */
  static int transfer_size(int ssize, int max_sector, int 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 ;
  
  	return max_sector;
  }
***************
*** 2507,2514 ****
  				   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,
  						CURRENT->nr_sectors);
  
  	remaining = current_count_sectors << 9;
--- 2507,2514 ----
  				   CURRENT->nr_sectors);
  
  	if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
! 	    buffer_max > sector + CURRENT->nr_sectors)
! 		current_count_sectors = minimum(buffer_max - sector,
  						CURRENT->nr_sectors);
  
  	remaining = current_count_sectors << 9;
***************
*** 2528,2534 ****
  
  	buffer_max = maximum(max_sector, buffer_max);
  
! 	dma_buffer = floppy_track_buffer + ((sector_t - buffer_min) << 9);
  
  	bh = CURRENT->bh;
  	size = CURRENT->current_nr_sectors << 9;
--- 2528,2534 ----
  
  	buffer_max = maximum(max_sector, buffer_max);
  
! 	dma_buffer = floppy_track_buffer + ((sector - buffer_min) << 9);
  
  	bh = CURRENT->bh;
  	size = CURRENT->current_nr_sectors << 9;
***************
*** 2542,2549 ****
  		    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("current_count_sectors=%ld\n",
  			       current_count_sectors);
  			if (CT(COMMAND) == FD_READ)
--- 2542,2549 ----
  		    dma_buffer < floppy_track_buffer){
  			DPRINT("buffer overrun in copy buffer %d\n",
  				(int) ((floppy_track_buffer - dma_buffer) >>9));
! 			printk("sector=%d buffer_min=%d\n",
! 			       sector, buffer_min);
  			printk("current_count_sectors=%ld\n",
  			       current_count_sectors);
  			if (CT(COMMAND) == FD_READ)
***************
*** 2636,2642 ****
  
  static int make_raw_rw_request(void)
  {
! 	int aligned_sector_t;
  	int max_sector, max_size, tracksize, ssize;
  
  	if(max_buffer_sectors == 0) {
--- 2636,2642 ----
  
  static int make_raw_rw_request(void)
  {
! 	int aligned_sector;
  	int max_sector, max_size, tracksize, ssize;
  
  	if(max_buffer_sectors == 0) {
***************
*** 2663,2670 ****
  
  	max_sector = _floppy->sect * _floppy->head;
  
! 	TRACK = CURRENT->sector / max_sector;
! 	sector_t = CURRENT->sector % max_sector;
  	if (_floppy->track && TRACK >= _floppy->track) {
  		if (CURRENT->current_nr_sectors & 1) {
  			current_count_sectors = 1;
--- 2663,2670 ----
  
  	max_sector = _floppy->sect * _floppy->head;
  
! 	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;
***************
*** 2672,2688 ****
  		} else
  			return 0;
  	}
! 	HEAD = sector_t / _floppy->sect;
  
  	if (((_floppy->stretch & FD_SWAPSIDES) || TESTF(FD_NEED_TWADDLE)) &&
! 	    sector_t < _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,
  							CURRENT->nr_sectors);
  			return 1;
  		}
--- 2672,2688 ----
  		} else
  			return 0;
  	}
! 	HEAD = sector / _floppy->sect;
  
  	if (((_floppy->stretch & FD_SWAPSIDES) || TESTF(FD_NEED_TWADDLE)) &&
! 	    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 >= max_sector){
! 			current_count_sectors = minimum(_floppy->sect - sector,
  							CURRENT->nr_sectors);
  			return 1;
  		}
***************
*** 2704,2710 ****
  	GAP = _floppy->gap;
  	CODE2SIZE;
  	SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE;
! 	SECTOR = ((sector_t % _floppy->sect) << 2 >> SIZECODE) + 1;
  
  	/* tracksize describes the size which can be filled up with sectors
  	 * of size ssize.
--- 2704,2710 ----
  	GAP = _floppy->gap;
  	CODE2SIZE;
  	SECT_PER_TRACK = _floppy->sect << 2 >> SIZECODE;
! 	SECTOR = ((sector % _floppy->sect) << 2 >> SIZECODE) + 1;
  
  	/* tracksize describes the size which can be filled up with sectors
  	 * of size ssize.
***************
*** 2712,2722 ****
  	tracksize = _floppy->sect - _floppy->sect % ssize;
  	if (tracksize < _floppy->sect){
  		SECT_PER_TRACK ++;
! 		if (tracksize <= sector_t % _floppy->sect)
  			SECTOR--;
  
  		/* if we are beyond tracksize, fill up using smaller sectors */
! 		while (tracksize <= sector_t % _floppy->sect){
  			while(tracksize + ssize > _floppy->sect){
  				SIZECODE--;
  				ssize >>= 1;
--- 2712,2722 ----
  	tracksize = _floppy->sect - _floppy->sect % ssize;
  	if (tracksize < _floppy->sect){
  		SECT_PER_TRACK ++;
! 		if (tracksize <= sector % _floppy->sect)
  			SECTOR--;
  
  		/* if we are beyond tracksize, fill up using smaller sectors */
! 		while (tracksize <= sector % _floppy->sect){
  			while(tracksize + ssize > _floppy->sect){
  				SIZECODE--;
  				ssize >>= 1;
***************
*** 2732,2743 ****
  		max_sector = _floppy->sect;
  	}
  
! 	in_sector_offset = (sector_t % _floppy->sect) % ssize;
! 	aligned_sector_t = sector_t - 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)) {
  		/* data already in track buffer */
  		if (CT(COMMAND) == FD_READ) {
  			copy_buffer(1, max_sector, buffer_max);
--- 2732,2743 ----
  		max_sector = _floppy->sect;
  	}
  
! 	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 >= buffer_min) && (sector < buffer_max)) {
  		/* data already in track buffer */
  		if (CT(COMMAND) == FD_READ) {
  			copy_buffer(1, max_sector, buffer_max);
***************
*** 2745,2752 ****
  		}
  	} 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)
  				max_size = ssize + ssize;
  			else
  				max_size = ssize;
--- 2745,2752 ----
  		}
  	} else if (in_sector_offset || CURRENT->nr_sectors < ssize){
  		if (CT(COMMAND) == FD_WRITE){
! 			if (sector + CURRENT->nr_sectors > ssize &&
! 			    sector + CURRENT->nr_sectors < ssize + ssize)
  				max_size = ssize + ssize;
  			else
  				max_size = ssize;
***************
*** 2759,2765 ****
  		int direct, indirect;
  
  		indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) -
! 			sector_t;
  
  		/*
  		 * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide
--- 2759,2765 ----
  		int direct, indirect;
  
  		indirect= transfer_size(ssize,max_sector,max_buffer_sectors*2) -
! 			sector;
  
  		/*
  		 * Do NOT use minimum() here---MAX_DMA_ADDRESS is 64 bits wide
***************
*** 2774,2780 ****
  		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;
  		/*
  		 * We try to read tracks, but if we get too many errors, we
  		 * go back to reading just one sector at a time.
--- 2774,2780 ----
  		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;
  		/*
  		 * We try to read tracks, but if we get too many errors, we
  		 * go back to reading just one sector at a time.
***************
*** 2793,2800 ****
  			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);
  				return 0;
  			}
  /*			check_dma_crossing(raw_cmd->kernel_data, 
--- 2793,2800 ----
  			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=%d",
! 					indirect, direct, sector);
  				return 0;
  			}
  /*			check_dma_crossing(raw_cmd->kernel_data, 
***************
*** 2812,2830 ****
  	/* 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 ||
  	    ((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)
  	    /* not enough space */){
  		buffer_track = -1;
  		buffer_drive = current_drive;
! 		buffer_max = buffer_min = aligned_sector_t;
  	}
  	raw_cmd->kernel_data = floppy_track_buffer + 
! 		((aligned_sector_t-buffer_min)<<9);
  
  	if (CT(COMMAND) == FD_WRITE){
  		/* copy write buffer to track buffer.
--- 2812,2830 ----
  	/* claim buffer track if needed */
  	if (buffer_track != raw_cmd->track ||  /* bad track */
  	    buffer_drive !=current_drive || /* bad drive */
! 	    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 > 2 * max_buffer_sectors + buffer_min)
  	    /* not enough space */){
  		buffer_track = -1;
  		buffer_drive = current_drive;
! 		buffer_max = buffer_min = aligned_sector;
  	}
  	raw_cmd->kernel_data = floppy_track_buffer + 
! 		((aligned_sector-buffer_min)<<9);
  
  	if (CT(COMMAND) == FD_WRITE){
  		/* copy write buffer to track buffer.
***************
*** 2840,2846 ****
  		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);
  
  	/* round up current_count_sectors to get dma xfer size */
  	raw_cmd->length = in_sector_offset+current_count_sectors;
--- 2840,2846 ----
  		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);
  
  	/* round up current_count_sectors to get dma xfer size */
  	raw_cmd->length = in_sector_offset+current_count_sectors;
***************
*** 2852,2859 ****
  	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)) ||
  	    raw_cmd->length % (128 << SIZECODE) ||
  	    raw_cmd->length <= 0 || current_count_sectors <= 0){
  		DPRINT("fractionary current count b=%lx s=%lx\n",
--- 2852,2859 ----
  	if ((raw_cmd->length < current_count_sectors << 9) ||
  	    (raw_cmd->kernel_data != CURRENT->buffer &&
  	     CT(COMMAND) == FD_WRITE &&
! 	     (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",
***************
*** 2864,2870 ****
  				       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);
  		printk("ssize=%x SIZECODE=%d\n", ssize, SIZECODE);
  		printk("command=%x SECTOR=%d HEAD=%d, TRACK=%d\n",
  		       COMMAND, SECTOR, HEAD, TRACK);
--- 2864,2870 ----
  				       floppy_track_buffer) >> 9),
  			       current_count_sectors);
  		printk("st=%d ast=%d mse=%d msi=%d\n",
! 		       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);
***************
*** 2882,2889 ****
  		    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,
  			       raw_cmd->length >> 9);
  			printk("current_count_sectors=%ld\n",
  			       current_count_sectors);
--- 2882,2889 ----
  		    raw_cmd->kernel_data + raw_cmd->length >
  		    floppy_track_buffer + (max_buffer_sectors  << 10)){
  			DPRINT("buffer overrun in schedule dma\n");
! 			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);
***************
*** 3005,3011 ****
  
  	if (usage_count == 0) {
  		printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT);
! 		printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd);
  		return;
  	}
  	if (test_bit(0, &fdc_busy)) {
--- 3005,3011 ----
  
  	if (usage_count == 0) {
  		printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT);
! 		printk("sect=%llu cmd=%d\n", (unsigned long long)CURRENT->sector, CURRENT->cmd);
  		return;
  	}
  	if (test_bit(0, &fdc_busy)) {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/genhd.c linux-2.4.22-ashuariadevel/drivers/block/genhd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/genhd.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/genhd.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 198,206 ****
  			struct hd_struct *hd = &gp->part[n];
  
  			disk_round_stats(hd);
! 			seq_printf(s, "%4d  %4d %10d %s "
  				      "%d %d %d %d %d %d %d %d %d %d %d\n",
! 				      gp->major, n, gp->sizes[n],
  				      disk_name(gp, n, buf),
  				      hd->rd_ios, hd->rd_merges,
  #define MSEC(x) ((x) * 1000 / HZ)
--- 198,206 ----
  			struct hd_struct *hd = &gp->part[n];
  
  			disk_round_stats(hd);
! 			seq_printf(s, "%4d  %4d %10llu %s "
  				      "%d %d %d %d %d %d %d %d %d %d %d\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)
***************
*** 210,217 ****
  				      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],
  				   disk_name(gp, n, buf));
  #endif /* CONFIG_BLK_STATS */
  		}
--- 210,217 ----
  				      hd->ios_in_flight, MSEC(hd->io_ticks),
  				      MSEC(hd->aveq));
  #else
! 			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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/ll_rw_blk.c linux-2.4.22-ashuariadevel/drivers/block/ll_rw_blk.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/ll_rw_blk.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/ll_rw_blk.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 83,92 ****
   *
   * if (!blk_size[MAJOR]) then no minor size checking is done.
   */
! int * blk_size[MAX_BLKDEV];
  
  /*
!  * blksize_size contains the size of all block-devices:
   *
   * blksize_size[MAJOR][MINOR]
   *
--- 83,92 ----
   *
   * if (!blk_size[MAJOR]) then no minor size checking is done.
   */
! sector_t * blk_size[MAX_BLKDEV];
  
  /*
!  * blksize_size contains the block size of all block-devices:
   *
   * blksize_size[MAJOR][MINOR]
   *
***************
*** 990,996 ****
  static int __make_request(request_queue_t * q, int rw,
  				  struct buffer_head * bh)
  {
! 	unsigned int sector, count, sync;
  	int max_segments = MAX_SEGMENTS;
  	struct request * req, *freereq = NULL;
  	int rw_ahead, max_sectors, el_ret;
--- 990,997 ----
  static int __make_request(request_queue_t * q, int rw,
  				  struct buffer_head * bh)
  {
! 	sector_t sector;
! 	int count, sync;
  	int max_segments = MAX_SEGMENTS;
  	struct request * req, *freereq = NULL;
  	int rw_ahead, max_sectors, el_ret;
***************
*** 1178,1184 ****
  }
  
  /**
!  * generic_make_request: hand a buffer head to it's 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.
   *
--- 1179,1185 ----
  }
  
  /**
!  * 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.
   *
***************
*** 1214,1220 ****
  void generic_make_request (int rw, struct buffer_head * bh)
  {
  	int major = MAJOR(bh->b_rdev);
! 	int minorsize = 0;
  	request_queue_t *q;
  
  	if (!bh->b_end_io)
--- 1215,1221 ----
  void generic_make_request (int rw, struct buffer_head * bh)
  {
  	int major = MAJOR(bh->b_rdev);
! 	sector_t minorsize = 0;
  	request_queue_t *q;
  
  	if (!bh->b_end_io)
***************
*** 1224,1231 ****
  	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;
  		unsigned int count = bh->b_size >> 9;
  
  		if (maxsector < count || maxsector - count < sector) {
--- 1225,1232 ----
  	if (blk_size[major])
  		minorsize = blk_size[major][MINOR(bh->b_rdev)];
  	if (minorsize) {
! 		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) {
***************
*** 1237,1245 ****
  			   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",
  			       kdevname(bh->b_rdev), rw,
! 			       (sector + count)>>1, minorsize);
  
  			bh->b_end_io(bh, 0);
  			return;
--- 1238,1247 ----
  			   when mounting a device. */
  			printk(KERN_INFO
  			       "attempt to access beyond end of device\n");
! 			printk(KERN_INFO "%s: rw=%d, want=%llu, limit=%llu\n",
  			       kdevname(bh->b_rdev), rw,
! 			       (unsigned long long)((sector + count)>>1), 
! 			       (unsigned long long)minorsize);
  
  			bh->b_end_io(bh, 0);
  			return;
***************
*** 1259,1266 ****
  		if (!q) {
  			printk(KERN_ERR
  			       "generic_make_request: Trying to access "
! 			       "nonexistent block-device %s (%ld)\n",
! 			       kdevname(bh->b_rdev), bh->b_rsector);
  			buffer_IO_error(bh);
  			break;
  		}
--- 1261,1268 ----
  		if (!q) {
  			printk(KERN_ERR
  			       "generic_make_request: Trying to access "
! 			       "nonexistent block-device %s (%llu)\n",
! 			       kdevname(bh->b_rdev), (unsigned long long)bh->b_rsector);
  			buffer_IO_error(bh);
  			break;
  		}
***************
*** 1461,1468 ****
  
  	req->errors = 0;
  	if (!uptodate)
! 		printk("end_request: I/O error, dev %s (%s), sector %lu\n",
! 			kdevname(req->rq_dev), name, req->sector);
  
  	if ((bh = req->bh) != NULL) {
  		nsect = bh->b_size >> 9;
--- 1463,1470 ----
  
  	req->errors = 0;
  	if (!uptodate)
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/loop.c linux-2.4.22-ashuariadevel/drivers/block/loop.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/loop.c	2003-12-09 11:52:14.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/loop.c	2004-02-02 14:58:01.000000000 +0900
***************
*** 86,92 ****
  
  static int max_loop = 8;
  static struct loop_device *loop_dev;
! static int *loop_sizes;
  static int *loop_blksizes;
  static devfs_handle_t devfs_handle;      /*  For the directory */
  
--- 86,92 ----
  
  static int max_loop = 8;
  static struct loop_device *loop_dev;
! static sector_t *loop_sizes;
  static int *loop_blksizes;
  static devfs_handle_t devfs_handle;      /*  For the directory */
  
***************
*** 94,100 ****
   * Transfer functions
   */
  static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf,
! 			 char *loop_buf, int size, int real_block)
  {
  	if (raw_buf != loop_buf) {
  		if (cmd == READ)
--- 94,100 ----
   * Transfer functions
   */
  static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf,
! 			 char *loop_buf, int size, sector_t real_block)
  {
  	if (raw_buf != loop_buf) {
  		if (cmd == READ)
***************
*** 107,113 ****
  }
  
  static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf,
! 			char *loop_buf, int size, int real_block)
  {
  	char	*in, *out, *key;
  	int	i, keysize;
--- 107,113 ----
  }
  
  static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf,
! 			char *loop_buf, int size, sector_t real_block)
  {
  	char	*in, *out, *key;
  	int	i, keysize;
***************
*** 160,180 ****
  
  #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)
  {
! 	loop_sizes[lo->lo_number] = compute_loop_size(lo,
! 					lo->lo_backing_file->f_dentry,
! 					lo->lo_device);
  }
  
  static int lo_send(struct loop_device *lo, struct buffer_head *bh, int bsize,
--- 160,208 ----
  
  #define MAX_DISK_SIZE 1024*1024*1024
  
! static sector_t compute_loop_size(struct loop_device *lo, struct dentry * lo_dentry, kdev_t lodev)
  {
+ 	/* Got this source from figure_loop_size(...) and need test. by Ashuaria
+ 	 * May have Huge bug. be careful */
+ 	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);
! 
! 	return (sector_t)size;
  }
  
! static int figure_loop_size(struct loop_device *lo)
  {
! 	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,
***************
*** 195,201 ****
  	len = bh->b_size;
  	data = bh->b_data;
  	while (len > 0) {
! 		int IV = index * (PAGE_CACHE_SIZE/bsize) + offset/bsize;
  		int transfer_result;
  
  		size = PAGE_CACHE_SIZE - offset;
--- 201,207 ----
  	len = bh->b_size;
  	data = bh->b_data;
  	while (len > 0) {
! 		sector_t IV = (sector_t)index * (PAGE_CACHE_SIZE/bsize) + offset/bsize;
  		int transfer_result;
  
  		size = PAGE_CACHE_SIZE - offset;
***************
*** 255,261 ****
  	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;
  
  	if (size > count)
  		size = count;
--- 261,267 ----
  	unsigned long count = desc->count;
  	struct lo_read_data *p = (struct lo_read_data*)desc->buf;
  	struct loop_device *lo = p->lo;
! 	sector_t IV = (sector_t)page->index * (PAGE_CACHE_SIZE/p->bsize) + offset/p->bsize;
  
  	if (size > count)
  		size = count;
***************
*** 263,269 ****
  	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);
  		desc->error = -EINVAL;
  	}
  	kunmap(page);
--- 269,275 ----
  	kaddr = kmap(page);
  	if (lo_do_transfer(lo, READ, kaddr + offset, p->data, size, IV)) {
  		size = 0;
! 		printk(KERN_ERR "loop: transfer error block %lu\n",page->index);
  		desc->error = -EINVAL;
  	}
  	kunmap(page);
***************
*** 321,335 ****
  	return bs;
  }
  
! static inline unsigned long loop_get_iv(struct loop_device *lo,
! 					unsigned long sector)
  {
  	int bs = loop_get_bs(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++;
  
  	return IV;
--- 327,355 ----
  	return bs;
  }
  
! 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 & ((1 << (bs-9)) - 1))<<9) + (lo->lo_offset & ((1 << bs)-1));
! 
! 	if (offset >= (1 << bs))
  		IV++;
  
  	return IV;
***************
*** 571,577 ****
  		bh->b_end_io(bh, !ret);
  	} else {
  		struct buffer_head *rbh = bh->b_private;
! 		unsigned long IV = loop_get_iv(lo, rbh->b_rsector);
  
  		ret = lo_do_transfer(lo, READ, bh->b_data, rbh->b_data,
  				     bh->b_size, IV);
--- 591,597 ----
  		bh->b_end_io(bh, !ret);
  	} else {
  		struct buffer_head *rbh = bh->b_private;
! 		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);
***************
*** 717,723 ****
                 lo->lo_change = NULL;
                 lo->transfer = NULL;
                 lo->ioctl = NULL;
!                figure_loop_size(lo);
                 lo->old_gfp_mask = inode->i_mapping->gfp_mask;
                 inode->i_mapping->gfp_mask &= ~(__GFP_IO|__GFP_FS);
  
--- 737,747 ----
                 lo->lo_change = NULL;
                 lo->transfer = NULL;
                 lo->ioctl = NULL;
!                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_IO|__GFP_FS);
  
***************
*** 860,865 ****
--- 884,890 ----
  {
  	struct loop_info info; 
  	int err;
+ 	loff_t offset;
  	unsigned int type;
  
  	if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid && 
***************
*** 879,888 ****
  	err = loop_release_xfer(lo);
  	if (!err) 
  		err = loop_init_xfer(lo, type, &info);
  	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;
--- 904,921 ----
  	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;	
  
  	strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE);
  
  	lo->transfer = xfer_funcs[type]->transfer;
***************
*** 960,971 ****
  		err = loop_get_status(lo, (struct loop_info *) arg);
  		break;
  	case BLKGETSIZE:
  		if (lo->lo_state != Lo_bound) {
  			err = -ENXIO;
  			break;
  		}
! 		err = put_user((unsigned long)loop_sizes[lo->lo_number] << 1, (unsigned long *) arg);
  		break;
  	case BLKGETSIZE64:
  		if (lo->lo_state != Lo_bound) {
  			err = -ENXIO;
--- 993,1011 ----
  		err = loop_get_status(lo, (struct loop_info *) arg);
  		break;
  	case BLKGETSIZE:
+ 	{
+ 		unsigned long val;
  		if (lo->lo_state != Lo_bound) {
  			err = -ENXIO;
  			break;
  		}
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/nbd.c linux-2.4.22-ashuariadevel/drivers/block/nbd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/nbd.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/nbd.c	2004-02-02 14:35:08.000000000 +0900
***************
*** 59,65 ****
  
  static int nbd_blksizes[MAX_NBD];
  static int nbd_blksize_bits[MAX_NBD];
! static int nbd_sizes[MAX_NBD];
  static u64 nbd_bytesizes[MAX_NBD];
  
  static struct nbd_device nbd_dev[MAX_NBD];
--- 59,65 ----
  
  static int nbd_blksizes[MAX_NBD];
  static int nbd_blksize_bits[MAX_NBD];
! static sector_t nbd_sizes[MAX_NBD];
  static u64 nbd_bytesizes[MAX_NBD];
  
  static struct nbd_device nbd_dev[MAX_NBD];
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/paride/pd.c linux-2.4.22-ashuariadevel/drivers/block/paride/pd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/paride/pd.c	2002-11-29 08:53:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/paride/pd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 286,292 ****
  static void pd_eject( int unit);
  
  static struct hd_struct pd_hd[PD_DEVS];
! static int pd_sizes[PD_DEVS];
  static int pd_blocksizes[PD_DEVS];
  static int pd_maxsectors[PD_DEVS];
  
--- 286,292 ----
  static void pd_eject( int unit);
  
  static struct hd_struct pd_hd[PD_DEVS];
! static sector_t pd_sizes[PD_DEVS];
  static int pd_blocksizes[PD_DEVS];
  static int pd_maxsectors[PD_DEVS];
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/ps2esdi.c linux-2.4.22-ashuariadevel/drivers/block/ps2esdi.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/ps2esdi.c	2002-11-29 08:53:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/ps2esdi.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 116,122 ****
  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 int ps2esdi_blocksizes[MAX_HD << 6];
  static int ps2esdi_maxsect[MAX_HD << 6];
  static int ps2esdi_drives;
--- 116,122 ----
  static int no_int_yet;
  static int access_count[MAX_HD];
  static char ps2esdi_valid[MAX_HD];
! 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,523 ****
  	/* 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);
  		end_request(FAIL);
  	}
  
--- 517,523 ----
  	/* is request is valid */ 
  	else {
  		printk("Grrr. error. ps2esdi_drives: %d, %lu %lu\n", ps2esdi_drives,
! 		       (unsigned long)CURRENT->sector, (unsigned long)ps2esdi[MINOR(CURRENT->rq_dev)].nr_sects);
  		end_request(FAIL);
  	}
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/rd.c linux-2.4.22-ashuariadevel/drivers/block/rd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/rd.c	2002-11-29 08:53:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/rd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 75,81 ****
  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 devfs_handle_t devfs_handle;
  static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
  
--- 75,81 ----
  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 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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/umem.c linux-2.4.22-ashuariadevel/drivers/block/umem.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/umem.c	2003-06-13 23:51:32.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/umem.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 161,167 ****
  
  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 struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT];
  
  static int num_cards = 0;
--- 161,167 ----
  
  static int              mm_hardsect  [MM_MAXCARDS << MM_SHIFT];
  static int              mm_blocksizes[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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/block/xd.c linux-2.4.22-ashuariadevel/drivers/block/xd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/block/xd.c	2002-11-29 08:53:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/block/xd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 121,127 ****
  };
  
  static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
! static int xd_sizes[XD_MAXDRIVES << 6], xd_access[XD_MAXDRIVES];
  static int xd_blocksizes[XD_MAXDRIVES << 6];
  static int xd_maxsect[XD_MAXDRIVES << 6];
  
--- 121,127 ----
  };
  
  static struct hd_struct xd_struct[XD_MAXDRIVES << 6];
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/char/raw.c linux-2.4.22-ashuariadevel/drivers/char/raw.c
*** linux-2.4.22-ashuariadevel.backup/drivers/char/raw.c	2003-12-09 11:52:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/char/raw.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 287,293 ****
  {
  	struct kiobuf * iobuf;
  	int		err = 0;
! 	unsigned long	blocknr, blocks;
  	size_t		transferred;
  	int		iosize;
  	int		i;
--- 287,294 ----
  {
  	struct kiobuf * iobuf;
  	int		err = 0;
! 	sector_t	blocknr;
! 	unsigned long	blocks;
  	size_t		transferred;
  	int		iosize;
  	int		i;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-cd.c linux-2.4.22-ashuariadevel/drivers/ide/ide-cd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-cd.c	2003-12-09 11:52:14.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-cd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1211,1218 ****
  	   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);
  		cdrom_end_request(drive, 0);
  		return -1;
  	}
--- 1211,1218 ----
  	   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 (%llu)\n",
! 			drive->name, (unsigned long long)rq->sector);
  		cdrom_end_request(drive, 0);
  		return -1;
  	}
***************
*** 1848,1855 ****
   * cdrom driver request routine.
   */
  static ide_startstop_t
! ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, unsigned long block)
  {
  	ide_startstop_t action;
  	struct cdrom_info *info = drive->driver_data;
  
--- 1848,1856 ----
   * cdrom driver request routine.
   */
  static ide_startstop_t
! 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;
  
***************
*** 3089,3102 ****
  }
  
  static
! unsigned long ide_cdrom_capacity (ide_drive_t *drive)
  {
  	unsigned long capacity;
  
  	if (cdrom_read_capacity(drive, &capacity, NULL))
  		return 0;
  
! 	return capacity * SECTORS_PER_FRAME;
  }
  
  static
--- 3090,3103 ----
  }
  
  static
! sector_t ide_cdrom_capacity (ide_drive_t *drive)
  {
  	unsigned long capacity;
  
  	if (cdrom_read_capacity(drive, &capacity, NULL))
  		return 0;
  
! 	return (sector_t)capacity * SECTORS_PER_FRAME;
  }
  
  static
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-disk.c linux-2.4.22-ashuariadevel/drivers/ide/ide-disk.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-disk.c	2003-12-09 11:52:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-disk.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 360,366 ****
   * It also takes care of issuing special DRIVE_CMDs.
   */
  
! ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
  {
  	ide_hwif_t *hwif	= HWIF(drive);
  	u8 lba48		= (drive->addressing == 1) ? 1 : 0;
--- 360,366 ----
   * It also takes care of issuing special DRIVE_CMDs.
   */
  
! ide_startstop_t __ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block)
  {
  	ide_hwif_t *hwif	= HWIF(drive);
  	u8 lba48		= (drive->addressing == 1) ? 1 : 0;
***************
*** 387,396 ****
  			tasklets[5] = (task_ioreg_t) (block>>8);
  			tasklets[6] = (task_ioreg_t) (block>>16);
  			tasklets[7] = (task_ioreg_t) (block>>24);
  			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);
  #ifdef DEBUG
  			printk("%s: %sing: LBAsect=%lu, sectors=%ld, "
  				"buffer=0x%08lx, LBAsect=0x%012lx\n",
--- 387,399 ----
  			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;
! #endif
  #ifdef DEBUG
  			printk("%s: %sing: LBAsect=%lu, sectors=%ld, "
  				"buffer=0x%08lx, LBAsect=0x%012lx\n",
***************
*** 434,441 ****
  		}
  	} else {
  		unsigned int sect,head,cyl,track;
! 		track = block / drive->sect;
! 		sect  = block % drive->sect + 1;
  		hwif->OUTB(sect, IDE_SECTOR_REG);
  		head  = track % drive->head;
  		cyl   = track / drive->head;
--- 437,444 ----
  		}
  	} else {
  		unsigned int sect,head,cyl,track;
! 		track = (unsigned int)block / drive->sect;
! 		sect  = (unsigned int)block % drive->sect + 1;
  		hwif->OUTB(sect, IDE_SECTOR_REG);
  		head  = track % drive->head;
  		cyl   = track / drive->head;
***************
*** 695,701 ****
  
  #endif /* CONFIG_IDE_TASKFILE_IO */
  
! static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, unsigned long block)
  {
  	ide_hwif_t *hwif	= HWIF(drive);
  	if (hwif->rw_disk)
--- 698,704 ----
  
  #endif /* CONFIG_IDE_TASKFILE_IO */
  
! static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, sector_t block)
  {
  	ide_hwif_t *hwif	= HWIF(drive);
  	if (hwif->rw_disk)
***************
*** 879,886 ****
  				}
  			}
  			if (HWGROUP(drive) && HWGROUP(drive)->rq)
! 				printk(", sector=%ld",
! 					HWGROUP(drive)->rq->sector);
  		}
  	}
  #endif	/* FANCY_STATUS_DUMPS */
--- 882,889 ----
  				}
  			}
  			if (HWGROUP(drive) && HWGROUP(drive)->rq)
! 				printk(", sector=%llu",
! 				       (unsigned long long)HWGROUP(drive)->rq->sector);
  		}
  	}
  #endif	/* FANCY_STATUS_DUMPS */
***************
*** 1233,1239 ****
  	}
  }
  
! static unsigned long idedisk_capacity (ide_drive_t *drive)
  {
  	if (drive->id->cfs_enable_2 & 0x0400)
  		return (drive->capacity48 - drive->sect0);
--- 1236,1242 ----
  	}
  }
  
! static sector_t idedisk_capacity (ide_drive_t *drive)
  {
  	if (drive->id->cfs_enable_2 & 0x0400)
  		return (drive->capacity48 - drive->sect0);
***************
*** 1682,1698 ****
  
  	/*
  	 * if possible, give fdisk access to more of the drive,
! 	 * 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);
  
  	/* Give size in megabytes (MB), not mebibytes (MiB). */
  	/* We compute the exact rounded value, avoiding overflow. */
! 	printk (" (%ld MB)", (capacity - capacity/625 + 974)/1950);
  
  	/* Only print cache size when it was specified */
  	if (id->buf_size)
--- 1685,1712 ----
  
  	/*
  	 * if possible, give fdisk access to more of the drive,
!  	 * by correcting bios_cyls:
  	 */
  	capacity = idedisk_capacity (drive);
! 	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. */
! 	{
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-floppy.c linux-2.4.22-ashuariadevel/drivers/ide/ide-floppy.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-floppy.c	2003-08-25 20:44:41.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-floppy.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1262,1278 ****
  /*
   *	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)
  {
  	idefloppy_floppy_t *floppy = drive->driver_data;
  	idefloppy_pc_t *pc;
  
  #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);
  #endif /* IDEFLOPPY_DEBUG_LOG */
  
  	if (rq->errors >= ERROR_MAX) {
--- 1262,1280 ----
  /*
   *	idefloppy_do_request is our request handling function.	
   */
! 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 = (unsigned long)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: %llu, nr_sectors: %ld, "
! 	       "current_nr_sectors: %ld\n", (unsigned long long)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) {
***************
*** 1290,1296 ****
  	switch (rq->cmd) {
  		case READ:
  		case WRITE:
! 			if (rq->sector % floppy->bs_factor ||
  			    rq->nr_sectors % floppy->bs_factor) {
  				printk("%s: unsupported r/w request size\n",
  					drive->name);
--- 1292,1298 ----
  	switch (rq->cmd) {
  		case READ:
  		case WRITE:
! 			if (block % floppy->bs_factor ||
  			    rq->nr_sectors % floppy->bs_factor) {
  				printk("%s: unsupported r/w request size\n",
  					drive->name);
***************
*** 1846,1857 ****
  /*
   *	Return the current floppy capacity to ide.c.
   */
! static unsigned long idefloppy_capacity (ide_drive_t *drive)
  {
  	idefloppy_floppy_t *floppy = drive->driver_data;
  	unsigned long capacity = floppy->blocks * floppy->bs_factor;
  
! 	return capacity;
  }
  
  /*
--- 1848,1859 ----
  /*
   *	Return the current floppy capacity to ide.c.
   */
! 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 (sector_t)capacity;
  }
  
  /*
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-probe.c linux-2.4.22-ashuariadevel/drivers/ide/ide-probe.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-probe.c	2003-12-09 11:52:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-probe.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1179,1185 ****
  		goto err_kmalloc_gd;
  	memset(gd, 0, sizeof(struct gendisk));
  	
! 	gd->sizes = kmalloc(minors * sizeof(int), GFP_KERNEL);
  	if (!gd->sizes)
  		goto err_kmalloc_gd_sizes;
  	gd->part  = kmalloc(minors * sizeof(struct hd_struct), GFP_KERNEL);
--- 1179,1185 ----
  		goto err_kmalloc_gd;
  	memset(gd, 0, sizeof(struct gendisk));
  	
! 	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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-tape.c linux-2.4.22-ashuariadevel/drivers/ide/ide-tape.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-tape.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-tape.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2783,2789 ****
  /*
   *	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)
  {
  	idetape_tape_t *tape = drive->driver_data;
  	idetape_pc_t *pc;
--- 2783,2789 ----
  /*
   *	idetape_do_request is our request handling function.	
   */
! 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;
***************
*** 2796,2804 ****
  			"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);
  #endif /* IDETAPE_DEBUG_LOG */
  
  	if (!IDETAPE_RQ_CMD(rq->cmd)) {
--- 2796,2805 ----
  			"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: %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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-taskfile.c linux-2.4.22-ashuariadevel/drivers/ide/ide-taskfile.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide-taskfile.c	2003-06-13 23:51:33.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide-taskfile.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 329,336 ****
  				}
  			}
  			if (HWGROUP(drive)->rq)
! 				printk(", sector=%lu",
! 					HWGROUP(drive)->rq->sector);
  		}
  media_out:
  #endif  /* FANCY_STATUS_DUMPS */
--- 329,336 ----
  				}
  			}
  			if (HWGROUP(drive)->rq)
! 				printk(", sector=%llu",
! 				       (unsigned long long)HWGROUP(drive)->rq->sector);
  		}
  media_out:
  #endif  /* FANCY_STATUS_DUMPS */
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/ide.c linux-2.4.22-ashuariadevel/drivers/ide/ide.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/ide.c	2003-12-09 11:52:12.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/ide.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 431,437 ****
  					}
  				}
  				if (HWGROUP(drive) && HWGROUP(drive)->rq)
! 					printk(", sector=%ld", HWGROUP(drive)->rq->sector);
  			}
  		}
  #endif	/* FANCY_STATUS_DUMPS */
--- 431,438 ----
  					}
  				}
  				if (HWGROUP(drive) && HWGROUP(drive)->rq)
! 					printk(", sector=%llu", 
! 					       (unsigned long long)HWGROUP(drive)->rq->sector);
  			}
  		}
  #endif	/* FANCY_STATUS_DUMPS */
***************
*** 2693,2699 ****
  	return 0;
  }
  
! static ide_startstop_t default_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
  {
  	ide_end_request(drive, 0);
  	return ide_stopped;
--- 2694,2700 ----
  	return 0;
  }
  
! static ide_startstop_t default_do_request(ide_drive_t *drive, struct request *rq, sector_t block)
  {
  	ide_end_request(drive, 0);
  	return ide_stopped;
***************
*** 2744,2752 ****
  {
  }
  
! static unsigned long default_capacity (ide_drive_t *drive)
  {
! 	return 0x7fffffff;
  }
  
  static ide_startstop_t default_special (ide_drive_t *drive)
--- 2745,2753 ----
  {
  }
  
! static sector_t default_capacity (ide_drive_t *drive)
  {
! 	return (sector_t)0x7fffffff;
  }
  
  static ide_startstop_t default_special (ide_drive_t *drive)
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/legacy/hd.c linux-2.4.22-ashuariadevel/drivers/ide/legacy/hd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/legacy/hd.c	2003-06-13 23:51:33.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/legacy/hd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 104,110 ****
  #endif
  
  static struct hd_struct hd[MAX_HD<<6];
! static int hd_sizes[MAX_HD<<6];
  static int hd_blocksizes[MAX_HD<<6];
  static int hd_hardsectsizes[MAX_HD<<6];
  static int hd_maxsect[MAX_HD<<6];
--- 104,110 ----
  #endif
  
  static struct hd_struct hd[MAX_HD<<6];
! static sector_t hd_sizes[MAX_HD<<6];
  static int hd_blocksizes[MAX_HD<<6];
  static int hd_hardsectsizes[MAX_HD<<6];
  static int hd_maxsect[MAX_HD<<6];
***************
*** 817,823 ****
  		hd[drive<<6].nr_sects = hd_info[drive].head *
  			hd_info[drive].sect * hd_info[drive].cyl;
  		printk ("hd%c: %ldMB, CHS=%d/%d/%d\n", drive+'a',
! 			hd[drive<<6].nr_sects / 2048, hd_info[drive].cyl,
  			hd_info[drive].head, hd_info[drive].sect);
  	}
  	if (!NR_HD)
--- 817,823 ----
  		hd[drive<<6].nr_sects = hd_info[drive].head *
  			hd_info[drive].sect * hd_info[drive].cyl;
  		printk ("hd%c: %ldMB, CHS=%d/%d/%d\n", drive+'a',
! 			(long)hd[drive<<6].nr_sects / 2048, hd_info[drive].cyl,
  			hd_info[drive].head, hd_info[drive].sect);
  	}
  	if (!NR_HD)
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/legacy/pdc4030.c linux-2.4.22-ashuariadevel/drivers/ide/legacy/pdc4030.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/legacy/pdc4030.c	2003-08-25 20:44:41.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/legacy/pdc4030.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 434,441 ****
  #endif /* CONFIG_IDE_TASKFILE_IO */
  
  #ifdef DEBUG_READ
! 	printk(KERN_DEBUG "%s:  promise_read: sectors(%ld-%ld), "
! 	       "buf=0x%08lx, rem=%ld\n", drive->name, rq->sector,
  	       rq->sector+nsect-1,
  #ifdef CONFIG_IDE_TASKFILE_IO
  		(unsigned long) to,
--- 434,441 ----
  #endif /* CONFIG_IDE_TASKFILE_IO */
  
  #ifdef DEBUG_READ
! 	printk(KERN_DEBUG "%s:  promise_read: sectors(%llu-%llu), "
! 	       "buf=0x%08lx, rem=%lu\n", drive->name, rq->sector,
  	       rq->sector+nsect-1,
  #ifdef CONFIG_IDE_TASKFILE_IO
  		(unsigned long) to,
***************
*** 654,660 ****
  	struct request *rq = &hwgroup->wrq;
  
  #ifdef DEBUG_WRITE
! 	printk(KERN_DEBUG "%s: promise_write: sectors(%ld-%ld), "
  	       "buffer=%p\n", drive->name, rq->sector,
  	       rq->sector + rq->nr_sectors - 1, rq->buffer);
  #endif /* DEBUG_WRITE */
--- 654,660 ----
  	struct request *rq = &hwgroup->wrq;
  
  #ifdef DEBUG_WRITE
! 	printk(KERN_DEBUG "%s: promise_write: sectors(%llu-%llu), "
  	       "buffer=%p\n", drive->name, rq->sector,
  	       rq->sector + rq->nr_sectors - 1, rq->buffer);
  #endif /* DEBUG_WRITE */
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/ide/raid/ataraid.c linux-2.4.22-ashuariadevel/drivers/ide/raid/ataraid.c
*** linux-2.4.22-ashuariadevel.backup/drivers/ide/raid/ataraid.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/ide/raid/ataraid.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 47,53 ****
  
  
  struct gendisk ataraid_gendisk;
! static int ataraid_gendisk_sizes[256];
  static int ataraid_readahead[256];
  
  static struct block_device_operations ataraid_fops = {
--- 47,53 ----
  
  
  struct gendisk ataraid_gendisk;
! static sector_t ataraid_gendisk_sizes[256];
  static int ataraid_readahead[256];
  
  static struct block_device_operations ataraid_fops = {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/linear.c linux-2.4.22-ashuariadevel/drivers/md/linear.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/linear.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/linear.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 32,39 ****
  	linear_conf_t *conf;
  	struct linear_hash *table;
  	mdk_rdev_t *rdev;
! 	int size, i, j, nb_zone;
! 	unsigned int curr_offset;
  
  	MOD_INC_USE_COUNT;
  
--- 32,40 ----
  	linear_conf_t *conf;
  	struct linear_hash *table;
  	mdk_rdev_t *rdev;
! 	s64 size;
! 	int i, j, nb_zone;
! 	sector_t curr_offset;
  
  	MOD_INC_USE_COUNT;
  
***************
*** 54,63 ****
--- 55,70 ----
  	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,74 ****
  			conf->smallest = disk;
  	}
  
! 	nb_zone = conf->nr_zones =
! 		md_size[mdidx(mddev)] / conf->smallest->size +
! 		((md_size[mdidx(mddev)] % conf->smallest->size) ? 1 : 0);
!   
  	conf->hash_table = kmalloc (sizeof (struct linear_hash) * nb_zone,
  					GFP_KERNEL);
  	if (!conf->hash_table)
--- 72,85 ----
  			conf->smallest = disk;
  	}
  
! 
! 
! 	{
! 		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,93 ****
  			table[-1].dev1 = disk;
  		}
  		size += disk->size;
- 
  		while (size>0) {
  			table->dev0 = disk;
  			table->dev1 = NULL;
--- 98,103 ----
***************
*** 125,139 ****
          linear_conf_t *conf = mddev_to_conf(mddev);
          struct linear_hash *hash;
          dev_info_t *tmp_dev;
!         long block;
  
  	block = bh->b_rsector >> 1;
! 	hash = conf->hash_table + (block / conf->smallest->size);
    
  	if (block >= (hash->dev0->size + hash->dev0->offset)) {
  		if (!hash->dev1) {
! 			printk ("linear_make_request : hash->dev1==NULL for block %ld\n",
! 						block);
  			buffer_IO_error(bh);
  			return 0;
  		}
--- 135,155 ----
          linear_conf_t *conf = mddev_to_conf(mddev);
          struct linear_hash *hash;
          dev_info_t *tmp_dev;
!         sector_t block;
! 	sector_t hashindex;
  
  	block = bh->b_rsector >> 1;
! 
! 	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 %llu\n",
! 						(unsigned long long)block);
  			buffer_IO_error(bh);
  			return 0;
  		}
***************
*** 143,149 ****
      
  	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);
  		buffer_IO_error(bh);
  		return 0;
  	}
--- 159,169 ----
      
  	if (block >= (tmp_dev->size + tmp_dev->offset)
  				|| block < 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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/lvm-snap.c linux-2.4.22-ashuariadevel/drivers/md/lvm-snap.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/lvm-snap.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/lvm-snap.c	2004-02-02 15:14:47.000000000 +0900
***************
*** 71,78 ****
  
  
  static inline int __brw_kiovec(int rw, int nr, struct kiobuf *iovec[],
! 			       kdev_t dev, unsigned long b[], int size,
! 			       lv_t *lv) {
  	return brw_kiovec(rw, nr, iovec, dev, b, size);
  }
  
--- 71,78 ----
  
  
  static inline int __brw_kiovec(int rw, int nr, struct kiobuf *iovec[],
! 			     kdev_t dev, sector_t b[], int size,
! 			     lv_t * lv) {
  	return brw_kiovec(rw, nr, iovec, dev, b, size);
  }
  
***************
*** 220,229 ****
  	       reason);
  }
  
! static inline int lvm_snapshot_prepare_blocks(unsigned long *blocks,
! 					       unsigned long start,
! 					       int nr_sectors,
! 					       int blocksize)
  {
  	int i, sectors_per_block, nr_blocks;
  
--- 220,229 ----
  	       reason);
  }
  
! static inline int lvm_snapshot_prepare_blocks(sector_t *blocks,
! 					    sector_t start,
! 					    int nr_sectors,
! 					    int blocksize)
  {
  	int i, sectors_per_block, nr_blocks;
  
***************
*** 233,239 ****
  		return 0;
  
  	nr_blocks = nr_sectors / sectors_per_block;
! 	start /= sectors_per_block;
  
  	for (i = 0; i < nr_blocks; i++)
  		blocks[i] = start++;
--- 233,239 ----
  		return 0;
  
  	nr_blocks = nr_sectors / sectors_per_block;
! 	sector_div(start, sectors_per_block);
  
  	for (i = 0; i < nr_blocks; i++)
  		blocks[i] = start++;
***************
*** 441,447 ****
  	unsigned long org_start, snap_start, snap_phys_dev, virt_start, pe_off;
  	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;
  	int blksize_snap, blksize_org, min_blksize, max_blksize;
  	int max_sectors, nr_sectors;
  
--- 441,447 ----
  	unsigned long org_start, snap_start, snap_phys_dev, virt_start, pe_off;
  	int idx = lv_snap->lv_remap_ptr, chunk_size = lv_snap->lv_chunk_size;
  	struct kiobuf * iobuf = lv_snap->lv_iobuf;
! 	sector_t *blocks = iobuf->blocks;
  	int blksize_snap, blksize_org, min_blksize, max_blksize;
  	int max_sectors, nr_sectors;
  
***************
*** 659,666 ****
  	int idx_COW_table;
  	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];
  	kdev_t snap_phys_dev;
  	lv_block_exception_t *be;
  	struct kiobuf *COW_table_iobuf = lv_snap->lv_COW_table_iobuf;
--- 659,666 ----
  	int idx_COW_table;
  	uint pvn;
  	ulong snap_pe_start, COW_table_sector_offset,
! 	    COW_entries_per_pe, COW_chunks_per_pe, COW_entries_per_block;
! 	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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/lvm.c linux-2.4.22-ashuariadevel/drivers/md/lvm.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/lvm.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/lvm.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 427,433 ****
  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 mempool_t *lvm_callback_mempool;
  
--- 427,433 ----
  static struct hd_struct lvm_hd_struct[MAX_LV];
  static int lvm_blocksizes[MAX_LV];
  static int lvm_hardsectsizes[MAX_LV];
! static sector_t lvm_size[MAX_LV];
  
  static mempool_t *lvm_callback_mempool;
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/md.c linux-2.4.22-ashuariadevel/drivers/md/md.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/md.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/md.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 109,115 ****
  static int md_maxreadahead[MAX_MD_DEVS];
  static mdk_thread_t *md_recovery_thread;
  
! int md_size[MAX_MD_DEVS];
  
  static struct block_device_operations md_fops;
  static devfs_handle_t devfs_handle;
--- 109,115 ----
  static int md_maxreadahead[MAX_MD_DEVS];
  static mdk_thread_t *md_recovery_thread;
  
! sector_t md_size[MAX_MD_DEVS];
  
  static struct block_device_operations md_fops;
  static devfs_handle_t devfs_handle;
***************
*** 282,291 ****
  	return dname->name;
  }
  
! static unsigned int calc_dev_sboffset(kdev_t dev, mddev_t *mddev,
  						int persistent)
  {
! 	unsigned int size = 0;
  
  	if (blk_size[MAJOR(dev)])
  		size = blk_size[MAJOR(dev)][MINOR(dev)];
--- 282,291 ----
  	return dname->name;
  }
  
! static sector_t calc_dev_sboffset(kdev_t dev, mddev_t *mddev,
  						int persistent)
  {
! 	sector_t size = 0;
  
  	if (blk_size[MAJOR(dev)])
  		size = blk_size[MAJOR(dev)][MINOR(dev)];
***************
*** 294,302 ****
  	return size;
  }
  
! static unsigned int calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent)
  {
! 	unsigned int size;
  
  	size = calc_dev_sboffset(dev, mddev, persistent);
  	if (!mddev->sb) {
--- 294,302 ----
  	return size;
  }
  
! static sector_t calc_dev_size(kdev_t dev, mddev_t *mddev, int persistent)
  {
! 	sector_t size;
  
  	size = calc_dev_sboffset(dev, mddev, persistent);
  	if (!mddev->sb) {
***************
*** 304,316 ****
  		return size;
  	}
  	if (mddev->sb->chunk_size)
! 		size &= ~(mddev->sb->chunk_size/1024 - 1);
  	return size;
  }
  
  static unsigned int zoned_raid_size(mddev_t *mddev)
  {
! 	unsigned int mask;
  	mdk_rdev_t * rdev;
  	struct md_list_head *tmp;
  
--- 304,316 ----
  		return size;
  	}
  	if (mddev->sb->chunk_size)
! 		size &= ~((sector_t)mddev->sb->chunk_size/1024 - 1);
  	return size;
  }
  
  static unsigned int zoned_raid_size(mddev_t *mddev)
  {
! 	sector_t mask;
  	mdk_rdev_t * rdev;
  	struct md_list_head *tmp;
  
***************
*** 321,327 ****
  	/*
  	 * do size and offset calculations.
  	 */
! 	mask = ~(mddev->sb->chunk_size/1024 - 1);
  
  	ITERATE_RDEV(mddev,rdev,tmp) {
  		rdev->size &= mask;
--- 321,327 ----
  	/*
  	 * do size and offset calculations.
  	 */
! 	mask = ~((sector_t)mddev->sb->chunk_size/1024 - 1);
  
  	ITERATE_RDEV(mddev,rdev,tmp) {
  		rdev->size &= mask;
***************
*** 331,337 ****
  }
  
  /*
!  * We check wether 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
--- 331,337 ----
  }
  
  /*
!  * 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
***************
*** 506,512 ****
  {
  	int ret = -EINVAL;
  	kdev_t dev = rdev->dev;
! 	unsigned long sb_offset;
  
  	if (!rdev->sb) {
  		MD_BUG();
--- 506,512 ----
  {
  	int ret = -EINVAL;
  	kdev_t dev = rdev->dev;
! 	sector_t sb_offset;
  
  	if (!rdev->sb) {
  		MD_BUG();
***************
*** 808,814 ****
  {
  	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);
  	if (rdev->sb) {
  		printk(KERN_INFO "md: rdev superblock:\n");
  		print_sb(rdev->sb);
--- 808,814 ----
  {
  	printk(KERN_INFO "md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ",
  		partition_name(rdev->dev), partition_name(rdev->old_dev),
! 		(long)rdev->size, rdev->faulty, rdev->desc_nr);
  	if (rdev->sb) {
  		printk(KERN_INFO "md: rdev superblock:\n");
  		print_sb(rdev->sb);
***************
*** 915,921 ****
  static int write_disk_sb(mdk_rdev_t * rdev)
  {
  	kdev_t dev;
! 	unsigned long sb_offset, size;
  
  	if (!rdev->sb) {
  		MD_BUG();
--- 915,921 ----
  static int write_disk_sb(mdk_rdev_t * rdev)
  {
  	kdev_t dev;
! 	sector_t sb_offset, size;
  
  	if (!rdev->sb) {
  		MD_BUG();
***************
*** 933,940 ****
  	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);
  		goto skip;
  	}
  	/*
--- 933,940 ----
  	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 %llu to %llu, skipping\n",
! 		       partition_name(dev), (unsigned long long)rdev->sb_offset, (unsigned long long)sb_offset);
  		goto skip;
  	}
  	/*
***************
*** 944,955 ****
  	 */
  	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);
  		goto skip;
  	}
  
! 	printk(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset);
  
  	if (!sync_page_io(dev, sb_offset<<1, MD_SB_BYTES, rdev->sb_page, WRITE)) {
  		printk("md: write_disk_sb failed for device %s\n", partition_name(dev));
--- 944,957 ----
  	 */
  	size = calc_dev_size(dev, rdev->mddev, 1);
  	if (size != rdev->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: %llu\n", partition_name(dev), (unsigned long long)sb_offset);
  
  	if (!sync_page_io(dev, sb_offset<<1, MD_SB_BYTES, rdev->sb_page, WRITE)) {
  		printk("md: write_disk_sb failed for device %s\n", partition_name(dev));
***************
*** 1084,1090 ****
  {
  	int err;
  	mdk_rdev_t *rdev;
! 	unsigned int size;
  
  	if (find_rdev_all(newdev))
  		return -EEXIST;
--- 1086,1092 ----
  {
  	int err;
  	mdk_rdev_t *rdev;
! 	sector_t size;
  
  	if (find_rdev_all(newdev))
  		return -EEXIST;
***************
*** 1549,1557 ****
  		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",
  				partition_name(rdev->dev),
! 				rdev->size, sb->chunk_size / 1024);
  			return -EINVAL;
  		}
  	}
--- 1551,1559 ----
  		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: %lluk < %dk\n",
  				partition_name(rdev->dev),
! 				(unsigned long long)rdev->size, sb->chunk_size / 1024);
  			return -EINVAL;
  		}
  	}
***************
*** 2193,2199 ****
  
  static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
  {
! 	int err, size, persistent;
  	mdk_rdev_t *rdev;
  	unsigned int nr;
  	kdev_t dev;
--- 2195,2202 ----
  
  static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
  {
! 	int err, persistent;
! 	sector_t size;
  	mdk_rdev_t *rdev;
  	unsigned int nr;
  	kdev_t dev;
***************
*** 2380,2386 ****
  static int hot_add_disk(mddev_t * mddev, kdev_t dev)
  {
  	int i, err, persistent;
! 	unsigned int size;
  	mdk_rdev_t *rdev;
  	mdp_disk_t *disk;
  
--- 2383,2389 ----
  static int hot_add_disk(mddev_t * mddev, kdev_t dev)
  {
  	int i, err, persistent;
! 	sector_t size;
  	mdk_rdev_t *rdev;
  	mdp_disk_t *disk;
  
***************
*** 2421,2428 ****
  	size = calc_dev_size(dev, mddev, persistent);
  
  	if (size < mddev->sb->size) {
! 		printk(KERN_WARNING "md%d: disk size %d blocks < array size %d\n",
! 				mdidx(mddev), size, mddev->sb->size);
  		err = -ENOSPC;
  		goto abort_export;
  	}
--- 2424,2432 ----
  	size = calc_dev_size(dev, mddev, persistent);
  
  	if (size < mddev->sb->size) {
! 		printk(KERN_WARNING "md%d: disk size %llu blocks < array size %llu\n",
! 		       mdidx(mddev), (unsigned long long)size,
! 		       (unsigned long long)mddev->sb->size);
  		err = -ENOSPC;
  		goto abort_export;
  	}
***************
*** 2864,2870 ****
  
  		default:
  			printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, "
! 			       "upgrade your software to use new ictls.\n",
  			       current->comm, current->pid);
  			err = -EINVAL;
  			goto abort_unlock;
--- 2868,2874 ----
  
  		default:
  			printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, "
! 			       "upgrade your software to use new ioctls.\n",
  			       current->comm, current->pid);
  			err = -EINVAL;
  			goto abort_unlock;
***************
*** 3253,3262 ****
  
  	if (mddev->nb_dev) {
  		if (mddev->pers)
! 			seq_printf(seq, "\n      %d blocks",
! 				   md_size[mdidx(mddev)]);
  		else
! 			seq_printf(seq, "\n      %d blocks", size);
  	}
  
  	if (mddev->pers) {
--- 3257,3266 ----
  
  	if (mddev->nb_dev) {
  		if (mddev->pers)
! 			seq_printf(seq, "\n      %llu blocks",
! 				   (unsigned long long)md_size[mdidx(mddev)]);
  		else
! 			seq_printf(seq, "\n      %llu blocks", (unsigned long long)size);
  	}
  
  	if (mddev->pers) {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/multipath.c linux-2.4.22-ashuariadevel/drivers/md/multipath.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/multipath.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/multipath.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 216,223 ****
  	/*
  	 * oops, IO error:
  	 */
! 	printk(KERN_ERR "multipath: %s: rescheduling block %lu\n", 
! 		 partition_name(bh->b_dev), bh->b_blocknr);
  	multipath_reschedule_retry(mp_bh);
  	return;
  }
--- 216,223 ----
  	/*
  	 * oops, IO error:
  	 */
! 	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;
  }
***************
*** 669,678 ****
  
  
  #define IO_ERROR KERN_ALERT \
! "multipath: %s: unrecoverable IO read error for block %lu\n"
  
  #define REDIRECT_SECTOR KERN_ERR \
! "multipath: %s: redirecting sector %lu to another IO path\n"
  
  /*
   * This is a kernel thread which:
--- 669,678 ----
  
  
  #define IO_ERROR KERN_ALERT \
! "multipath: %s: unrecoverable IO read error for block %llu\n"
  
  #define REDIRECT_SECTOR KERN_ERR \
! "multipath: %s: redirecting sector %llu to another IO path\n"
  
  /*
   * This is a kernel thread which:
***************
*** 707,717 ****
  		
  		multipath_map (mddev, &bh->b_dev);
  		if (bh->b_dev == dev) {
! 			printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
  			multipath_end_bh_io(mp_bh, 0);
  		} else {
  			printk (REDIRECT_SECTOR,
! 				partition_name(bh->b_dev), bh->b_blocknr);
  			bh->b_rdev = bh->b_dev;
  			bh->b_rsector = bh->b_blocknr;
  			generic_make_request (mp_bh->cmd, bh);
--- 707,717 ----
  		
  		multipath_map (mddev, &bh->b_dev);
  		if (bh->b_dev == dev) {
! 			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), (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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/raid0.c linux-2.4.22-ashuariadevel/drivers/md/raid0.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/raid0.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/raid0.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 41,47 ****
  		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);
  			if (rdev2 == rdev1) {
  				printk("raid0:   END\n");
  				break;
--- 41,50 ----
  		printk("raid0: looking at %s\n", partition_name(rdev1->dev));
  		c = 0;
  		ITERATE_RDEV_ORDERED(mddev,rdev2,j2) {
! 			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,101 ****
  				c++;
  				if (!smallest || (rdev->size <smallest->size)) {
  					smallest = rdev;
! 					printk("  (%ld) is smallest!.\n", rdev->size);
  				}
  			} else
  				printk(" nope.\n");
--- 98,104 ----
  				c++;
  				if (!smallest || (rdev->size <smallest->size)) {
  					smallest = rdev;
! 					printk("  (%llu) is smallest!.\n", (unsigned long long)rdev->size);
  				}
  			} else
  				printk(" nope.\n");
***************
*** 120,126 ****
  
  static int raid0_run (mddev_t *mddev)
  {
! 	unsigned long cur=0, i=0, size, zone0_size, nb_zone;
  	raid0_conf_t *conf;
  
  	MOD_INC_USE_COUNT;
--- 123,130 ----
  
  static int raid0_run (mddev_t *mddev)
  {
! 	unsigned long cur=0, i=0, zone0_size, nb_zone;
! 	sector_t size;
  	raid0_conf_t *conf;
  
  	MOD_INC_USE_COUNT;
***************
*** 138,150 ****
  	if (create_strip_zones (mddev)) 
  		goto out_free_conf;
  
! 	printk("raid0 : md_size is %d blocks.\n", 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;
  
  	printk("raid0 : Allocating %ld bytes for hash.\n",
  				nb_zone*sizeof(struct raid0_hash));
  
--- 142,159 ----
  	if (create_strip_zones (mddev)) 
  		goto out_free_conf;
  
! 	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);
  
+ 	{
+ #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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/md/raid1.c linux-2.4.22-ashuariadevel/drivers/md/raid1.c
*** linux-2.4.22-ashuariadevel.backup/drivers/md/raid1.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/md/raid1.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 441,448 ****
  		/*
  		 * oops, read error:
  		 */
! 		printk(KERN_ERR "raid1: %s: rescheduling block %lu\n", 
! 			 partition_name(bh->b_dev), bh->b_blocknr);
  		raid1_reschedule_retry(r1_bh);
  		return;
  	}
--- 441,448 ----
  		/*
  		 * oops, read error:
  		 */
! 		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;
  	}
***************
*** 1136,1145 ****
  
  
  #define IO_ERROR KERN_ALERT \
! "raid1: %s: unrecoverable I/O read error for block %lu\n"
  
  #define REDIRECT_SECTOR KERN_ERR \
! "raid1: %s: redirecting sector %lu to another mirror\n"
  
  /*
   * This is a kernel thread which:
--- 1136,1145 ----
  
  
  #define IO_ERROR KERN_ALERT \
! "raid1: %s: unrecoverable I/O read error for block %llu\n"
  
  #define REDIRECT_SECTOR KERN_ERR \
! "raid1: %s: redirecting sector %llu to another mirror\n"
  
  /*
   * This is a kernel thread which:
***************
*** 1250,1256 ****
  				 * as reconstruct is about to be aborted
  				 */
  
! 				printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
  				md_done_sync(mddev, bh->b_size>>9, 0);
  			}
  
--- 1250,1256 ----
  				 * as reconstruct is about to be aborted
  				 */
  
! 				printk (IO_ERROR, partition_name(bh->b_dev), (unsigned long long)bh->b_blocknr);
  				md_done_sync(mddev, bh->b_size>>9, 0);
  			}
  
***************
*** 1260,1270 ****
  			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);
  				raid1_end_bh_io(r1_bh, 0);
  			} else {
  				printk (REDIRECT_SECTOR,
! 					partition_name(bh->b_dev), bh->b_blocknr);
  				bh->b_rdev = bh->b_dev;
  				bh->b_rsector = bh->b_blocknr;
  				generic_make_request (r1_bh->cmd, bh);
--- 1260,1270 ----
  			dev = bh->b_dev;
  			raid1_map (mddev, &bh->b_dev);
  			if (bh->b_dev == dev) {
! 				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), (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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/message/i2o/i2o_block.c linux-2.4.22-ashuariadevel/drivers/message/i2o/i2o_block.c
*** linux-2.4.22-ashuariadevel.backup/drivers/message/i2o/i2o_block.c	2002-08-03 09:39:44.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/message/i2o/i2o_block.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 125,131 ****
  
  static int i2ob_blksizes[MAX_I2OB<<4];
  static int i2ob_hardsizes[MAX_I2OB<<4];
! static int i2ob_sizes[MAX_I2OB<<4];
  static int i2ob_media_change_flag[MAX_I2OB];
  static u32 i2ob_max_sectors[MAX_I2OB<<4];
  
--- 125,131 ----
  
  static int i2ob_blksizes[MAX_I2OB<<4];
  static int i2ob_hardsizes[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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/mtd/devices/blkmtd.c linux-2.4.22-ashuariadevel/drivers/mtd/devices/blkmtd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/mtd/devices/blkmtd.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/mtd/devices/blkmtd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 294,301 ****
  			iobuf->nr_pages--;
  			ignorepage = pagenr;
  		} else {
! 			DEBUG(3, "blkmtd: doing writeout pagenr = %d max_pagenr = %ld pagecnt = %d idx = %d\n",
! 			      pagenr, iobuf->blocks[iobuf->nr_pages-1],
  			      pagecnt, iobuf->nr_pages);
  			commit_pages(dev);
  		}
--- 294,302 ----
  			iobuf->nr_pages--;
  			ignorepage = pagenr;
  		} else {
! 			DEBUG(3, "blkmtd: doing writeout pagenr = %d max_pagenr = %llu pagecnt = %d idx = %d\n",
! 			      pagenr,
! 			      (unsigned long long)iobuf->blocks[iobuf->nr_pages-1],
  			      pagecnt, iobuf->nr_pages);
  			commit_pages(dev);
  		}
***************
*** 335,347 ****
  	/* Now do the main loop to a page aligned, n page sized output */
  	if(len) {
  		int pagesc = len >> PAGE_SHIFT;
! 		DEBUG(3, "blkmtd: write: whole pages start = %d, count = %d\n",
! 		      pagenr, pagesc);
  		while(pagesc) {
  			struct page *page;
  
  			/* see if page is in the page cache */
! 			DEBUG(3, "blkmtd: write: grabbing page %d from page cache\n", pagenr);
  			page = grab_cache_page(dev->binding->bd_inode->i_mapping, pagenr);
  			if(PageDirty(page) && pagenr != ignorepage) {
  				BUG();
--- 336,348 ----
  	/* Now do the main loop to a page aligned, n page sized output */
  	if(len) {
  		int pagesc = len >> PAGE_SHIFT;
! 		DEBUG(3, "blkmtd: write: whole pages start = %llu, count = %d\n",
! 		      (unsigned long long)pagenr, pagesc);
  		while(pagesc) {
  			struct page *page;
  
  			/* see if page is in the page cache */
! 			DEBUG(3, "blkmtd: write: grabbing page %llu from page cache\n", (unsigned long long)pagenr);
  			page = grab_cache_page(dev->binding->bd_inode->i_mapping, pagenr);
  			if(PageDirty(page) && pagenr != ignorepage) {
  				BUG();
***************
*** 652,661 ****
  				lru++;
  		}
  
! 		len += sprintf(page+len, "mtd%d:\t%ld\t%d\t%ld\t%d\t%d\t%d\t%d\n",
  			       dev->mtd_info.index,
  			       (dev->wr_buf && dev->wr_buf->nr_pages) ?
! 			       dev->wr_buf->blocks[dev->wr_buf->nr_pages-1] : 0,
  			       (dev->wr_buf) ? dev->wr_buf->nr_pages : 0,
  			       dev->binding->bd_inode->i_mapping->nrpages,
  			       clean, dirty, locked, lru);
--- 653,662 ----
  				lru++;
  		}
  
! 		len += sprintf(page+len, "mtd%d:\t%llu\t%d\t%ld\t%d\t%d\t%d\t%d\n",
  			       dev->mtd_info.index,
  			       (dev->wr_buf && dev->wr_buf->nr_pages) ?
! 			       (unsigned long long)dev->wr_buf->blocks[dev->wr_buf->nr_pages-1] : 0ULL,
  			       (dev->wr_buf) ? dev->wr_buf->nr_pages : 0,
  			       dev->binding->bd_inode->i_mapping->nrpages,
  			       clean, dirty, locked, lru);
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/mtd/ftl.c linux-2.4.22-ashuariadevel/drivers/mtd/ftl.c
*** linux-2.4.22-ashuariadevel.backup/drivers/mtd/ftl.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/mtd/ftl.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 205,211 ****
  #define XFER_FAILED	0x04
  
  static struct hd_struct ftl_hd[MINOR_NR(MAX_DEV, 0, 0)];
! static int ftl_sizes[MINOR_NR(MAX_DEV, 0, 0)];
  static int ftl_blocksizes[MINOR_NR(MAX_DEV, 0, 0)];
  
  static struct gendisk ftl_gendisk = {
--- 205,211 ----
  #define XFER_FAILED	0x04
  
  static struct hd_struct ftl_hd[MINOR_NR(MAX_DEV, 0, 0)];
! static sector_t ftl_sizes[MINOR_NR(MAX_DEV, 0, 0)];
  static int ftl_blocksizes[MINOR_NR(MAX_DEV, 0, 0)];
  
  static struct gendisk ftl_gendisk = {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/mtd/mtdblock.c linux-2.4.22-ashuariadevel/drivers/mtd/mtdblock.c
*** linux-2.4.22-ashuariadevel.backup/drivers/mtd/mtdblock.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/mtd/mtdblock.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 57,63 ****
  
  static spinlock_t mtdblks_lock;
  
! static int mtd_sizes[MAX_MTD_DEVICES];
  static int mtd_blksizes[MAX_MTD_DEVICES];
  
  #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14)
--- 57,63 ----
  
  static spinlock_t mtdblks_lock;
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/mtd/nftlcore.c linux-2.4.22-ashuariadevel/drivers/mtd/nftlcore.c
*** linux-2.4.22-ashuariadevel.backup/drivers/mtd/nftlcore.c	2003-06-13 23:51:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/mtd/nftlcore.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 54,60 ****
   *  encountered, except ...
   */
  
! static int nftl_sizes[256];
  static int nftl_blocksizes[256];
  
  /* .. for the Linux partition table handling. */
--- 54,60 ----
   *  encountered, except ...
   */
  
! static sector_t nftl_sizes[256];
  static int nftl_blocksizes[256];
  
  /* .. for the Linux partition table handling. */
***************
*** 885,891 ****
  		DEBUG(MTD_DEBUG_LEVEL2, "NFTL_request\n");
  		DEBUG(MTD_DEBUG_LEVEL3, "NFTL %s request, from sector 0x%04lx for 0x%04lx sectors\n",
  		      (req->cmd == READ) ? "Read " : "Write",
! 		      req->sector, req->current_nr_sectors);
  
  		dev = MINOR(req->rq_dev);
  		block = req->sector;
--- 885,891 ----
  		DEBUG(MTD_DEBUG_LEVEL2, "NFTL_request\n");
  		DEBUG(MTD_DEBUG_LEVEL3, "NFTL %s request, from sector 0x%04lx for 0x%04lx sectors\n",
  		      (req->cmd == READ) ? "Read " : "Write",
! 		      (long)req->sector, req->current_nr_sectors);
  
  		dev = MINOR(req->rq_dev);
  		block = req->sector;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/3w-xxxx.c linux-2.4.22-ashuariadevel/drivers/scsi/3w-xxxx.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/3w-xxxx.c	2003-08-25 20:44:42.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/3w-xxxx.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2482,2493 ****
  
  	heads = 64;
  	sectors = 32;
! 	cylinders = disk->capacity / (heads * sectors);
  
  	if (disk->capacity >= 0x200000) {
  		heads = 255;
  		sectors = 63;
! 		cylinders = disk->capacity / (heads * sectors);
  	}
  
  	dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_biosparam(): heads = %d, sectors = %d, cylinders = %d\n", heads, sectors, cylinders);
--- 2482,2493 ----
  
  	heads = 64;
  	sectors = 32;
! 	cylinders = (long)disk->capacity / (heads * sectors);
  
  	if (disk->capacity >= 0x200000) {
  		heads = 255;
  		sectors = 63;
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/BusLogic.c linux-2.4.22-ashuariadevel/drivers/scsi/BusLogic.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/BusLogic.c	2001-12-22 02:41:55.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/BusLogic.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 4127,4133 ****
        DiskParameters->Sectors = 32;
      }
    DiskParameters->Cylinders =
!     Disk->capacity / (DiskParameters->Heads * DiskParameters->Sectors);
    /*
      Attempt to read the first 1024 bytes from the disk device.
    */
--- 4127,4133 ----
        DiskParameters->Sectors = 32;
      }
    DiskParameters->Cylinders =
! 	  (unsigned long)Disk->capacity / (DiskParameters->Heads * DiskParameters->Sectors);
    /*
      Attempt to read the first 1024 bytes from the disk device.
    */
***************
*** 4175,4181 ****
  	  PartitionEntryEndSector = FirstPartitionEntry->end_sector & 0x3F;
  	}
        DiskParameters->Cylinders =
! 	Disk->capacity / (DiskParameters->Heads * DiskParameters->Sectors);
        if (PartitionNumber < 4 &&
  	  PartitionEntryEndSector == DiskParameters->Sectors)
  	{
--- 4175,4181 ----
  	  PartitionEntryEndSector = FirstPartitionEntry->end_sector & 0x3F;
  	}
        DiskParameters->Cylinders =
! 	      (unsigned long)Disk->capacity / (DiskParameters->Heads * DiskParameters->Sectors);
        if (PartitionNumber < 4 &&
  	  PartitionEntryEndSector == DiskParameters->Sectors)
  	{
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/aacraid/linit.c linux-2.4.22-ashuariadevel/drivers/scsi/aacraid/linit.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/aacraid/linit.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/aacraid/linit.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 453,459 ****
  		param->sectors = 32;
  	}
  
! 	param->cylinders = disk->capacity/(param->heads * param->sectors);
  
  	/*
  	 *	Read the first 1024 bytes from the disk device
--- 453,459 ----
  		param->sectors = 32;
  	}
  
! 	param->cylinders = (unsigned long)disk->capacity/(param->heads * param->sectors);
  
  	/*
  	 *	Read the first 1024 bytes from the disk device
***************
*** 508,514 ****
  			end_sec = first->end_sector & 0x3f;
  		}
  
! 		param->cylinders = disk->capacity / (param->heads * param->sectors);
  
  		if(num < 4 && end_sec == param->sectors)
  		{
--- 508,514 ----
  			end_sec = first->end_sector & 0x3f;
  		}
  
! 		param->cylinders = (unsigned long)disk->capacity / (param->heads * param->sectors);
  
  		if(num < 4 && end_sec == param->sectors)
  		{
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/advansys.c linux-2.4.22-ashuariadevel/drivers/scsi/advansys.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/advansys.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/advansys.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 6218,6224 ****
                  ip[1] = 32;
          }
      }
!     ip[2] = dp->capacity / (ip[0] * ip[1]);
      ASC_DBG(1, "advansys_biosparam: end\n");
      return 0;
  }
--- 6218,6224 ----
                  ip[1] = 32;
          }
      }
!     ip[2] = (long)dp->capacity / (ip[0] * ip[1]);
      ASC_DBG(1, "advansys_biosparam: end\n");
      return 0;
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/aha152x.c linux-2.4.22-ashuariadevel/drivers/scsi/aha152x.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/aha152x.c	2003-08-25 20:44:42.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/aha152x.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1848,1854 ****
  	/* try default translation */
  	info_array[0] = 64;
  	info_array[1] = 32;
! 	info_array[2] = disk->capacity / (64 * 32);
  
  	/* for disks >1GB do some guessing */
  	if (info_array[2] >= 1024) {
--- 1848,1854 ----
  	/* try default translation */
  	info_array[0] = 64;
  	info_array[1] = 32;
! 	info_array[2] = (long)disk->capacity / (64 * 32);
  
  	/* for disks >1GB do some guessing */
  	if (info_array[2] >= 1024) {
***************
*** 1863,1869 ****
  				       "         using extended translation.\n");
  				info_array[0] = 255;
  				info_array[1] = 63;
! 				info_array[2] = disk->capacity / (255 * 63);
  			} else {
  				printk(KERN_NOTICE
  				       "aha152x: unable to verify geometry for disk with >1GB.\n"
--- 1863,1869 ----
  				       "         using extended translation.\n");
  				info_array[0] = 255;
  				info_array[1] = 63;
! 				info_array[2] = (long)disk->capacity / (255 * 63);
  			} else {
  				printk(KERN_NOTICE
  				       "aha152x: unable to verify geometry for disk with >1GB.\n"
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/aic7xxx_old.c linux-2.4.22-ashuariadevel/drivers/scsi/aic7xxx_old.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/aic7xxx_old.c	2003-06-13 23:51:36.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/aic7xxx_old.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 11752,11764 ****
    
    heads = 64;
    sectors = 32;
!   cylinders = disk->capacity / (heads * sectors);
  
    if ((p->flags & AHC_EXTEND_TRANS_A) && (cylinders > 1024))
    {
      heads = 255;
      sectors = 63;
!     cylinders = disk->capacity / (heads * sectors);
    }
  
    geom[0] = heads;
--- 11752,11764 ----
    
    heads = 64;
    sectors = 32;
!   cylinders = (long)disk->capacity / (heads * sectors);
  
    if ((p->flags & AHC_EXTEND_TRANS_A) && (cylinders > 1024))
    {
      heads = 255;
      sectors = 63;
!     cylinders = (long)disk->capacity / (heads * sectors);
    }
  
    geom[0] = heads;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/atp870u.c linux-2.4.22-ashuariadevel/drivers/scsi/atp870u.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/atp870u.c	2002-08-03 09:39:44.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/atp870u.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2850,2861 ****
  
  	heads = 64;
  	sectors = 32;
! 	cylinders = disk->capacity / (heads * sectors);
  
  	if (cylinders > 1024) {
  		heads = 255;
  		sectors = 63;
! 		cylinders = disk->capacity / (heads * sectors);
  	}
  	ip[0] = heads;
  	ip[1] = sectors;
--- 2850,2861 ----
  
  	heads = 64;
  	sectors = 32;
! 	cylinders = (long)disk->capacity / (heads * sectors);
  
  	if (cylinders > 1024) {
  		heads = 255;
  		sectors = 63;
! 		cylinders = (long)disk->capacity / (heads * sectors);
  	}
  	ip[0] = heads;
  	ip[1] = sectors;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/dpt_i2o.c linux-2.4.22-ashuariadevel/drivers/scsi/dpt_i2o.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/dpt_i2o.c	2003-06-13 23:51:36.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/dpt_i2o.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 481,487 ****
  		heads = 255;
  		sectors = 63;
  	}
! 	cylinders = disk->capacity / (heads * sectors);
  
  	// Special case if CDROM
  	if(disk->device->type == 5) {  // CDROM
--- 481,487 ----
  		heads = 255;
  		sectors = 63;
  	}
! 	cylinders = (unsigned long)disk->capacity / (heads * sectors);
  
  	// Special case if CDROM
  	if(disk->device->type == 5) {  // CDROM
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/gdth.c linux-2.4.22-ashuariadevel/drivers/scsi/gdth.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/gdth.c	2003-08-25 20:44:42.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/gdth.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 4581,4587 ****
      } else {
          ip[0] = ha->hdr[t].heads;
          ip[1] = ha->hdr[t].secs;
!         ip[2] = disk->capacity / ip[0] / ip[1];
      }
  
      TRACE2(("gdth_bios_param(): %d heads, %d secs, %d cyls\n",
--- 4581,4587 ----
      } else {
          ip[0] = ha->hdr[t].heads;
          ip[1] = ha->hdr[t].secs;
!         ip[2] = (unsigned long)disk->capacity / ip[0] / ip[1];
      }
  
      TRACE2(("gdth_bios_param(): %d heads, %d secs, %d cyls\n",
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/ibmmca.c linux-2.4.22-ashuariadevel/drivers/scsi/ibmmca.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/ibmmca.c	2001-05-02 08:05:00.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/ibmmca.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2386,2400 ****
  {
     info[0] = 64;
     info[1] = 32;
!    info[2] = disk->capacity / (info[0] * info[1]);
     if (info[2] >= 1024) {
        info[0] = 128;
        info[1] = 63;
!       info[2] = disk->capacity / (info[0] * info[1]);
        if (info[2] >= 1024) {
  	 info[0] = 255;
  	 info[1] = 63;
! 	 info[2] = disk->capacity / (info[0] * info[1]);
  	 if (info[2] >= 1024)
  	   info[2] = 1023;
        }
--- 2386,2400 ----
  {
     info[0] = 64;
     info[1] = 32;
!    info[2] = (long)disk->capacity / (info[0] * info[1]);
     if (info[2] >= 1024) {
        info[0] = 128;
        info[1] = 63;
!       info[2] = (long)disk->capacity / (info[0] * info[1]);
        if (info[2] >= 1024) {
  	 info[0] = 255;
  	 info[1] = 63;
! 	 info[2] = (long)disk->capacity / (info[0] * info[1]);
  	 if (info[2] >= 1024)
  	   info[2] = 1023;
        }
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/ide-scsi.c linux-2.4.22-ashuariadevel/drivers/scsi/ide-scsi.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/ide-scsi.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/ide-scsi.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 580,593 ****
  /*
   *	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)
  {
  #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);
  #endif /* IDESCSI_DEBUG_LOG */
  
  	if (rq->cmd == IDESCSI_PC_RQ) {
--- 580,593 ----
  /*
   *	idescsi_do_request is our request handling function.
   */
! 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: %llu, nr_sectors: %ld, "
  		"current_nr_sectors: %ld\n", rq->sector,
! 		(unsigned long long)rq->nr_sectors, rq->current_nr_sectors);
  #endif /* IDESCSI_DEBUG_LOG */
  
  	if (rq->cmd == IDESCSI_PC_RQ) {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/imm.c linux-2.4.22-ashuariadevel/drivers/scsi/imm.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/imm.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/imm.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1129,1139 ****
  {
      ip[0] = 0x40;
      ip[1] = 0x20;
!     ip[2] = (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]);
      }
      return 0;
  }
--- 1129,1139 ----
  {
      ip[0] = 0x40;
      ip[1] = 0x20;
!     ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]);
      if (ip[2] > 1024) {
  	ip[0] = 0xff;
  	ip[1] = 0x3f;
! 	ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]);
      }
      return 0;
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/in2000.c linux-2.4.22-ashuariadevel/drivers/scsi/in2000.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/in2000.c	2003-06-13 23:51:36.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/in2000.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2174,2190 ****
     if (iinfo[2] > 1024) {
        iinfo[0] = 64;
        iinfo[1] = 63;
!       iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]);
        }
     if (iinfo[2] > 1024) {
        iinfo[0] = 128;
        iinfo[1] = 63;
!       iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]);
        }
     if (iinfo[2] > 1024) {
        iinfo[0] = 255;
        iinfo[1] = 63;
!       iinfo[2] = disk->capacity / (iinfo[0] * iinfo[1]);
        }
      return 0;
  }
--- 2174,2190 ----
     if (iinfo[2] > 1024) {
        iinfo[0] = 64;
        iinfo[1] = 63;
!       iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]);
        }
     if (iinfo[2] > 1024) {
        iinfo[0] = 128;
        iinfo[1] = 63;
!       iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]);
        }
     if (iinfo[2] > 1024) {
        iinfo[0] = 255;
        iinfo[1] = 63;
!       iinfo[2] = (long)disk->capacity / (iinfo[0] * iinfo[1]);
        }
      return 0;
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/ini9100u.c linux-2.4.22-ashuariadevel/drivers/scsi/ini9100u.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/ini9100u.c	2001-10-01 04:26:07.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/ini9100u.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 592,607 ****
  	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;
  	} else {
  		if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) {
  			info_array[0] = 255;
  			info_array[1] = 63;
! 			info_array[2] = disk->capacity / 255 / 63;
  		} else {
  			info_array[0] = 64;
  			info_array[1] = 32;
! 			info_array[2] = disk->capacity >> 11;
  		}
  	}
  
--- 592,607 ----
  	if (pTcb->TCS_DrvHead) {
  		info_array[0] = pTcb->TCS_DrvHead;
  		info_array[1] = 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] = (long)disk->capacity / 255 / 63;
  		} else {
  			info_array[0] = 64;
  			info_array[1] = 32;
! 			info_array[2] = (long)disk->capacity >> 11;
  		}
  	}
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/inia100.c linux-2.4.22-ashuariadevel/drivers/scsi/inia100.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/inia100.c	2001-10-01 04:26:07.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/inia100.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 701,716 ****
  	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;
  	} else {
  		if (pTcb->TCS_DrvFlags & TCF_DRV_255_63) {
  			info_array[0] = 255;
  			info_array[1] = 63;
! 			info_array[2] = disk->capacity / 255 / 63;
  		} else {
  			info_array[0] = 64;
  			info_array[1] = 32;
! 			info_array[2] = disk->capacity >> 11;
  		}
  	}
  	return 0;
--- 701,716 ----
  	if (pTcb->TCS_DrvHead) {
  		info_array[0] = pTcb->TCS_DrvHead;
  		info_array[1] = 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] = (long)disk->capacity / 255 / 63;
  		} else {
  			info_array[0] = 64;
  			info_array[1] = 32;
! 			info_array[2] = (long)disk->capacity >> 11;
  		}
  	}
  	return 0;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/ips.c linux-2.4.22-ashuariadevel/drivers/scsi/ips.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/ips.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/ips.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1180,1186 ****
  		sectors = IPS_COMP_SECTORS;
  	}
  
! 	cylinders = disk->capacity / (heads * sectors);
  
  	DEBUG_VAR(2, "Geometry: heads: %d, sectors: %d, cylinders: %d",
  		  heads, sectors, cylinders);
--- 1180,1186 ----
  		sectors = IPS_COMP_SECTORS;
  	}
  
! 	cylinders = (long)disk->capacity / (heads * sectors);
  
  	DEBUG_VAR(2, "Geometry: heads: %d, sectors: %d, cylinders: %d",
  		  heads, sectors, cylinders);
***************
*** 7292,7298 ****
  	 * are guaranteed to be < 4G.
  	 */
  	if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&
! 	    !pci_set_dma_mask(ha->pcidev, (u64) 0xffffffffffffffff)) {
  		(ha)->flags |= IPS_HA_ENH_SG;
  	} else {
  		if (pci_set_dma_mask(ha->pcidev, (u64) 0xffffffff) != 0) {
--- 7292,7298 ----
  	 * are guaranteed to be < 4G.
  	 */
  	if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&
! 	    !pci_set_dma_mask(ha->pcidev, (u64) 0xffffffffffffffffULL)) {
  		(ha)->flags |= IPS_HA_ENH_SG;
  	} else {
  		if (pci_set_dma_mask(ha->pcidev, (u64) 0xffffffff) != 0) {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/megaraid.c linux-2.4.22-ashuariadevel/drivers/scsi/megaraid.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/megaraid.c	2003-08-25 20:44:42.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/megaraid.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 4397,4402 ****
--- 4397,4403 ----
  int megaraid_biosparam (Disk * disk, kdev_t dev, int *geom)
  {
  	int heads, sectors, cylinders;
+ 	unsigned long capacity = (unsigned long)disk->capacity;
  	mega_host_config *megaCfg;
  
  	/* Get pointer to host config structure */
***************
*** 4406,4418 ****
  			/* Default heads (64) & sectors (32) */
  			heads = 64;
  			sectors = 32;
! 			cylinders = 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);
  			}
  
  			/* return result */
--- 4407,4419 ----
  			/* Default heads (64) & sectors (32) */
  			heads = 64;
  			sectors = 32;
! 			cylinders = capacity / (heads * sectors);
  
  			/* Handle extended translation size for logical drives > 1Gb */
! 			if (capacity >= 0x200000) {
  				heads = 255;
  				sectors = 63;
! 				cylinders = capacity / (heads * sectors);
  			}
  
  			/* return result */
***************
*** 4430,4442 ****
  		/* Default heads (64) & sectors (32) */
  		heads = 64;
  		sectors = 32;
! 		cylinders = 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);
  		}
  
  		/* return result */
--- 4431,4443 ----
  		/* Default heads (64) & sectors (32) */
  		heads = 64;
  		sectors = 32;
! 		cylinders = capacity / (heads * sectors);
  
  		/* Handle extended translation size for logical drives > 1Gb */
! 		if (capacity >= 0x200000) {
  			heads = 255;
  			sectors = 63;
! 			cylinders = capacity / (heads * sectors);
  		}
  
  		/* return result */
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/megaraid2.c linux-2.4.22-ashuariadevel/drivers/scsi/megaraid2.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/megaraid2.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/megaraid2.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 3839,3844 ****
--- 3839,3845 ----
  megaraid_biosparam(Disk *disk, kdev_t dev, int *geom)
  {
  	int heads, sectors, cylinders;
+ 	unsigned long capacity = (unsigned long)disk->capacity;
  	adapter_t *adapter;
  
  	/* Get pointer to host config structure */
***************
*** 3848,3863 ****
  			/* Default heads (64) & sectors (32) */
  			heads = 64;
  			sectors = 32;
! 			cylinders = 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);
  			}
  
  			/* return result */
--- 3849,3864 ----
  			/* Default heads (64) & sectors (32) */
  			heads = 64;
  			sectors = 32;
! 			cylinders = capacity / (heads * sectors);
  
  			/*
  			 * Handle extended translation size for logical drives
  			 * > 1Gb
  			 */
! 			if (capacity >= 0x200000) {
  				heads = 255;
  				sectors = 63;
! 				cylinders = capacity / (heads * sectors);
  			}
  
  			/* return result */
***************
*** 3876,3888 ****
  		/* Default heads (64) & sectors (32) */
  		heads = 64;
  		sectors = 32;
! 		cylinders = 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);
  		}
  
  		/* return result */
--- 3877,3889 ----
  		/* Default heads (64) & sectors (32) */
  		heads = 64;
  		sectors = 32;
! 		cylinders = capacity / (heads * sectors);
  
  		/* Handle extended translation size for logical drives > 1Gb */
! 		if (capacity >= 0x200000) {
  			heads = 255;
  			sectors = 63;
! 			cylinders = capacity / (heads * sectors);
  		}
  
  		/* return result */
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/ppa.c linux-2.4.22-ashuariadevel/drivers/scsi/ppa.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/ppa.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/ppa.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1004,1014 ****
  {
      ip[0] = 0x40;
      ip[1] = 0x20;
!     ip[2] = (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]);
  	if (ip[2] > 1023)
  	    ip[2] = 1023;
      }
--- 1004,1014 ----
  {
      ip[0] = 0x40;
      ip[1] = 0x20;
!     ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]);
      if (ip[2] > 1024) {
  	ip[0] = 0xff;
  	ip[1] = 0x3f;
! 	ip[2] = ((long)disk->capacity + 1) / (ip[0] * ip[1]);
  	if (ip[2] > 1023)
  	    ip[2] = 1023;
      }
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/qlogicfas.c linux-2.4.22-ashuariadevel/drivers/scsi/qlogicfas.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/qlogicfas.c	2003-06-13 23:51:36.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/qlogicfas.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 678,688 ****
  /* This should mimic the DOS Qlogic driver's behavior exactly */
  	ip[0] = 0x40;
  	ip[1] = 0x20;
! 	ip[2] = disk->capacity / (ip[0] * ip[1]);
  	if (ip[2] > 1024) {
  		ip[0] = 0xff;
  		ip[1] = 0x3f;
! 		ip[2] = disk->capacity / (ip[0] * ip[1]);
  #if 0
  		if (ip[2] > 1023)
  			ip[2] = 1023;
--- 678,688 ----
  /* This should mimic the DOS Qlogic driver's behavior exactly */
  	ip[0] = 0x40;
  	ip[1] = 0x20;
! 	ip[2] = (long)disk->capacity / (ip[0] * ip[1]);
  	if (ip[2] > 1024) {
  		ip[0] = 0xff;
  		ip[1] = 0x3f;
! 		ip[2] = (long)disk->capacity / (ip[0] * ip[1]);
  #if 0
  		if (ip[2] > 1023)
  			ip[2] = 1023;
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/scsi.c linux-2.4.22-ashuariadevel/drivers/scsi/scsi.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/scsi.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/scsi.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 2483,2489 ****
  		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",
  				       i++,
  
  				       SCpnt->host->host_no,
--- 2483,2489 ----
  		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 %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,
***************
*** 2492,2498 ****
  				       SCpnt->lun,
  
  				       kdevname(SCpnt->request.rq_dev),
! 				       SCpnt->request.sector,
  				       SCpnt->request.nr_sectors,
  				       SCpnt->request.current_nr_sectors,
  				       SCpnt->request.rq_status,
--- 2492,2498 ----
  				       SCpnt->lun,
  
  				       kdevname(SCpnt->request.rq_dev),
! 				       (unsigned long long)SCpnt->request.sector,
  				       SCpnt->request.nr_sectors,
  				       SCpnt->request.current_nr_sectors,
  				       SCpnt->request.rq_status,
***************
*** 2529,2538 ****
  					entry = queue_head->next;
  					do {
  						req = blkdev_entry_to_request(entry);
! 						printk("(%s %d %ld %ld %ld) ",
  						   kdevname(req->rq_dev),
  						       req->cmd,
! 						       req->sector,
  						       req->nr_sectors,
  						req->current_nr_sectors);
  					} while ((entry = entry->next) != queue_head);
--- 2529,2538 ----
  					entry = queue_head->next;
  					do {
  						req = blkdev_entry_to_request(entry);
! 						printk("(%s %d %llu %ld %ld) ",
  						   kdevname(req->rq_dev),
  						       req->cmd,
! 						       (unsigned long long)req->sector,
  						       req->nr_sectors,
  						req->current_nr_sectors);
  					} while ((entry = entry->next) != queue_head);
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/scsi_lib.c linux-2.4.22-ashuariadevel/drivers/scsi/scsi_lib.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/scsi_lib.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/scsi_lib.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 395,402 ****
  	req = &SCpnt->request;
  	req->errors = 0;
  	if (!uptodate) {
! 		printk(" I/O error: dev %s, sector %lu\n",
! 		       kdevname(req->rq_dev), req->sector);
  	}
  	do {
  		if ((bh = req->bh) != NULL) {
--- 395,402 ----
  	req = &SCpnt->request;
  	req->errors = 0;
  	if (!uptodate) {
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/sd.c linux-2.4.22-ashuariadevel/drivers/scsi/sd.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/sd.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/sd.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 91,97 ****
  
  static Scsi_Disk *rscsi_disks;
  static struct gendisk *sd_gendisks;
! static int *sd_sizes;
  static int *sd_blocksizes;
  static int *sd_hardsizes;	/* Hardware sector size */
  static int *sd_max_sectors;
--- 91,97 ----
  
  static Scsi_Disk *rscsi_disks;
  static struct gendisk *sd_gendisks;
! static sector_t *sd_sizes;
  static int *sd_blocksizes;
  static int *sd_hardsizes;	/* Hardware sector size */
  static int *sd_max_sectors;
***************
*** 232,238 ****
  
  			diskinfo[0] = 0x40;
  			diskinfo[1] = 0x20;
! 			diskinfo[2] = rscsi_disks[DEVICE_NR(dev)].capacity >> 11;
  
  			/* override with calculated, extended default, or driver values */
  
--- 232,238 ----
  
  			diskinfo[0] = 0x40;
  			diskinfo[1] = 0x20;
! 			diskinfo[2] = (int)rscsi_disks[DEVICE_NR(dev)].capacity >> 11;
  
  			/* override with calculated, extended default, or driver values */
  
***************
*** 308,314 ****
  
  static int sd_init_command(Scsi_Cmnd * SCpnt)
  {
! 	int dev, block, this_count;
  	struct hd_struct *ppnt;
  	Scsi_Disk *dpnt;
  #if CONFIG_SCSI_LOGGING
--- 308,315 ----
  
  static int sd_init_command(Scsi_Cmnd * SCpnt)
  {
! 	int dev, this_count;
! 	sector_t block;
  	struct hd_struct *ppnt;
  	Scsi_Disk *dpnt;
  #if CONFIG_SCSI_LOGGING
***************
*** 321,328 ****
  	block = SCpnt->request.sector;
  	this_count = SCpnt->request_bufflen >> 9;
  
! 	SCSI_LOG_HLQUEUE(1, printk("Doing sd request, dev = 0x%x, block = %d\n",
! 	    SCpnt->request.rq_dev, block));
  
  	dpnt = &rscsi_disks[dev];
  	if (dev >= sd_template.dev_max ||
--- 322,329 ----
  	block = SCpnt->request.sector;
  	this_count = SCpnt->request_bufflen >> 9;
  
! 	SCSI_LOG_HLQUEUE(1, printk("Doing sd request, dev = 0x%x, block = %llu\n",
! 				   SCpnt->request.rq_dev, (unsigned long long)block));
  
  	dpnt = &rscsi_disks[dev];
  	if (dev >= sd_template.dev_max ||
***************
*** 343,350 ****
  		return 0;
  	}
  	SCSI_LOG_HLQUEUE(2, sd_devname(dev, nbuff));
! 	SCSI_LOG_HLQUEUE(2, printk("%s : real dev = /dev/%d, block = %d\n",
! 				   nbuff, dev, block));
  
  	/*
  	 * If we have a 1K hardware sectorsize, prevent access to single
--- 344,351 ----
  		return 0;
  	}
  	SCSI_LOG_HLQUEUE(2, sd_devname(dev, nbuff));
! 	SCSI_LOG_HLQUEUE(2, printk("%s : real dev = /dev/%d, block = %llu\n",
! 				   nbuff, dev, (unsigned long long)block));
  
  	/*
  	 * If we have a 1K hardware sectorsize, prevent access to single
***************
*** 617,623 ****
  	int this_count = SCpnt->bufflen >> 9;
  	int good_sectors = (result == 0 ? this_count : 0);
  	int block_sectors = 1;
! 	long error_sector;
  
  	SCSI_LOG_HLCOMPLETE(1, sd_devname(DEVICE_NR(SCpnt->request.rq_dev), nbuff));
  
--- 618,624 ----
  	int this_count = SCpnt->bufflen >> 9;
  	int good_sectors = (result == 0 ? this_count : 0);
  	int block_sectors = 1;
! 	sector_t error_sector;
  
  	SCSI_LOG_HLCOMPLETE(1, sd_devname(DEVICE_NR(SCpnt->request.rq_dev), nbuff));
  
***************
*** 1003,1009 ****
  		 */
  		rscsi_disks[i].ready = 1;
  
! 		rscsi_disks[i].capacity = 1 + ((buffer[0] << 24) |
  					       (buffer[1] << 16) |
  					       (buffer[2] << 8) |
  					       buffer[3]);
--- 1004,1010 ----
  		 */
  		rscsi_disks[i].ready = 1;
  
! 		rscsi_disks[i].capacity = 1 + (((sector_t)buffer[0] << 24) |
  					       (buffer[1] << 16) |
  					       (buffer[2] << 8) |
  					       buffer[3]);
***************
*** 1051,1077 ****
  			 */
  			int m;
  			int hard_sector = sector_size;
! 			unsigned int sz = (rscsi_disks[i].capacity/2) * (hard_sector/256);
  
  			/* 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: "
! 			       "%u %d-byte hdwr sectors (%u MB)\n",
! 			       nbuff, rscsi_disks[i].capacity,
! 			       hard_sector, (sz - sz/625 + 974)/1950);
  		}
  
  		/* Rescale capacity to 512-byte units */
  		if (sector_size == 4096)
  			rscsi_disks[i].capacity <<= 3;
! 		if (sector_size == 2048)
  			rscsi_disks[i].capacity <<= 2;
! 		if (sector_size == 1024)
  			rscsi_disks[i].capacity <<= 1;
! 		if (sector_size == 256)
  			rscsi_disks[i].capacity >>= 1;
  	}
  
--- 1052,1084 ----
  			 */
  			int m;
  			int hard_sector = sector_size;
! 			sector_t sz = rscsi_disks[i].capacity * (hard_sector/256);
! 			sector_t mb;
  
  			/* There are 16 minors allocated for each major device */
  			for (m = i << 4; m < ((i + 1) << 4); m++) {
  				sd_hardsizes[m] = hard_sector;
  			}
+ 			mb = sz >> 1;
+ 			sector_div(sz, 1250);
+ 			mb -= (sz - 974);
+ 			sector_div(mb, 1950);
+ 
  
  			printk("SCSI device %s: "
! 			       "%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;
! 		else if (sector_size == 2048)
  			rscsi_disks[i].capacity <<= 2;
! 		else if (sector_size == 1024)
  			rscsi_disks[i].capacity <<= 1;
! 		else if (sector_size == 256)
  			rscsi_disks[i].capacity >>= 1;
  	}
  
***************
*** 1173,1192 ****
  	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);
  	if (!sd_sizes)
  		goto cleanup_disks;
! 	memset(sd_sizes, 0, (sd_template.dev_max << 4) * sizeof(int));
  
! 	sd_blocksizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC);
  	if (!sd_blocksizes)
  		goto cleanup_sizes;
! 	
! 	sd_hardsizes = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC);
  	if (!sd_hardsizes)
  		goto cleanup_blocksizes;
  
! 	sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC);
  	if (!sd_max_sectors)
  		goto cleanup_max_sectors;
  
--- 1180,1199 ----
  	memset(rscsi_disks, 0, sd_template.dev_max * sizeof(Scsi_Disk));
  
  	/* for every (necessary) major: */
! 	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(*sd_sizes));
  
! 	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(*sd_hardsizes), GFP_ATOMIC);
  	if (!sd_hardsizes)
  		goto cleanup_blocksizes;
  
! 	sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(*sd_max_sectors), GFP_ATOMIC);
  	if (!sd_max_sectors)
  		goto cleanup_max_sectors;
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/sd.h linux-2.4.22-ashuariadevel/drivers/scsi/sd.h
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/sd.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/sd.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 25,31 ****
  
  typedef struct scsi_disk {
  	Scsi_Device *device;
! 	unsigned capacity;		/* size in blocks */
  	unsigned char sector_bit_size;	/* sector_size = 2 to the bit size power */
  	unsigned char sector_bit_shift;	/* power of 2 sectors per FS block */
  	unsigned has_part_table:1;	/* has partition table */
--- 25,31 ----
  
  typedef struct scsi_disk {
  	Scsi_Device *device;
! 	sector_t capacity;		/* size in blocks */
  	unsigned char sector_bit_size;	/* sector_size = 2 to the bit size power */
  	unsigned char sector_bit_shift;	/* power of 2 sectors per FS block */
  	unsigned has_part_table:1;	/* has partition table */
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/sr.c linux-2.4.22-ashuariadevel/drivers/scsi/sr.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/sr.c	2003-06-13 23:51:36.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/sr.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 85,91 ****
  };
  
  Scsi_CD *scsi_CDs;
! static int *sr_sizes;
  
  static int *sr_blocksizes;
  static int *sr_hardsizes;
--- 85,91 ----
  };
  
  Scsi_CD *scsi_CDs;
! static sector_t *sr_sizes;
  
  static int *sr_blocksizes;
  static int *sr_hardsizes;
***************
*** 198,204 ****
  	int good_sectors = (result == 0 ? this_count : 0);
  	int block_sectors = 0;
  	int device_nr = DEVICE_NR(SCpnt->request.rq_dev);
! 	long error_sector;
  
  #ifdef DEBUG
  	printk("sr.c done: %x %p\n", result, SCpnt->request.bh->b_data);
--- 198,204 ----
  	int good_sectors = (result == 0 ? this_count : 0);
  	int block_sectors = 0;
  	int device_nr = DEVICE_NR(SCpnt->request.rq_dev);
! 	sector_t error_sector;
  
  #ifdef DEBUG
  	printk("sr.c done: %x %p\n", result, SCpnt->request.bh->b_data);
***************
*** 295,301 ****
  	/*
  	 * need front pad
  	 */
! 	if ((fsize = SCpnt->request.sector % (s_size >> 9))) {
  		fsize <<= 9;
  		sg_ent++;
  		if ((front = scsi_malloc(fsize)) == NULL)
--- 295,301 ----
  	/*
  	 * need front pad
  	 */
! 	if ((fsize = (unsigned long)SCpnt->request.sector % (s_size >> 9))) {
  		fsize <<= 9;
  		sg_ent++;
  		if ((front = scsi_malloc(fsize)) == NULL)
***************
*** 427,438 ****
  		return 0;
  	}
  
! 	block = 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 (sr_scatter_pad(SCpnt, s_size))
  			return 0;
  
--- 427,438 ----
  		return 0;
  	}
  
! 	block = (long)SCpnt->request.sector / (s_size >> 9);
  
  	/*
  	 * request doesn't start on hw block boundary, add scatter pads
  	 */
! 	if (((long)SCpnt->request.sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size))
  		if (sr_scatter_pad(SCpnt, s_size))
  			return 0;
  
***************
*** 826,841 ****
  		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);
  	if (!sr_sizes)
  		goto cleanup_cds;
! 	memset(sr_sizes, 0, sr_template.dev_max * sizeof(int));
  
! 	sr_blocksizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC);
  	if (!sr_blocksizes)
  		goto cleanup_sizes;
  
! 	sr_hardsizes = kmalloc(sr_template.dev_max * sizeof(int), GFP_ATOMIC);
  	if (!sr_hardsizes)
  		goto cleanup_blocksizes;
  	/*
--- 826,841 ----
  		goto cleanup_devfs;
  	memset(scsi_CDs, 0, sr_template.dev_max * sizeof(Scsi_CD));
  
! 	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(sr_sizes[0]));
  
! 	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(sr_hardsizes[0]), GFP_ATOMIC);
  	if (!sr_hardsizes)
  		goto cleanup_blocksizes;
  	/*
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/sym53c8xx_2/sym_glue.c linux-2.4.22-ashuariadevel/drivers/scsi/sym53c8xx_2/sym_glue.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/sym53c8xx_2/sym_glue.c	2002-11-29 08:53:14.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/sym53c8xx_2/sym_glue.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1879,1887 ****
  		goto out_err32;
  #else
  #if   SYM_CONF_DMA_ADDRESSING_MODE == 1
! #define	PciDmaMask	0xffffffffff
  #elif SYM_CONF_DMA_ADDRESSING_MODE == 2
! #define	PciDmaMask	0xffffffffffffffff
  #endif
  	if (np->features & FE_DAC) {
  		if (!pci_set_dma_mask(np->s.device, PciDmaMask)) {
--- 1879,1887 ----
  		goto out_err32;
  #else
  #if   SYM_CONF_DMA_ADDRESSING_MODE == 1
! #define	PciDmaMask	0xffffffffffULL
  #elif SYM_CONF_DMA_ADDRESSING_MODE == 2
! #define	PciDmaMask	0xffffffffffffffffULL
  #endif
  	if (np->features & FE_DAC) {
  		if (!pci_set_dma_mask(np->s.device, PciDmaMask)) {
diff -Ncr linux-2.4.22-ashuariadevel.backup/drivers/scsi/wd7000.c linux-2.4.22-ashuariadevel/drivers/scsi/wd7000.c
*** linux-2.4.22-ashuariadevel.backup/drivers/scsi/wd7000.c	2001-10-01 04:26:08.000000000 +0900
--- linux-2.4.22-ashuariadevel/drivers/scsi/wd7000.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1739,1745 ****
       */
      ip[0] = 64;
      ip[1] = 32;
!     ip[2] = disk->capacity / (64 * 32);
  
      /*
       * for disks >1GB do some guessing
--- 1739,1745 ----
       */
      ip[0] = 64;
      ip[1] = 32;
!     ip[2] = (long)disk->capacity / (64 * 32);
  
      /*
       * for disks >1GB do some guessing
***************
*** 1758,1764 ****
  
  	    ip[0] = 255;
  	    ip[1] = 63;
! 	    ip[2] = disk->capacity / (255 * 63);
  	}
  	else {
  	    ip[0] = info[0];
--- 1758,1764 ----
  
  	    ip[0] = 255;
  	    ip[1] = 63;
! 	    ip[2] = (long)disk->capacity / (255 * 63);
  	}
  	else {
  	    ip[0] = info[0];
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/adfs/adfs.h linux-2.4.22-ashuariadevel/fs/adfs/adfs.h
*** linux-2.4.22-ashuariadevel.backup/fs/adfs/adfs.h	2000-09-19 07:14:06.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/adfs/adfs.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 66,72 ****
  
  /* Inode stuff */
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
! int adfs_get_block(struct inode *inode, long block,
  		   struct buffer_head *bh, int create);
  #else
  int adfs_bmap(struct inode *inode, int block);
--- 66,72 ----
  
  /* Inode stuff */
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/adfs/inode.c linux-2.4.22-ashuariadevel/fs/adfs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/adfs/inode.c	2001-10-01 04:26:08.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/adfs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 27,33 ****
   * 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)
  {
  	if (block < 0)
  		goto abort_negative;
--- 27,33 ----
   * not support creation of new blocks, so we return -EIO for this case.
   */
  int
! adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh, int create)
  {
  	if (block < 0)
  		goto abort_negative;
***************
*** 71,77 ****
  		&page->mapping->host->u.adfs_i.mmu_private);
  }
  
! static int _adfs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping, block, adfs_get_block);
  }
--- 71,77 ----
  		&page->mapping->host->u.adfs_i.mmu_private);
  }
  
! static sector_t _adfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping, block, adfs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/affs/file.c linux-2.4.22-ashuariadevel/fs/affs/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/affs/file.c	2002-02-26 04:38:07.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/affs/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 38,44 ****
  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 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);
--- 38,44 ----
  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, 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,348 ****
  }
  
  static int
! affs_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create)
  {
  	struct super_block	*sb = inode->i_sb;
  	struct buffer_head	*ext_bh;
  	u32			 ext;
  
! 	pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, block);
  
  	if (block < 0)
  		goto err_small;
  
  	if (block >= AFFS_INODE->i_blkcnt) {
  		if (block > AFFS_INODE->i_blkcnt || !create)
  			goto err_big;
--- 332,352 ----
  }
  
  static int
! 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, (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,429 ****
  	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)
  {
  	return generic_block_bmap(mapping,block,affs_get_block);
  }
--- 427,433 ----
  	return cont_prepare_write(page, from, to, affs_get_block,
  		&page->mapping->host->u.affs_i.mmu_private);
  }
! static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,affs_get_block);
  }
***************
*** 433,439 ****
  	sync_page: block_sync_page,
  	prepare_write: affs_prepare_write,
  	commit_write: generic_commit_write,
! 	bmap: _affs_bmap
  };
  
  static inline struct buffer_head *
--- 437,443 ----
  	sync_page: block_sync_page,
  	prepare_write: affs_prepare_write,
  	commit_write: generic_commit_write,
! 	bmap: _affs_bmap,
  };
  
  static inline struct buffer_head *
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/affs/inode.c linux-2.4.22-ashuariadevel/fs/affs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/affs/inode.c	2002-02-26 04:38:07.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/affs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 395,400 ****
--- 395,404 ----
  	}
  	affs_fix_checksum(sb, bh);
  	mark_buffer_dirty_inode(bh, inode);
+ 	/*
+ 	 * You'll get a warning here if CONFIG_LBD because blocknr is 64 bits.
+ 	 * AFS isn't supported on partitions over 2Tb
+ 	 */
  	dentry->d_fsdata = (void *)bh->b_blocknr;
  
  	affs_lock_dir(dir);
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/affs/super.c linux-2.4.22-ashuariadevel/fs/affs/super.c
*** linux-2.4.22-ashuariadevel.backup/fs/affs/super.c	2002-02-26 04:38:07.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/affs/super.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 29,35 ****
  #include <asm/system.h>
  #include <asm/uaccess.h>
  
- extern int *blk_size[];
  extern struct timezone sys_tz;
  
  static int affs_statfs(struct super_block *sb, struct statfs *buf);
--- 29,34 ----
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/befs/btree.c linux-2.4.22-ashuariadevel/fs/befs/btree.c
*** linux-2.4.22-ashuariadevel.backup/fs/befs/btree.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/befs/btree.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 85,91 ****
  } befs_btree_node;
  
  /* local constants */
! const static befs_off_t befs_bt_inval = 0xffffffffffffffff;
  
  /* local functions */
  static int befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
--- 85,91 ----
  } befs_btree_node;
  
  /* local constants */
! const static befs_off_t befs_bt_inval = 0xffffffffffffffffULL;
  
  /* local functions */
  static int befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/befs/linuxvfs.c linux-2.4.22-ashuariadevel/fs/befs/linuxvfs.c
*** linux-2.4.22-ashuariadevel.backup/fs/befs/linuxvfs.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/befs/linuxvfs.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 32,40 ****
  #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_readpage(struct file *file, struct page *page);
! static int befs_bmap(struct address_space *mapping, long 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);
--- 32,40 ----
  #define VFS_BLOCK_SIZE 512
  
  static int befs_readdir(struct file *, void *, filldir_t);
! static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int);
  static int befs_readpage(struct file *file, struct page *page);
! 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);
***************
*** 115,122 ****
  	return block_read_full_page(page, befs_get_block);
  }
  
! static int
! befs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping, block, befs_get_block);
  }
--- 115,122 ----
  	return block_read_full_page(page, befs_get_block);
  }
  
! static sector_t
! befs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping, block, befs_get_block);
  }
***************
*** 133,139 ****
   */
  
  static int
! befs_get_block(struct inode *inode, long block,
  	       struct buffer_head *bh_result, int create)
  {
  	struct super_block *sb = inode->i_sb;
--- 133,139 ----
   */
  
  static int
! befs_get_block(struct inode *inode, sector_t sect,
  	       struct buffer_head *bh_result, int create)
  {
  	struct super_block *sb = inode->i_sb;
***************
*** 141,146 ****
--- 141,147 ----
  	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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/bfs/file.c linux-2.4.22-ashuariadevel/fs/bfs/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/bfs/file.c	2001-08-13 02:56:56.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/bfs/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 54,60 ****
  	return 0;
  }
  
! static int bfs_get_block(struct inode * inode, long block, 
  	struct buffer_head * bh_result, int create)
  {
  	long phys;
--- 54,60 ----
  	return 0;
  }
  
! static int bfs_get_block(struct inode * inode, sector_t block, 
  	struct buffer_head * bh_result, int create)
  {
  	long phys;
***************
*** 151,157 ****
  	return block_prepare_write(page, from, to, bfs_get_block);
  }
  
! static int bfs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping, block, bfs_get_block);
  }
--- 151,157 ----
  	return block_prepare_write(page, from, to, bfs_get_block);
  }
  
! static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping, block, bfs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/block_dev.c linux-2.4.22-ashuariadevel/fs/block_dev.c
*** linux-2.4.22-ashuariadevel.backup/fs/block_dev.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/block_dev.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 22,35 ****
  
  #include <asm/uaccess.h>
  
! static unsigned long max_block(kdev_t dev)
  {
! 	unsigned int retval = ~0U;
  	int major = MAJOR(dev);
  
  	if (blk_size[major]) {
  		int minor = MINOR(dev);
! 		unsigned int blocks = blk_size[major][minor];
  		if (blocks) {
  			unsigned int size = block_size(dev);
  			unsigned int sizebits = blksize_bits(size);
--- 22,35 ----
  
  #include <asm/uaccess.h>
  
! static sector_t max_block(kdev_t dev)
  {
! 	sector_t retval = ~0;
  	int major = MAJOR(dev);
  
  	if (blk_size[major]) {
  		int minor = MINOR(dev);
! 		sector_t blocks = blk_size[major][minor];
  		if (blocks) {
  			unsigned int size = block_size(dev);
  			unsigned int sizebits = blksize_bits(size);
***************
*** 44,50 ****
  
  static loff_t blkdev_size(kdev_t dev)
  {
! 	unsigned int blocks = ~0U;
  	int major = MAJOR(dev);
  
  	if (blk_size[major]) {
--- 44,50 ----
  
  static loff_t blkdev_size(kdev_t dev)
  {
! 	sector_t blocks = ~0;
  	int major = MAJOR(dev);
  
  	if (blk_size[major]) {
***************
*** 120,126 ****
  	return sb_set_blocksize(sb, size);
  }
  
! static int blkdev_get_block(struct inode * inode, long iblock, struct buffer_head * bh, int create)
  {
  	if (iblock >= max_block(inode->i_rdev))
  		return -EIO;
--- 120,126 ----
  	return sb_set_blocksize(sb, size);
  }
  
! 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,137 ****
  	return 0;
  }
  
! static int blkdev_direct_IO(int rw, struct inode * inode, struct kiobuf * iobuf, unsigned long blocknr, int blocksize)
  {
  	return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, blkdev_get_block);
  }
--- 131,137 ----
  	return 0;
  }
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/buffer.c linux-2.4.22-ashuariadevel/fs/buffer.c
*** linux-2.4.22-ashuariadevel.backup/fs/buffer.c	2003-12-09 11:52:22.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/buffer.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 653,659 ****
  	spin_unlock(&lru_list_lock);
  }
  
! struct buffer_head * get_hash_table(kdev_t dev, int block, int size)
  {
  	struct buffer_head *bh, **p = &hash(dev, block);
  
--- 653,659 ----
  	spin_unlock(&lru_list_lock);
  }
  
! struct buffer_head * get_hash_table(kdev_t dev, sector_t block, int size)
  {
  	struct buffer_head *bh, **p = &hash(dev, block);
  
***************
*** 1063,1069 ****
   * 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)
  {
  	for (;;) {
  		struct buffer_head * bh;
--- 1063,1069 ----
   * 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, sector_t block, int size)
  {
  	for (;;) {
  		struct buffer_head * bh;
***************
*** 1239,1245 ****
   *	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 * bh;
  
--- 1239,1245 ----
   *	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, sector_t block, int size)
  {
  	struct buffer_head * bh;
  
***************
*** 1678,1684 ****
  		unsigned from, unsigned to, get_block_t *get_block)
  {
  	unsigned block_start, block_end;
! 	unsigned long block;
  	int err = 0;
  	unsigned blocksize, bbits;
  	struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
--- 1678,1684 ----
  		unsigned from, unsigned to, get_block_t *get_block)
  {
  	unsigned block_start, block_end;
! 	sector_t block;
  	int err = 0;
  	unsigned blocksize, bbits;
  	struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
***************
*** 1690,1696 ****
  	head = page->buffers;
  
  	bbits = inode->i_blkbits;
! 	block = 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) {
--- 1690,1696 ----
  	head = page->buffers;
  
  	bbits = inode->i_blkbits;
! 	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) {
***************
*** 1829,1835 ****
  int block_read_full_page(struct page *page, get_block_t *get_block)
  {
  	struct inode *inode = page->mapping->host;
! 	unsigned long iblock, lblock;
  	struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
  	unsigned int blocksize, blocks;
  	int nr, i;
--- 1829,1835 ----
  int block_read_full_page(struct page *page, get_block_t *get_block)
  {
  	struct inode *inode = page->mapping->host;
! 	sector_t iblock, lblock;
  	struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
  	unsigned int blocksize, blocks;
  	int nr, i;
***************
*** 1842,1848 ****
  	head = page->buffers;
  
  	blocks = PAGE_CACHE_SIZE >> inode->i_blkbits;
! 	iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
  	lblock = (inode->i_size+blocksize-1) >> inode->i_blkbits;
  	bh = head;
  	nr = 0;
--- 1842,1848 ----
  	head = page->buffers;
  
  	blocks = PAGE_CACHE_SIZE >> 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;
***************
*** 2227,2233 ****
  }
  EXPORT_SYMBOL(waitfor_one_page);
  
! int generic_block_bmap(struct address_space *mapping, long block, get_block_t *get_block)
  {
  	struct buffer_head tmp;
  	struct inode *inode = mapping->host;
--- 2227,2233 ----
  }
  EXPORT_SYMBOL(waitfor_one_page);
  
! 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;
***************
*** 2237,2246 ****
  	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 i, nr_blocks, retval;
! 	unsigned long * blocks = iobuf->blocks;
  	int length;
  	int beyond_eof = 0;
  	
--- 2237,2248 ----
  	return tmp.b_blocknr;
  }
  
! 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;
! 	sector_t *blocks = iobuf->blocks;
  	int length;
  	int beyond_eof = 0;
  	
***************
*** 2277,2283 ****
  				BUG();
  			if (!buffer_mapped(&bh)) {
  				/* there was an hole in the filesystem */
! 				blocks[i] = -1UL;
  				continue;
  			}
  		} else {
--- 2279,2285 ----
  				BUG();
  			if (!buffer_mapped(&bh)) {
  				/* there was an hole in the filesystem */
! 				blocks[i] = ~(sector_t)0;
  				continue;
  			}
  		} else {
***************
*** 2368,2374 ****
   */
  
  int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], 
! 	       kdev_t dev, unsigned long b[], int size)
  {
  	int		err;
  	int		length;
--- 2370,2376 ----
   */
  
  int brw_kiovec(int rw, int nr, struct kiobuf *iovec[], 
! 	       kdev_t dev, sector_t b[], int size)
  {
  	int		err;
  	int		length;
***************
*** 2378,2384 ****
  	int		pageind;
  	int		bhind;
  	int		offset;
! 	unsigned long	blocknr;
  	struct kiobuf *	iobuf = NULL;
  	struct page *	map;
  	struct buffer_head *tmp, **bhs = NULL;
--- 2380,2386 ----
  	int		pageind;
  	int		bhind;
  	int		offset;
! 	sector_t	blocknr;
  	struct kiobuf *	iobuf = NULL;
  	struct page *	map;
  	struct buffer_head *tmp, **bhs = NULL;
***************
*** 2503,2509 ****
   * 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)
  {
  	struct buffer_head *head, *bh;
  
--- 2505,2511 ----
   * 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, sector_t b[], int size)
  {
  	struct buffer_head *head, *bh;
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/efs/file.c linux-2.4.22-ashuariadevel/fs/efs/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/efs/file.c	2000-02-27 13:33:05.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/efs/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 8,14 ****
  
  #include <linux/efs_fs.h>
  
! int efs_get_block(struct inode *inode, long iblock,
  		  struct buffer_head *bh_result, int create)
  {
  	int error = -EROFS;
--- 8,14 ----
  
  #include <linux/efs_fs.h>
  
! int efs_get_block(struct inode *inode, sector_t iblock,
  		  struct buffer_head *bh_result, int create)
  {
  	int error = -EROFS;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/efs/inode.c linux-2.4.22-ashuariadevel/fs/efs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/efs/inode.c	2002-02-26 04:38:08.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/efs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 12,23 ****
  #include <linux/module.h>
  
  
! extern int efs_get_block(struct inode *, long, 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)
  {
  	return generic_block_bmap(mapping,block,efs_get_block);
  }
--- 12,23 ----
  #include <linux/module.h>
  
  
! 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 sector_t _efs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,efs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/ext2/inode.c linux-2.4.22-ashuariadevel/fs/ext2/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/ext2/inode.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/ext2/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 505,511 ****
   * reachable from inode.
   */
  
! static int ext2_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
  	int offsets[4];
--- 505,511 ----
   * reachable from inode.
   */
  
! static int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
  	int offsets[4];
***************
*** 588,598 ****
  {
  	return block_prepare_write(page,from,to,ext2_get_block);
  }
! static int ext2_bmap(struct address_space *mapping, long 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)
  {
  	return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, ext2_get_block);
  }
--- 588,599 ----
  {
  	return block_prepare_write(page,from,to,ext2_get_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,
! 			  sector_t blocknr, int blocksize)
  {
  	return generic_direct_IO(rw, inode, iobuf, blocknr, blocksize, ext2_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/ext3/ialloc.c linux-2.4.22-ashuariadevel/fs/ext3/ialloc.c
*** linux-2.4.22-ashuariadevel.backup/fs/ext3/ialloc.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/ext3/ialloc.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 563,570 ****
  	    is_bad_inode(inode) || NEXT_ORPHAN(inode) > max_ino) {
  		ext3_warning(sb, __FUNCTION__,
  			     "bad orphan inode %lu!  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 "inode=%p\n", inode);
  		if (inode) {
  			printk(KERN_NOTICE "is_bad_inode(inode)=%d\n",
--- 563,570 ----
  	    is_bad_inode(inode) || NEXT_ORPHAN(inode) > max_ino) {
  		ext3_warning(sb, __FUNCTION__,
  			     "bad orphan inode %lu!  e2fsck was run?\n", ino);
! 		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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/ext3/inode.c linux-2.4.22-ashuariadevel/fs/ext3/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/ext3/inode.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/ext3/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 840,846 ****
  /*
   * The BKL is not held on entry here.
   */
! static int ext3_get_block(struct inode *inode, long iblock,
  			struct buffer_head *bh_result, int create)
  {
  	handle_t *handle = 0;
--- 840,846 ----
  /*
   * The BKL is not held on entry here.
   */
! static int ext3_get_block(struct inode *inode, sector_t iblock,
  			struct buffer_head *bh_result, int create)
  {
  	handle_t *handle = 0;
***************
*** 1182,1188 ****
   * 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)
  {
  	struct inode *inode = mapping->host;
  	journal_t *journal;
--- 1182,1188 ----
   * 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 sector_t ext3_bmap(struct address_space *mapping, sector_t block)
  {
  	struct inode *inode = mapping->host;
  	journal_t *journal;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/fat/file.c linux-2.4.22-ashuariadevel/fs/fat/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/fat/file.c	2001-08-13 02:56:56.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/fat/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 48,58 ****
  }
  
  
! int fat_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
  {
  	struct super_block *sb = inode->i_sb;
  	unsigned long phys;
  
  	phys = fat_bmap(inode, iblock);
  	if (phys) {
  		bh_result->b_dev = inode->i_dev;
--- 48,60 ----
  }
  
  
! 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,72 ****
  		BUG();
  		return -EIO;
  	}
! 	if (!(iblock % MSDOS_SB(inode->i_sb)->cluster_size)) {
  		if (fat_add_cluster(inode) < 0)
  			return -ENOSPC;
  	}
--- 68,74 ----
  		BUG();
  		return -EIO;
  	}
! 	if (!((unsigned long)iblock % MSDOS_SB(inode->i_sb)->cluster_size)) {
  		if (fat_add_cluster(inode) < 0)
  			return -ENOSPC;
  	}
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/fat/inode.c linux-2.4.22-ashuariadevel/fs/fat/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/fat/inode.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/fat/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 870,876 ****
  	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)
  {
  	return generic_block_bmap(mapping,block,fat_get_block);
  }
--- 870,876 ----
  	return cont_prepare_write(page,from,to,fat_get_block,
  		&MSDOS_I(page->mapping->host)->mmu_private);
  }
! static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,fat_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/fat/misc.c linux-2.4.22-ashuariadevel/fs/fat/misc.c
*** linux-2.4.22-ashuariadevel.backup/fs/fat/misc.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/fat/misc.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 183,192 ****
  		mark_inode_dirty(inode);
  	}
  	if (file_cluster
! 	    != 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));
  		fat_cache_inval_inode(inode);
  	}
  	inode->i_blocks += (1 << MSDOS_SB(sb)->cluster_bits) / 512;
--- 183,192 ----
  		mark_inode_dirty(inode);
  	}
  	if (file_cluster
! 	    != (long)inode->i_blocks / cluster_size / (sb->s_blocksize / 512)) {
  		printk ("file_cluster badly computed!!! %d <> %ld\n",
  			file_cluster,
! 			(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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/freevxfs/vxfs_kcompat.h linux-2.4.22-ashuariadevel/fs/freevxfs/vxfs_kcompat.h
*** linux-2.4.22-ashuariadevel.backup/fs/freevxfs/vxfs_kcompat.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/freevxfs/vxfs_kcompat.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 7,16 ****
  
  #include <linux/blkdev.h>
  
- typedef long sector_t;
- 
  /* Dito.  */
! static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block)
  {
  	bh->b_state |= 1 << BH_Mapped;
  	bh->b_dev = sb->s_dev;
--- 7,14 ----
  
  #include <linux/blkdev.h>
  
  /* Dito.  */
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/freevxfs/vxfs_subr.c linux-2.4.22-ashuariadevel/fs/freevxfs/vxfs_subr.c
*** linux-2.4.22-ashuariadevel.backup/fs/freevxfs/vxfs_subr.c	2002-02-26 04:38:08.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/freevxfs/vxfs_subr.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 42,48 ****
  
  
  static int		vxfs_readpage(struct file *, struct page *);
! static int		vxfs_bmap(struct address_space *, long);
  
  struct address_space_operations vxfs_aops = {
  	.readpage =		vxfs_readpage,
--- 42,48 ----
  
  
  static int		vxfs_readpage(struct file *, struct page *);
! static sector_t		vxfs_bmap(struct address_space *, sector_t);
  
  struct address_space_operations vxfs_aops = {
  	.readpage =		vxfs_readpage,
***************
*** 185,192 ****
   * Locking status:
   *   We are under the bkl.
   */
! static int
! vxfs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping, block, vxfs_getblk);
  }
--- 185,192 ----
   * Locking status:
   *   We are under the bkl.
   */
! static sector_t
! vxfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping, block, vxfs_getblk);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfs/file.c linux-2.4.22-ashuariadevel/fs/hfs/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/hfs/file.c	2002-02-26 04:38:08.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfs/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 106,112 ****
   * 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)
  {
  	unsigned long phys;
  
--- 106,112 ----
   * 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, sector_t iblock, struct buffer_head *bh_result, int create)
  {
  	unsigned long phys;
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfs/hfs.h linux-2.4.22-ashuariadevel/fs/hfs/hfs.h
*** linux-2.4.22-ashuariadevel.backup/fs/hfs/hfs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfs/hfs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 495,501 ****
  extern void hfs_extent_free(struct hfs_fork *);
  
  /* file.c */
! extern int hfs_get_block(struct inode *, long, struct buffer_head *, int);
  
  /* mdb.c */
  extern struct hfs_mdb *hfs_mdb_get(hfs_sysmdb, int, hfs_s32);
--- 495,501 ----
  extern void hfs_extent_free(struct hfs_fork *);
  
  /* file.c */
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfs/inode.c linux-2.4.22-ashuariadevel/fs/hfs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/hfs/inode.c	2001-09-13 07:34:06.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 235,241 ****
  	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)
  {
  	return generic_block_bmap(mapping,block,hfs_get_block);
  }
--- 235,241 ----
  	return cont_prepare_write(page,from,to,hfs_get_block,
  		&page->mapping->host->u.hfs_i.mmu_private);
  }
! static sector_t hfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,hfs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfsplus/extents.c linux-2.4.22-ashuariadevel/fs/hfsplus/extents.c
*** linux-2.4.22-ashuariadevel.backup/fs/hfsplus/extents.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfsplus/extents.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 128,134 ****
  
  	if (!dblock)
  		return -EIO;
! 	dprint(DBG_EXTENT, "get_block(%lu): %lu - %u\n", inode->i_ino, iblock, dblock);
  
  	map_bh(bh_result, sb, dblock + HFSPLUS_SB(sb).blockoffset);
  	if (create)
--- 128,134 ----
  
  	if (!dblock)
  		return -EIO;
! 	dprint(DBG_EXTENT, "get_block(%lu): %llu - %u\n", inode->i_ino, (unsigned long long)iblock, dblock);
  
  	map_bh(bh_result, sb, dblock + HFSPLUS_SB(sb).blockoffset);
  	if (create)
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfsplus/hfsplus_fs.h linux-2.4.22-ashuariadevel/fs/hfsplus/hfsplus_fs.h
*** linux-2.4.22-ashuariadevel.backup/fs/hfsplus/hfsplus_fs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfsplus/hfsplus_fs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 211,219 ****
  	hfsplus_cat_key key;
  };
  
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- typedef long sector_t;
- #endif
  
  /*
   * Functions in any *.c used in other files
--- 211,216 ----
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hfsplus/inode.c linux-2.4.22-ashuariadevel/fs/hfsplus/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/hfsplus/inode.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hfsplus/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 45,55 ****
  		&HFSPLUS_I(page->mapping->host).mmu_private);
  }
  
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- static int hfsplus_bmap(struct address_space *mapping, long block)
- #else
  static sector_t hfsplus_bmap(struct address_space *mapping, sector_t block)
- #endif
  {
  	return generic_block_bmap(mapping, block, hfsplus_get_block);
  }
--- 45,51 ----
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hpfs/file.c linux-2.4.22-ashuariadevel/fs/hpfs/file.c
*** linux-2.4.22-ashuariadevel.backup/fs/hpfs/file.c	2001-08-13 09:37:53.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hpfs/file.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 68,74 ****
  	hpfs_write_inode(i);
  }
  
! int hpfs_get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
  {
  	secno s;
  	s = hpfs_bmap(inode, iblock);
--- 68,74 ----
  	hpfs_write_inode(i);
  }
  
! 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,114 ****
  	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)
  {
  	return generic_block_bmap(mapping,block,hpfs_get_block);
  }
--- 108,114 ----
  	return cont_prepare_write(page,from,to,hpfs_get_block,
  		&page->mapping->host->u.hpfs_i.mmu_private);
  }
! static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,hpfs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/hpfs/hpfs_fn.h linux-2.4.22-ashuariadevel/fs/hpfs/hpfs_fn.h
*** linux-2.4.22-ashuariadevel.backup/fs/hpfs/hpfs_fn.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/hpfs/hpfs_fn.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 261,267 ****
  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);
  ssize_t hpfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
  
  /* inode.c */
--- 261,267 ----
  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, 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/inode.c linux-2.4.22-ashuariadevel/fs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/inode.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1116,1124 ****
   *	file.
   */
   
! int bmap(struct inode * inode, int block)
  {
! 	int res = 0;
  	if (inode->i_mapping->a_ops->bmap)
  		res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block);
  	return res;
--- 1116,1124 ----
   *	file.
   */
   
! sector_t bmap(struct inode * inode, sector_t block)
  {
! 	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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/intermezzo/journal_ext3.c linux-2.4.22-ashuariadevel/fs/intermezzo/journal_ext3.c
*** linux-2.4.22-ashuariadevel.backup/fs/intermezzo/journal_ext3.c	2002-11-29 08:53:15.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/intermezzo/journal_ext3.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 262,268 ****
  
          block *= (inode->i_sb->s_blocksize / 512);
  
!         CDEBUG(D_CACHE, "Need %ld blocks, have %ld.\n", block, inode->i_blocks);
  
          if (block > inode->i_blocks) {
                  EXIT;
--- 262,268 ----
  
          block *= (inode->i_sb->s_blocksize / 512);
  
!         CDEBUG(D_CACHE, "Need %llu blocks, have %llu.\n", (unsigned long long)block, (unsigned long long)inode->i_blocks);
  
          if (block > inode->i_blocks) {
                  EXIT;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/isofs/inode.c linux-2.4.22-ashuariadevel/fs/isofs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/isofs/inode.c	2002-11-29 08:53:15.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/isofs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 976,982 ****
  /*
   * Used by the standard interfaces.
   */
! static int isofs_get_block(struct inode *inode, long iblock,
  		    struct buffer_head *bh_result, int create)
  {
  	if ( create ) {
--- 976,982 ----
  /*
   * Used by the standard interfaces.
   */
! static int isofs_get_block(struct inode *inode, sector_t iblock,
  		    struct buffer_head *bh_result, int create)
  {
  	if ( create ) {
***************
*** 984,993 ****
  		return -EROFS;
  	}
  
! 	return isofs_get_blocks(inode, iblock, &bh_result, 1) ? 0 : -EIO;
  }
  
! static int isofs_bmap(struct inode *inode, int block)
  {
  	struct buffer_head dummy;
  	int error;
--- 984,994 ----
  		return -EROFS;
  	}
  
! 	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, sector_t block)
  {
  	struct buffer_head dummy;
  	int error;
***************
*** 1000,1006 ****
  	return 0;
  }
  
! struct buffer_head *isofs_bread(struct inode *inode, unsigned int block)
  {
  	unsigned int blknr = isofs_bmap(inode, block);
  	if (!blknr)
--- 1001,1007 ----
  	return 0;
  }
  
! struct buffer_head *isofs_bread(struct inode *inode, sector_t block)
  {
  	unsigned int blknr = isofs_bmap(inode, block);
  	if (!blknr)
***************
*** 1013,1019 ****
  	return block_read_full_page(page,isofs_get_block);
  }
  
! static int _isofs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping,block,isofs_get_block);
  }
--- 1014,1020 ----
  	return block_read_full_page(page,isofs_get_block);
  }
  
! static sector_t _isofs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,isofs_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/jbd/commit.c linux-2.4.22-ashuariadevel/fs/jbd/commit.c
*** linux-2.4.22-ashuariadevel.backup/fs/jbd/commit.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/jbd/commit.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 373,380 ****
  			}
  			
  			bh = jh2bh(descriptor);
! 			jbd_debug(4, "JBD: got buffer %ld (%p)\n",
! 				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);
--- 373,380 ----
  			}
  			
  			bh = jh2bh(descriptor);
! 			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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/jbd/journal.c linux-2.4.22-ashuariadevel/fs/jbd/journal.c
*** linux-2.4.22-ashuariadevel.backup/fs/jbd/journal.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/jbd/journal.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1587,1595 ****
  	
  	if (buffer_dirty(bh)) {
  		printk ("%sUnexpected dirty buffer encountered at "
! 			"%s:%d (%s blocknr %lu)\n",
  			KERN_WARNING, function, line,
! 			kdevname(bh->b_dev), bh->b_blocknr);
  #ifdef JBD_PARANOID_WRITES
  		J_ASSERT_BH (bh, !buffer_dirty(bh));
  #endif	
--- 1587,1595 ----
  	
  	if (buffer_dirty(bh)) {
  		printk ("%sUnexpected dirty buffer encountered at "
! 			"%s:%d (%s blocknr %llu)\n",
  			KERN_WARNING, function, line,
! 			kdevname(bh->b_dev), (unsigned long long)bh->b_blocknr);
  #ifdef JBD_PARANOID_WRITES
  		J_ASSERT_BH (bh, !buffer_dirty(bh));
  #endif	
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/jbd/revoke.c linux-2.4.22-ashuariadevel/fs/jbd/revoke.c
*** linux-2.4.22-ashuariadevel.backup/fs/jbd/revoke.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/jbd/revoke.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 389,395 ****
  		record = find_revoke_record(journal, bh->b_blocknr);
  		if (record) {
  			jbd_debug(4, "cancelled existing revoke on "
! 				  "blocknr %lu\n", bh->b_blocknr);
  			list_del(&record->hash);
  			kmem_cache_free(revoke_record_cache, record);
  			did_revoke = 1;
--- 389,395 ----
  		record = find_revoke_record(journal, bh->b_blocknr);
  		if (record) {
  			jbd_debug(4, "cancelled existing revoke on "
! 				  "blocknr %llu\n", (unsigned long long)bh->b_blocknr);
  			list_del(&record->hash);
  			kmem_cache_free(revoke_record_cache, record);
  			did_revoke = 1;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/jfs/inode.c linux-2.4.22-ashuariadevel/fs/jfs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/jfs/inode.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/jfs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 199,205 ****
  	set_cflag(COMMIT_Dirty, inode);
  }
  
! static int jfs_get_block(struct inode *ip, long lblock,
  			 struct buffer_head *bh_result, int create)
  {
  	s64 lblock64 = lblock;
--- 199,205 ----
  	set_cflag(COMMIT_Dirty, inode);
  }
  
! static int jfs_get_block(struct inode *ip, sector_t lblock,
  			 struct buffer_head *bh_result, int create)
  {
  	s64 lblock64 = lblock;
***************
*** 322,334 ****
  	return block_prepare_write(page, from, to, jfs_get_block);
  }
  
! static int jfs_bmap(struct address_space *mapping, long 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)
  {
  	return generic_direct_IO(rw, inode, iobuf, blocknr,
  				 blocksize, jfs_get_block);
--- 322,334 ----
  	return block_prepare_write(page, from, to, jfs_get_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,
! 			 sector_t blocknr, int blocksize)
  {
  	return generic_direct_IO(rw, inode, iobuf, blocknr,
  				 blocksize, jfs_get_block);
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/minix/inode.c linux-2.4.22-ashuariadevel/fs/minix/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/minix/inode.c	2002-02-26 04:38:09.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/minix/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 292,298 ****
  	return 0;
  }
  
! static int minix_get_block(struct inode *inode, long block,
  		    struct buffer_head *bh_result, int create)
  {
  	if (INODE_VERSION(inode) == MINIX_V1)
--- 292,298 ----
  	return 0;
  }
  
! 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,319 ****
  {
  	return block_prepare_write(page,from,to,minix_get_block);
  }
! static int minix_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping,block,minix_get_block);
  }
--- 313,319 ----
  {
  	return block_prepare_write(page,from,to,minix_get_block);
  }
! static sector_t minix_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,minix_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/minix/itree_common.c linux-2.4.22-ashuariadevel/fs/minix/itree_common.c
*** linux-2.4.22-ashuariadevel.backup/fs/minix/itree_common.c	2002-02-26 04:38:09.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/minix/itree_common.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 140,146 ****
  	return -EAGAIN;
  }
  
! static inline int get_block(struct inode * inode, long block,
  			struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
--- 140,146 ----
  	return -EAGAIN;
  }
  
! static inline int get_block(struct inode * inode, sector_t block,
  			struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/nfs/direct.c linux-2.4.22-ashuariadevel/fs/nfs/direct.c
*** linux-2.4.22-ashuariadevel.backup/fs/nfs/direct.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/nfs/direct.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 348,354 ****
   */
  int
  nfs_direct_IO(int rw, struct file *file, struct kiobuf *iobuf,
! 	unsigned long blocknr, int blocksize)
  {
  	int result = -EINVAL;
  	size_t count = iobuf->length;
--- 348,354 ----
   */
  int
  nfs_direct_IO(int rw, struct file *file, struct kiobuf *iobuf,
! 	sector_t blocknr, int blocksize)
  {
  	int result = -EINVAL;
  	size_t count = iobuf->length;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/acorn.c linux-2.4.22-ashuariadevel/fs/partitions/acorn.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/acorn.c	2002-08-03 09:39:45.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/acorn.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 462,468 ****
   * 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)
  {
  	int i;
  
--- 462,468 ----
   * Returns: -1 on error, 0 if not ADFS format, 1 if ok.
   */
  int acorn_partition(struct gendisk *hd, struct block_device *bdev,
! 		    sector_t first_sect, int first_minor)
  {
  	int i;
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/acorn.h linux-2.4.22-ashuariadevel/fs/partitions/acorn.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/acorn.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/acorn.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 51,55 ****
  	
  
  int acorn_partition(struct gendisk *hd, struct block_device *bdev,
! 		   unsigned long first_sect, int first_minor);
  
--- 51,55 ----
  	
  
  int acorn_partition(struct gendisk *hd, struct block_device *bdev,
! 		   sector_t first_sect, int first_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/amiga.c linux-2.4.22-ashuariadevel/fs/partitions/amiga.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/amiga.c	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/amiga.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 32,38 ****
  
  int
  amiga_partition(struct gendisk *hd, struct block_device *bdev,
! 		unsigned long first_sector, int first_part_minor)
  {
  	Sector sect;
  	unsigned char *data;
--- 32,38 ----
  
  int
  amiga_partition(struct gendisk *hd, struct block_device *bdev,
! 		sector_t first_sector, int first_part_minor)
  {
  	Sector sect;
  	unsigned char *data;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/amiga.h linux-2.4.22-ashuariadevel/fs/partitions/amiga.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/amiga.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/amiga.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 4,8 ****
  
  int
  amiga_partition(struct gendisk *hd, struct block_device *bdev,
! 		unsigned long first_sector, int first_part_minor);
  
--- 4,8 ----
  
  int
  amiga_partition(struct gendisk *hd, struct block_device *bdev,
! 		sector_t first_sector, int first_part_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/atari.c linux-2.4.22-ashuariadevel/fs/partitions/atari.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/atari.c	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/atari.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 41,47 ****
  }
  
  int atari_partition (struct gendisk *hd, struct block_device *bdev,
! 		     unsigned long first_sector, int minor)
  {
  	int m_lim = minor + hd->max_p;
  	Sector sect;
--- 41,47 ----
  }
  
  int atari_partition (struct gendisk *hd, struct block_device *bdev,
! 		     sector_t first_sector, int minor)
  {
  	int m_lim = minor + hd->max_p;
  	Sector sect;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/atari.h linux-2.4.22-ashuariadevel/fs/partitions/atari.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/atari.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/atari.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 32,36 ****
  } __attribute__((__packed__));
  
  int atari_partition (struct gendisk *hd, struct block_device *bdev,
! 		     unsigned long first_sector, int first_part_minor);
  
--- 32,36 ----
  } __attribute__((__packed__));
  
  int atari_partition (struct gendisk *hd, struct block_device *bdev,
! 		     sector_t first_sector, int first_part_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/check.c linux-2.4.22-ashuariadevel/fs/partitions/check.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/check.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/check.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 19,24 ****
--- 19,25 ----
  #include <linux/blk.h>
  #include <linux/init.h>
  #include <linux/raid/md.h>
+ #include <linux/blkdev.h>
  
  #include "check.h"
  
***************
*** 35,45 ****
  #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) = {
  #ifdef CONFIG_ACORN_PARTITION
  	acorn_partition,
  #endif
--- 36,45 ----
  #include "ultrix.h"
  #include "efi.h"
  
  
  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, sector_t first_sect, int first_minor) = {
  #ifdef CONFIG_ACORN_PARTITION
  	acorn_partition,
  #endif
***************
*** 208,214 ****
  /*
   * Add a partitions details to the devices partition description.
   */
! void add_gd_partition(struct gendisk *hd, int minor, int start, int size)
  {
  #ifndef CONFIG_DEVFS_FS
  	char buf[40];
--- 208,214 ----
  /*
   * Add a partitions details to the devices partition description.
   */
! void add_gd_partition(struct gendisk *hd, int minor, sector_t start, sector_t size)
  {
  #ifndef CONFIG_DEVFS_FS
  	char buf[40];
***************
*** 231,237 ****
  {
  	devfs_handle_t de = NULL;
  	static int first_time = 1;
! 	unsigned long first_sector;
  	struct block_device *bdev;
  	char buf[64];
  	int i;
--- 231,237 ----
  {
  	devfs_handle_t de = NULL;
  	static int first_time = 1;
! 	sector_t first_sector;
  	struct block_device *bdev;
  	char buf[64];
  	int i;
***************
*** 378,391 ****
   */
  
  void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors,
! 	struct block_device_operations *ops, long 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)
  {
  	int i;
  	int first_minor	= drive << dev->minor_shift;
--- 378,391 ----
   */
  
  void register_disk(struct gendisk *gdev, kdev_t dev, unsigned minors,
! 	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, sector_t size)
  {
  	int i;
  	int first_minor	= drive << dev->minor_shift;
***************
*** 419,431 ****
  	}
  }
  
! unsigned char *read_dev_sector(struct block_device *bdev, unsigned long 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,
  			(filler_t *)mapping->a_ops->readpage, NULL);
  	if (!IS_ERR(page)) {
  		wait_on_page(page);
--- 419,430 ----
  	}
  }
  
! unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
  {
  	struct address_space *mapping = bdev->bd_inode->i_mapping;
  	struct page *page;
  
! 	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);
***************
*** 434,440 ****
  		if (PageError(page))
  			goto fail;
  		p->v = page;
! 		return (unsigned char *)page_address(page) + 512 * (n % sect);
  fail:
  		page_cache_release(page);
  	}
--- 433,439 ----
  		if (PageError(page))
  			goto fail;
  		p->v = page;
! 		return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9);
  fail:
  		page_cache_release(page);
  	}
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/check.h linux-2.4.22-ashuariadevel/fs/partitions/check.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/check.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/check.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 2,12 ****
   * add_partition adds a partitions details to the devices partition
   * description.
   */
! void add_gd_partition(struct gendisk *hd, int minor, int start, int size);
  
  typedef struct {struct page *v;} Sector;
  
! unsigned char *read_dev_sector(struct block_device *, unsigned long, Sector *);
  
  static inline void put_dev_sector(Sector p)
  {
--- 2,12 ----
   * add_partition adds a partitions details to the devices partition
   * description.
   */
! 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 *, sector_t, Sector *);
  
  static inline void put_dev_sector(Sector p)
  {
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/efi.c linux-2.4.22-ashuariadevel/fs/partitions/efi.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/efi.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/efi.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 712,718 ****
   */
  int
  efi_partition(struct gendisk *hd, struct block_device *bdev,
! 	      unsigned long first_sector, int first_part_minor)
  {
  
  	kdev_t dev = to_kdev_t(bdev->bd_dev);
--- 712,718 ----
   */
  int
  efi_partition(struct gendisk *hd, struct block_device *bdev,
! 	      sector_t first_sector, int first_part_minor)
  {
  
  	kdev_t dev = to_kdev_t(bdev->bd_dev);
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/efi.h linux-2.4.22-ashuariadevel/fs/partitions/efi.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/efi.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/efi.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 110,115 ****
  /* Functions */
  extern int
   efi_partition(struct gendisk *hd, struct block_device *bdev,
! 	      unsigned long first_sector, int first_part_minor);
  
  #endif
--- 110,115 ----
  /* Functions */
  extern int
   efi_partition(struct gendisk *hd, struct block_device *bdev,
! 	      sector_t first_sector, int first_part_minor);
  
  #endif
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/ldm.c linux-2.4.22-ashuariadevel/fs/partitions/ldm.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/ldm.c	2003-06-13 23:51:37.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/ldm.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1482,1488 ****
   *            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)
  {
  	struct ldmdb  *ldb;
  	unsigned long base;
--- 1482,1488 ----
   *            Or @bdev is a dynamic disk, but it may be corrupted
   */
  int ldm_partition (struct gendisk *hd, struct block_device *bdev,
! 	sector_t first_sector, int first_minor)
  {
  	struct ldmdb  *ldb;
  	unsigned long base;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/ldm.h linux-2.4.22-ashuariadevel/fs/partitions/ldm.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/ldm.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/ldm.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 215,221 ****
  };
  
  int ldm_partition (struct gendisk *hd, struct block_device *bdev,
! 	unsigned long first_sector, int first_minor);
  
  #endif /* _FS_PT_LDM_H_ */
  
--- 215,221 ----
  };
  
  int ldm_partition (struct gendisk *hd, struct block_device *bdev,
! 	sector_t first_sector, int first_minor);
  
  #endif /* _FS_PT_LDM_H_ */
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/mac.c linux-2.4.22-ashuariadevel/fs/partitions/mac.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/mac.c	2002-08-03 09:39:45.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/mac.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 25,31 ****
   */
  
  int mac_partition(struct gendisk *hd, struct block_device *bdev,
! 		unsigned long fsec, int first_part_minor)
  {
  	Sector sect;
  	unsigned char *data;
--- 25,31 ----
   */
  
  int mac_partition(struct gendisk *hd, struct block_device *bdev,
! 		sector_t fsec, int first_part_minor)
  {
  	Sector sect;
  	unsigned char *data;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/mac.h linux-2.4.22-ashuariadevel/fs/partitions/mac.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/mac.h	2002-08-03 09:39:45.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/mac.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 49,52 ****
      /* ... more stuff */
  };
  
! int mac_partition(struct gendisk *hd, struct block_device *bdev, unsigned long fsec, int first_part_minor);
--- 49,52 ----
      /* ... more stuff */
  };
  
! int mac_partition(struct gendisk *hd, struct block_device *bdev, sector_t fsec, int first_part_minor);
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/msdos.c linux-2.4.22-ashuariadevel/fs/partitions/msdos.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/msdos.c	2002-11-29 08:53:15.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/msdos.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 551,557 ****
  }
   
  int msdos_partition(struct gendisk *hd, struct block_device *bdev,
! 		    unsigned long first_sector, int first_part_minor)
  {
  	int i, minor = first_part_minor;
  	Sector sect;
--- 551,557 ----
  }
   
  int msdos_partition(struct gendisk *hd, struct block_device *bdev,
! 		    sector_t first_sector, int first_part_minor)
  {
  	int i, minor = first_part_minor;
  	Sector sect;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/msdos.h linux-2.4.22-ashuariadevel/fs/partitions/msdos.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/msdos.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/msdos.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 5,9 ****
  #define MSDOS_LABEL_MAGIC		0xAA55
  
  int msdos_partition(struct gendisk *hd, struct block_device *bdev,
! 		    unsigned long first_sector, int first_part_minor);
  
--- 5,9 ----
  #define MSDOS_LABEL_MAGIC		0xAA55
  
  int msdos_partition(struct gendisk *hd, struct block_device *bdev,
! 		    sector_t first_sector, int first_part_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/osf.c linux-2.4.22-ashuariadevel/fs/partitions/osf.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/osf.c	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/osf.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 18,24 ****
  #include "osf.h"
  
  int osf_partition(struct gendisk *hd, struct block_device *bdev,
! 		unsigned long first_sector, int current_minor)
  {
  	int i;
  	Sector sect;
--- 18,24 ----
  #include "osf.h"
  
  int osf_partition(struct gendisk *hd, struct block_device *bdev,
! 		sector_t first_sector, int current_minor)
  {
  	int i;
  	Sector sect;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/osf.h linux-2.4.22-ashuariadevel/fs/partitions/osf.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/osf.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/osf.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 5,9 ****
  #define DISKLABELMAGIC (0x82564557UL)
  
  int osf_partition(struct gendisk *hd, struct block_device *bdev,
! 		unsigned long first_sector, int current_minor);
  
--- 5,9 ----
  #define DISKLABELMAGIC (0x82564557UL)
  
  int osf_partition(struct gendisk *hd, struct block_device *bdev,
! 		sector_t first_sector, int current_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/sgi.c linux-2.4.22-ashuariadevel/fs/partitions/sgi.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/sgi.c	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/sgi.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 17,23 ****
  #include "check.h"
  #include "sgi.h"
  
! int sgi_partition(struct gendisk *hd, struct block_device *bdev, unsigned long first_sector, int current_minor)
  {
  	int i, csum, magic;
  	unsigned int *ui, start, blocks, cs;
--- 17,23 ----
  #include "check.h"
  #include "sgi.h"
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/sgi.h linux-2.4.22-ashuariadevel/fs/partitions/sgi.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/sgi.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/sgi.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 3,9 ****
   */
  
  extern int sgi_partition(struct gendisk *hd, struct block_device *bdev,
! 	 unsigned long first_sector, int first_part_minor);
  
  #define SGI_LABEL_MAGIC 0x0be5a941
  
--- 3,9 ----
   */
  
  extern int sgi_partition(struct gendisk *hd, struct block_device *bdev,
! 	 sector_t first_sector, int first_part_minor);
  
  #define SGI_LABEL_MAGIC 0x0be5a941
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/sun.c linux-2.4.22-ashuariadevel/fs/partitions/sun.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/sun.c	2002-11-29 08:53:15.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/sun.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 24,30 ****
  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 i, csum;
  	unsigned short *ush;
--- 24,30 ----
  extern void md_autodetect_dev(kdev_t dev);
  #endif
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/sun.h linux-2.4.22-ashuariadevel/fs/partitions/sun.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/sun.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/sun.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 5,9 ****
  #define SUN_LABEL_MAGIC          0xDABE
  
  int sun_partition(struct gendisk *hd, struct block_device *bdev,
! 		  unsigned long first_sector, int first_part_minor);
  
--- 5,9 ----
  #define SUN_LABEL_MAGIC          0xDABE
  
  int sun_partition(struct gendisk *hd, struct block_device *bdev,
! 		  sector_t first_sector, int first_part_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/ultrix.c linux-2.4.22-ashuariadevel/fs/partitions/ultrix.c
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/ultrix.c	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/ultrix.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 15,21 ****
  #include "check.h"
  
  int ultrix_partition(struct gendisk *hd, struct block_device *bdev,
!                             unsigned long first_sector, int first_part_minor)
  {
  	int i;
  	Sector sect;
--- 15,21 ----
  #include "check.h"
  
  int ultrix_partition(struct gendisk *hd, struct block_device *bdev,
!                             sector_t first_sector, int first_part_minor)
  {
  	int i;
  	Sector sect;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/partitions/ultrix.h linux-2.4.22-ashuariadevel/fs/partitions/ultrix.h
*** linux-2.4.22-ashuariadevel.backup/fs/partitions/ultrix.h	2001-10-02 12:03:26.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/partitions/ultrix.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 3,7 ****
   */
  
  int ultrix_partition(struct gendisk *hd, struct block_device *bdev,
!                      unsigned long first_sector, int first_part_minor);
  
--- 3,7 ----
   */
  
  int ultrix_partition(struct gendisk *hd, struct block_device *bdev,
!                      sector_t first_sector, int first_part_minor);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/qnx4/inode.c linux-2.4.22-ashuariadevel/fs/qnx4/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/qnx4/inode.c	2002-08-03 09:39:45.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/qnx4/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 204,210 ****
  	return NULL;
  }
  
! int qnx4_get_block( struct inode *inode, long iblock, struct buffer_head *bh, int create )
  {
  	unsigned long phys;
  
--- 204,210 ----
  	return NULL;
  }
  
! int qnx4_get_block( struct inode *inode, sector_t iblock, struct buffer_head *bh, int create )
  {
  	unsigned long phys;
  
***************
*** 424,430 ****
  	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)
  {
  	return generic_block_bmap(mapping,block,qnx4_get_block);
  }
--- 424,430 ----
  	return cont_prepare_write(page,from,to,qnx4_get_block,
  		&page->mapping->host->u.qnx4_i.mmu_private);
  }
! static sector_t qnx4_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,qnx4_get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/reiserfs/inode.c linux-2.4.22-ashuariadevel/fs/reiserfs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/reiserfs/inode.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/reiserfs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 17,23 ****
  #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,
  			       struct buffer_head * bh_result, int create);
  
  /* This spinlock guards inode pkey in private part of inode
--- 17,23 ----
  #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, sector_t block,
  			       struct buffer_head * bh_result, int create);
  
  /* This spinlock guards inode pkey in private part of inode
***************
*** 221,227 ****
  // 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,
  				 struct buffer_head * bh_result,
  				 int args)
  {
--- 221,227 ----
  // Please improve the english/clarity in the comment above, as it is
  // hard to understand.
  
! static int _get_block_create_0 (struct inode * inode, sector_t block,
  				 struct buffer_head * bh_result,
  				 int args)
  {
***************
*** 230,236 ****
      struct buffer_head * bh;
      struct item_head * ih, tmp_ih;
      int fs_gen ;
!     int blocknr;
      char * p = NULL;
      int chars;
      int ret ;
--- 230,236 ----
      struct buffer_head * bh;
      struct item_head * ih, tmp_ih;
      int fs_gen ;
!     sector_t blocknr;
      char * p = NULL;
      int chars;
      int ret ;
***************
*** 383,391 ****
  
  // 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,
  		   struct buffer_head * bh_result, int create)
  {
      if (!file_capable (inode, block))
  	return -EFBIG;
  
--- 383,393 ----
  
  // this is called to create file map. So, _get_block_create_0 will not
  // read direct item
! 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;
  
***************
*** 413,424 ****
  ** 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,
  			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,
  			struct buffer_head * bh_result, int create) {
      int ret ;
  
--- 415,426 ----
  ** 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, 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, sector_t block,
  			struct buffer_head * bh_result, int create) {
      int ret ;
  
***************
*** 527,533 ****
      return reiserfs_new_unf_blocknrs (th, inode, allocated_block_nr, path, block);
  }
  
! static int reiserfs_get_block (struct inode * inode, long block,
  			       struct buffer_head * bh_result, int create)
  {
      int repeat, retval;
--- 529,535 ----
      return reiserfs_new_unf_blocknrs (th, inode, allocated_block_nr, path, block);
  }
  
! static int reiserfs_get_block (struct inode * inode, sector_t block,
  			       struct buffer_head * bh_result, int create)
  {
      int repeat, retval;
***************
*** 557,562 ****
--- 559,569 ----
      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;
***************
*** 571,582 ****
      ** 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, 
  	                           create | GET_BLOCK_READ_DIRECT) ;
  	unlock_kernel() ;
! 	return ret;
      }
  
      /* If file is of such a size, that it might have a tail and tails are enabled
--- 578,588 ----
      ** log anything, so we don't need to start a transaction
      */
      if (!(create & GET_BLOCK_CREATE)) {
  	/* find number of block-th logical block of the file */
! 	retval = _get_block_create_0 (inode, block, bh_result, 
  	                           create | GET_BLOCK_READ_DIRECT) ;
  	unlock_kernel() ;
! 	return retval;
      }
  
      /* If file is of such a size, that it might have a tail and tails are enabled
***************
*** 912,919 ****
      pop_journal_writer(windex) ;
      unlock_kernel() ;
      reiserfs_check_path(&path) ;
!     return retval;
! }
  
  
  //
--- 918,926 ----
      pop_journal_writer(windex) ;
      unlock_kernel() ;
      reiserfs_check_path(&path) ;
!   
!   return retval;
! } 
  
  
  //
***************
*** 2123,2130 ****
  }
  
  
! static int reiserfs_aop_bmap(struct address_space *as, long block) {
!   return generic_block_bmap(as, block, reiserfs_bmap) ;
  }
  
  static int reiserfs_commit_write(struct file *f, struct page *page, 
--- 2130,2137 ----
  }
  
  
! 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, 
***************
*** 2219,2225 ****
  }
  
  static int reiserfs_direct_io(int rw, struct inode *inode, 
!                               struct kiobuf *iobuf, unsigned long blocknr,
  			      int blocksize) 
  {
      lock_kernel();
--- 2226,2232 ----
  }
  
  static int reiserfs_direct_io(int rw, struct inode *inode, 
!                               struct kiobuf *iobuf, sector_t blocknr,
  			      int blocksize) 
  {
      lock_kernel();
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/reiserfs/journal.c linux-2.4.22-ashuariadevel/fs/reiserfs/journal.c
*** linux-2.4.22-ashuariadevel.backup/fs/reiserfs/journal.c	2003-12-09 11:52:13.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/reiserfs/journal.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 1011,1025 ****
      ** is not marked JDirty_wait
      */
      if ((!was_jwait) && !buffer_locked(saved_bh)) {
! reiserfs_warning(s, "journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction\n", 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)) {
!       reiserfs_warning(s, "clm-2083: locked buffer %lu in flush_journal_list\n", 
!               saved_bh->b_blocknr) ;
        wait_on_buffer(saved_bh) ;
        if (!buffer_uptodate(saved_bh)) {
          reiserfs_panic(s, "journal-923: buffer write failed\n") ;
--- 1011,1025 ----
      ** is not marked JDirty_wait
      */
      if ((!was_jwait) && !buffer_locked(saved_bh)) {
! 	    reiserfs_warning(s, "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)) {
!       reiserfs_warning(s, "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") ;
***************
*** 1032,1039 ****
        submit_logged_buffer(saved_bh) ;
        count++ ;
      } else {
!       reiserfs_warning(s, "clm-2082: Unable to flush buffer %lu in flush_journal_list\n",
!               saved_bh->b_blocknr) ;
      }
  free_cnode:
      last = cn ;
--- 1032,1039 ----
        submit_logged_buffer(saved_bh) ;
        count++ ;
      } else {
!       reiserfs_warning(s, "clm-2082: Unable to flush buffer %llu in flush_journal_list\n",
! 		       (unsigned long long)saved_bh->b_blocknr) ;
      }
  free_cnode:
      last = cn ;
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/reiserfs/prints.c linux-2.4.22-ashuariadevel/fs/reiserfs/prints.c
*** linux-2.4.22-ashuariadevel.backup/fs/reiserfs/prints.c	2003-08-25 20:44:43.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/reiserfs/prints.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 138,145 ****
  
  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,
  	   bh->b_state, bh->b_page,
  	   buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE",
  	   buffer_dirty (bh) ? "DIRTY" : "CLEAN",
--- 138,145 ----
  
  static void sprintf_buffer_head (char * buf, struct buffer_head * bh) 
  {
!   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",
***************
*** 372,378 ****
      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,
  		    bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h));
  	    h ++;
  	}
--- 372,378 ----
      if (tb) {
  	while (tb->insert_size[h]) {
  	    bh = PATH_H_PBUFFER (path, h);
! 	    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 ++;
  	}
***************
*** 382,389 ****
        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,
  		  PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1);
  	  
  	  offset --;
--- 382,389 ----
        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 (%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 --;
***************
*** 514,521 ****
  	return 1;
      }
  
!     printk ("%s\'s super block in block %ld\n======================\n",
!             kdevname (bh->b_dev), 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));
--- 514,521 ----
  	return 1;
      }
  
!     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));
***************
*** 552,559 ****
      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);
  
      return 0;
  }
--- 552,559 ----
      if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8))
  	return 1;
  
!     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;
  }
***************
*** 578,584 ****
  	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);
  }
  
  
--- 578,584 ----
  	if (print_internal (bh, first, last))
  	    if (print_super_block (bh))
  		if (print_desc_block (bh))
! 		    printk ("Block %llu contains unformatted data\n", (unsigned long long)bh->b_blocknr);
  }
  
  
***************
*** 613,631 ****
  	    tbFh = 0;
  	}
  	sprintf (print_tb_buf + strlen (print_tb_buf),
! 		 "* %d * %3ld(%2d) * %3ld(%2d) * %3ld(%2d) * %5ld * %5ld * %5ld * %5ld * %5ld *\n",
  		 h, 
! 		 (tbSh) ? (tbSh->b_blocknr):(-1),
  		 (tbSh) ? atomic_read (&(tbSh->b_count)) : -1,
! 		 (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),
  		 (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));
      }
  
      sprintf (print_tb_buf + strlen (print_tb_buf), 
--- 613,631 ----
  	    tbFh = 0;
  	}
  	sprintf (print_tb_buf + strlen (print_tb_buf),
! 		 "* %d * %3llu(%2d) * %3llu(%2d) * %3llu(%2d) * %5llu * %5llu * %5llu * %5llu * %5llu *\n",
  		 h, 
! 		 (unsigned long long)((tbSh) ? (tbSh->b_blocknr):(-1)),
  		 (tbSh) ? atomic_read (&(tbSh->b_count)) : -1,
! 		 (unsigned long long)((tb->L[h]) ? (tb->L[h]->b_blocknr):(-1)),
  		 (tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1,
! 		 (unsigned long long)((tb->R[h]) ? (tb->R[h]->b_blocknr):(-1)),
  		 (tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -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), 
***************
*** 652,658 ****
      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,
  		 tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0, 
  		 (i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", ");
  
--- 652,658 ----
      h = 0;
      for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++)
  	sprintf (print_tb_buf + strlen (print_tb_buf),
! 		 "%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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/reiserfs/super.c linux-2.4.22-ashuariadevel/fs/reiserfs/super.c
*** linux-2.4.22-ashuariadevel.backup/fs/reiserfs/super.c	2003-12-09 11:52:21.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/reiserfs/super.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 923,930 ****
      if (!is_any_reiserfs_magic_string (rs) || sb_blocksize(rs) !=
  	s->s_blocksize) {
        printk ("sh-2011: read_super_block: "
! 	      "can't find a reiserfs filesystem on (dev %s, block %lu, size %lu)\n",
! 	      kdevname(s->s_dev), bh->b_blocknr, s->s_blocksize);    
        brelse (bh);
        return 1;
      }
--- 923,930 ----
      if (!is_any_reiserfs_magic_string (rs) || sb_blocksize(rs) !=
  	s->s_blocksize) {
        printk ("sh-2011: read_super_block: "
! 	      "can't find a reiserfs filesystem on (dev %s, block %llu, size %lu)\n",
! 	      kdevname(s->s_dev), (unsigned long long)bh->b_blocknr, s->s_blocksize);
        brelse (bh);
        return 1;
      }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/sysv/itree.c linux-2.4.22-ashuariadevel/fs/sysv/itree.c
*** linux-2.4.22-ashuariadevel.backup/fs/sysv/itree.c	2002-02-26 04:38:09.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/sysv/itree.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 191,197 ****
  	return -EAGAIN;
  }
  
! static int get_block(struct inode *inode, long iblock, struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
  	int offsets[DEPTH];
--- 191,197 ----
  	return -EAGAIN;
  }
  
! static int get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
  {
  	int err = -EIO;
  	int offsets[DEPTH];
***************
*** 425,431 ****
  {
  	return block_prepare_write(page,from,to,get_block);
  }
! static int sysv_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping,block,get_block);
  }
--- 425,431 ----
  {
  	return block_prepare_write(page,from,to,get_block);
  }
! static sector_t sysv_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,get_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/fs/udf/inode.c linux-2.4.22-ashuariadevel/fs/udf/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/udf/inode.c	2002-08-03 09:39:45.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/udf/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 61,67 ****
  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);
  
  /*
   * udf_put_inode
--- 61,67 ----
  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 *, sector_t, struct buffer_head *, int);
  
  /*
   * udf_put_inode
***************
*** 146,152 ****
  	return block_prepare_write(page, from, to, udf_get_block);
  }
  
! static int udf_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping,block,udf_get_block);
  }
--- 146,152 ----
  	return block_prepare_write(page, from, to, udf_get_block);
  }
  
! static sector_t udf_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,udf_get_block);
  }
***************
*** 311,317 ****
  	return dbh;
  }
  
! static int udf_get_block(struct inode *inode, long block, struct buffer_head *bh_result, int create)
  {
  	int err, new;
  	struct buffer_head *bh;
--- 311,317 ----
  	return dbh;
  }
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/fs/ufs/inode.c linux-2.4.22-ashuariadevel/fs/ufs/inode.c
*** linux-2.4.22-ashuariadevel.backup/fs/ufs/inode.c	2002-02-26 04:38:09.000000000 +0900
--- linux-2.4.22-ashuariadevel/fs/ufs/inode.c	2004-02-02 14:35:09.000000000 +0900
***************
*** 308,314 ****
  	return result;
  }
  
! static int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create)
  {
  	struct super_block * sb;
  	struct ufs_sb_private_info * uspi;
--- 308,314 ----
  	return result;
  }
  
! 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,469 ****
  {
  	return block_prepare_write(page,from,to,ufs_getfrag_block);
  }
! static int ufs_bmap(struct address_space *mapping, long block)
  {
  	return generic_block_bmap(mapping,block,ufs_getfrag_block);
  }
--- 463,469 ----
  {
  	return block_prepare_write(page,from,to,ufs_getfrag_block);
  }
! static sector_t ufs_bmap(struct address_space *mapping, sector_t block)
  {
  	return generic_block_bmap(mapping,block,ufs_getfrag_block);
  }
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/asm-i386/types.h linux-2.4.22-ashuariadevel/include/asm-i386/types.h
*** linux-2.4.22-ashuariadevel.backup/include/asm-i386/types.h	2004-01-19 17:47:34.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/asm-i386/types.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 52,57 ****
--- 52,61 ----
  #endif
  typedef u64 dma64_addr_t;
  
+ #ifdef CONFIG_LBD
+ typedef u64 sector_t;
+ #define HAVE_ARCH_SECTOR_T
+ #endif
  #endif /* __KERNEL__ */
  
  #endif
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/asm-ppc/types.h linux-2.4.22-ashuariadevel/include/asm-ppc/types.h
*** linux-2.4.22-ashuariadevel.backup/include/asm-ppc/types.h	2003-06-13 23:51:38.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/asm-ppc/types.h	2004-02-02 14:35:09.000000000 +0900
***************
*** 45,50 ****
--- 45,56 ----
  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 -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/blkdev.h linux-2.4.22-ashuariadevel/include/linux/blkdev.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/blkdev.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/blkdev.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 34,42 ****
  	int cmd;		/* READ or WRITE */
  	int errors;
  	unsigned long start_time;
! 	unsigned long sector;
  	unsigned long nr_sectors;
! 	unsigned long hard_sector, hard_nr_sectors;
  	unsigned int nr_segments;
  	unsigned int nr_hw_segments;
  	unsigned long current_nr_sectors, hard_cur_sectors;
--- 34,43 ----
  	int cmd;		/* READ or WRITE */
  	int errors;
  	unsigned long start_time;
! 	sector_t sector;
  	unsigned long 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;
***************
*** 232,239 ****
  
  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 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 *);
--- 233,240 ----
  
  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, 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 *);
***************
*** 250,256 ****
  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 int * blksize_size[MAX_BLKDEV];
  
--- 251,257 ----
  extern void generic_unplug_device(void *);
  extern inline int blk_seg_merge_ok(struct buffer_head *, struct buffer_head *);
  
! extern sector_t * blk_size[MAX_BLKDEV];
  
  extern int * blksize_size[MAX_BLKDEV];
  
***************
*** 366,369 ****
--- 367,384 ----
  	return retval;
  }
  
+ #ifdef CONFIG_LBD
+ # include <asm/div64.h>
+ # 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 -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/fs.h linux-2.4.22-ashuariadevel/include/linux/fs.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/fs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/fs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 249,255 ****
  struct buffer_head {
  	/* First cache line: */
  	struct buffer_head *b_next;	/* Hash queue list */
! 	unsigned long 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) */
--- 249,255 ----
  struct buffer_head {
  	/* First cache line: */
  	struct buffer_head *b_next;	/* Hash queue list */
! 	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) */
***************
*** 398,410 ****
  	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);
  	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);
  #define KERNEL_HAS_DIRECT_FILEIO /* Unfortunate kludge due to lack of foresight */
! 	int (*direct_fileIO)(int, struct file *, struct kiobuf *, unsigned long, int);
  	void (*removepage)(struct page *); /* called when page gets removed from the inode */
  };
  
--- 398,410 ----
  	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 */
! 	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 *, sector_t, int);
  #define KERNEL_HAS_DIRECT_FILEIO /* Unfortunate kludge due to lack of foresight */
! 	int (*direct_fileIO)(int, struct file *, struct kiobuf *, sector_t, int);
  	void (*removepage)(struct page *); /* called when page gets removed from the inode */
  };
  
***************
*** 462,468 ****
  	time_t			i_ctime;
  	unsigned int		i_blkbits;
  	unsigned long		i_blksize;
! 	unsigned long		i_blocks;
  	unsigned long		i_version;
  	unsigned short          i_bytes;
  	struct semaphore	i_sem;
--- 462,468 ----
  	time_t			i_ctime;
  	unsigned int		i_blkbits;
  	unsigned long		i_blksize;
! 	sector_t		i_blocks;
  	unsigned long		i_version;
  	unsigned short          i_bytes;
  	struct semaphore	i_sem;
***************
*** 1298,1304 ****
  extern void sync_supers(kdev_t dev, int wait);
  extern void sync_supers_lockfs(kdev_t);
  extern void unlockfs(kdev_t);
! extern int bmap(struct inode *, int);
  extern int notify_change(struct dentry *, struct iattr *);
  extern int permission(struct inode *, int);
  extern int vfs_permission(struct inode *, int);
--- 1298,1304 ----
  extern void sync_supers(kdev_t dev, int wait);
  extern void sync_supers_lockfs(kdev_t);
  extern void unlockfs(kdev_t);
! 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);
***************
*** 1455,1462 ****
  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 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);
--- 1455,1462 ----
  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, 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);
***************
*** 1475,1490 ****
  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)
  {
  	return bread(sb->s_dev, block, sb->s_blocksize);
  }
! static inline struct buffer_head * sb_getblk(struct super_block *sb, int 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)
  {
  	return get_hash_table(sb->s_dev, block, sb->s_blocksize);
  }
--- 1475,1490 ----
  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, 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, 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, sector_t block)
  {
  	return get_hash_table(sb->s_dev, block, sb->s_blocksize);
  }
***************
*** 1493,1501 ****
  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);
  
! typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int);
  
  /* Generic buffer handling for block filesystems.. */
  extern int try_to_release_page(struct page * page, int gfp_mask);
--- 1493,1501 ----
  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, sector_t [], 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);
***************
*** 1512,1521 ****
  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 *);
  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 waitfor_one_page(struct page *);
  extern int writeout_one_page(struct page *);
  
--- 1512,1521 ----
  extern int block_commit_write(struct page *page, unsigned from, unsigned to);
  extern int block_sync_page(struct page *);
  
! 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 *, sector_t, int, get_block_t *);
  extern int waitfor_one_page(struct page *);
  extern int writeout_one_page(struct page *);
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/genhd.h linux-2.4.22-ashuariadevel/include/linux/genhd.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/genhd.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/genhd.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 59,66 ****
  #  include <linux/devfs_fs_kernel.h>
  
  struct hd_struct {
! 	unsigned long start_sect;
! 	unsigned long nr_sects;
  	devfs_handle_t de;              /* primary (master) devfs entry  */
  #ifdef CONFIG_DEVFS_FS
  	int number;
--- 59,66 ----
  #  include <linux/devfs_fs_kernel.h>
  
  struct hd_struct {
! 	sector_t start_sect;
! 	sector_t nr_sects;
  	devfs_handle_t de;              /* primary (master) devfs entry  */
  #ifdef CONFIG_DEVFS_FS
  	int number;
***************
*** 94,100 ****
  	int max_p;			/* maximum partitions per device */
  
  	struct hd_struct *part;		/* [indexed by minor] */
! 	int *sizes;			/* [idem], device size in blocks */
  	int nr_real;			/* number of real devices */
  
  	void *real_devices;		/* internal use */
--- 94,100 ----
  	int max_p;			/* maximum partitions per device */
  
  	struct hd_struct *part;		/* [indexed by minor] */
! 	sector_t *sizes;		/* [idem], device size in blocks */
  	int nr_real;			/* number of real devices */
  
  	void *real_devices;		/* internal use */
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/ide.h linux-2.4.22-ashuariadevel/include/linux/ide.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/ide.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/ide.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 1148,1154 ****
  	int		(*suspend)(ide_drive_t *);
  	int		(*resume)(ide_drive_t *);
  	int		(*flushcache)(ide_drive_t *);
! 	ide_startstop_t	(*do_request)(ide_drive_t *, struct request *, unsigned long);
  	int		(*end_request)(ide_drive_t *, int);
  	u8		(*sense)(ide_drive_t *, const char *, u8);
  	ide_startstop_t	(*error)(ide_drive_t *, const char *, u8);
--- 1148,1154 ----
  	int		(*suspend)(ide_drive_t *);
  	int		(*resume)(ide_drive_t *);
  	int		(*flushcache)(ide_drive_t *);
! 	ide_startstop_t	(*do_request)(ide_drive_t *, struct request *, sector_t);
  	int		(*end_request)(ide_drive_t *, int);
  	u8		(*sense)(ide_drive_t *, const char *, u8);
  	ide_startstop_t	(*error)(ide_drive_t *, const char *, u8);
***************
*** 1159,1165 ****
  	int		(*media_change)(ide_drive_t *);
  	void		(*revalidate)(ide_drive_t *);
  	void		(*pre_reset)(ide_drive_t *);
! 	unsigned long	(*capacity)(ide_drive_t *);
  	ide_startstop_t	(*special)(ide_drive_t *);
  	ide_proc_entry_t	*proc;
  	int		(*init)(void);
--- 1159,1165 ----
  	int		(*media_change)(ide_drive_t *);
  	void		(*revalidate)(ide_drive_t *);
  	void		(*pre_reset)(ide_drive_t *);
! 	sector_t	(*capacity)(ide_drive_t *);
  	ide_startstop_t	(*special)(ide_drive_t *);
  	ide_proc_entry_t	*proc;
  	int		(*init)(void);
***************
*** 1570,1576 ****
  extern int set_transfer(ide_drive_t *, ide_task_t *);
  extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
  
! extern ide_startstop_t __ide_do_rw_disk(ide_drive_t *, struct request *, unsigned long);
  /*
   * ide_system_bus_speed() returns what we think is the system VESA/PCI
   * bus speed (in MHz).  This is used for calculating interface PIO timings.
--- 1570,1576 ----
  extern int set_transfer(ide_drive_t *, ide_task_t *);
  extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
  
! extern ide_startstop_t __ide_do_rw_disk(ide_drive_t *, struct request *, sector_t);
  /*
   * ide_system_bus_speed() returns what we think is the system VESA/PCI
   * bus speed (in MHz).  This is used for calculating interface PIO timings.
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/iobuf.h linux-2.4.22-ashuariadevel/include/linux/iobuf.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/iobuf.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/iobuf.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 42,48 ****
  
  	struct page **  maplist;
  	struct buffer_head ** bh;
! 	unsigned long * blocks;
  
  	/* Dynamic state for IO completion: */
  	atomic_t	io_count;	/* IOs still in progress */
--- 42,48 ----
  
  	struct page **  maplist;
  	struct buffer_head ** bh;
! 	sector_t * blocks;
  
  	/* Dynamic state for IO completion: */
  	atomic_t	io_count;	/* IOs still in progress */
***************
*** 74,79 ****
  /* fs/buffer.c */
  
  int	brw_kiovec(int rw, int nr, struct kiobuf *iovec[], 
! 		   kdev_t dev, unsigned long b[], int size);
  
  #endif /* __LINUX_IOBUF_H */
--- 74,79 ----
  /* fs/buffer.c */
  
  int	brw_kiovec(int rw, int nr, struct kiobuf *iovec[], 
! 		   kdev_t dev, sector_t b[], int size);
  
  #endif /* __LINUX_IOBUF_H */
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/iso_fs.h linux-2.4.22-ashuariadevel/include/linux/iso_fs.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/iso_fs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/iso_fs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 219,225 ****
  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 int isofs_get_blocks(struct inode *, long, struct buffer_head **, unsigned long);
  
  extern struct inode_operations isofs_dir_inode_operations;
--- 219,225 ----
  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, 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,240 ****
  #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 void leak_check_brelse(struct buffer_head * bh);
  #endif /* LEAK_CHECK */
  
--- 234,240 ----
  #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, sector_t block);
  extern void leak_check_brelse(struct buffer_head * bh);
  #endif /* LEAK_CHECK */
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/loop.h linux-2.4.22-ashuariadevel/include/linux/loop.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/loop.h	2003-12-09 11:52:14.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/loop.h	2004-02-02 14:35:10.000000000 +0900
***************
*** 34,40 ****
  	int		lo_flags;
  	int		(*transfer)(struct loop_device *, int cmd,
  				    char *raw_buf, char *loop_buf, int size,
! 				    int real_block);
  	char		lo_name[LO_NAME_SIZE];
  	char		lo_encrypt_key[LO_KEY_SIZE];
  	__u32           lo_init[2];
--- 34,40 ----
  	int		lo_flags;
  	int		(*transfer)(struct loop_device *, int cmd,
  				    char *raw_buf, char *loop_buf, int size,
! 				    sector_t real_block);
  	char		lo_name[LO_NAME_SIZE];
  	char		lo_encrypt_key[LO_KEY_SIZE];
  	__u32           lo_init[2];
***************
*** 133,139 ****
  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);
  	int (*init)(struct loop_device *, struct loop_info *); 
  	/* release is called from loop_unregister_transfer or clr_fd */
  	int (*release)(struct loop_device *); 
--- 133,139 ----
  struct loop_func_table {
  	int number; 	/* filter type */ 
  	int (*transfer)(struct loop_device *lo, int cmd, char *raw_buf,
! 			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 -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/msdos_fs.h linux-2.4.22-ashuariadevel/include/linux/msdos_fs.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/msdos_fs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/msdos_fs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 272,278 ****
  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,
  			 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);
--- 272,278 ----
  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, 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 -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/nfs_fs.h linux-2.4.22-ashuariadevel/include/linux/nfs_fs.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/nfs_fs.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/nfs_fs.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 284,290 ****
  /*
   * linux/fs/nfs/direct.c
   */
! extern int  nfs_direct_IO(int, struct file *, struct kiobuf *, unsigned long, int);
  
  /*
   * linux/fs/mount_clnt.c
--- 284,290 ----
  /*
   * linux/fs/nfs/direct.c
   */
! extern int  nfs_direct_IO(int, struct file *, struct kiobuf *, sector_t, int);
  
  /*
   * linux/fs/mount_clnt.c
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/qnx4_fs.h linux-2.4.22-ashuariadevel/include/linux/qnx4_fs.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/qnx4_fs.h	2000-06-30 07:53:42.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/qnx4_fs.h	2004-02-02 14:35:10.000000000 +0900
***************
*** 118,124 ****
  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);
  
  #endif				/* __KERNEL__ */
  
--- 118,124 ----
  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, sector_t iblock, struct buffer_head *bh, int create);
  
  #endif				/* __KERNEL__ */
  
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/raid/linear.h linux-2.4.22-ashuariadevel/include/linux/raid/linear.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/raid/linear.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/raid/linear.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 5,12 ****
  
  struct dev_info {
  	kdev_t		dev;
! 	unsigned long	size;
! 	unsigned long	offset;
  };
  
  typedef struct dev_info dev_info_t;
--- 5,12 ----
  
  struct dev_info {
  	kdev_t		dev;
! 	sector_t	size;
! 	sector_t	offset;
  };
  
  typedef struct dev_info dev_info_t;
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/raid/md.h linux-2.4.22-ashuariadevel/include/linux/raid/md.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/raid/md.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/raid/md.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 60,66 ****
  #define MD_MINOR_VERSION                90
  #define MD_PATCHLEVEL_VERSION           0
  
! extern int 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);
--- 60,66 ----
  #define MD_MINOR_VERSION                90
  #define MD_PATCHLEVEL_VERSION           0
  
! 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 -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/raid/md_k.h linux-2.4.22-ashuariadevel/include/linux/raid/md_k.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/raid/md_k.h	2003-06-13 23:51:39.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/raid/md_k.h	2004-02-02 14:35:10.000000000 +0900
***************
*** 164,170 ****
  
  	kdev_t dev;			/* Device number */
  	kdev_t old_dev;			/*  "" when it was last imported */
! 	unsigned long size;		/* Device size (in blocks) */
  	mddev_t *mddev;			/* RAID array if running */
  	unsigned long last_events;	/* IO event timestamp */
  
--- 164,170 ----
  
  	kdev_t dev;			/* Device number */
  	kdev_t old_dev;			/*  "" when it was last imported */
! 	sector_t size;		/* Device size (in blocks) */
  	mddev_t *mddev;			/* RAID array if running */
  	unsigned long last_events;	/* IO event timestamp */
  
***************
*** 172,178 ****
  
  	mdp_super_t *sb;
  	struct page *sb_page;
! 	unsigned long sb_offset;
  
  	int alias_device;		/* device alias to the same disk */
  	int faulty;			/* if faulty do not issue IO requests */
--- 172,178 ----
  
  	mdp_super_t *sb;
  	struct page *sb_page;
! 	sector_t sb_offset;
  
  	int alias_device;		/* device alias to the same disk */
  	int faulty;			/* if faulty do not issue IO requests */
diff -Ncr linux-2.4.22-ashuariadevel.backup/include/linux/types.h linux-2.4.22-ashuariadevel/include/linux/types.h
*** linux-2.4.22-ashuariadevel.backup/include/linux/types.h	2004-01-19 17:47:35.000000000 +0900
--- linux-2.4.22-ashuariadevel/include/linux/types.h	2004-02-02 15:20:57.000000000 +0900
***************
*** 134,137 ****
--- 134,142 ----
  	char			f_fpack[6];
  };
  
+ #ifndef HAVE_ARCH_SECTOR_T
+ typedef unsigned long sector_t;
+ #endif
+ #define HAVE_SECTOR_T 1
+ 
  #endif /* _LINUX_TYPES_H */
diff -Ncr linux-2.4.22-ashuariadevel.backup/mm/page_io.c linux-2.4.22-ashuariadevel/mm/page_io.c
*** linux-2.4.22-ashuariadevel.backup/mm/page_io.c	2002-11-29 08:53:15.000000000 +0900
--- linux-2.4.22-ashuariadevel/mm/page_io.c	2004-02-02 14:35:10.000000000 +0900
***************
*** 36,42 ****
  static int rw_swap_page_base(int rw, swp_entry_t entry, struct page *page)
  {
  	unsigned long offset;
! 	int zones[PAGE_SIZE/512];
  	int zones_used;
  	kdev_t dev = 0;
  	int block_size;
--- 36,42 ----
  static int rw_swap_page_base(int rw, swp_entry_t entry, struct page *page)
  {
  	unsigned long offset;
! 	sector_t zones[PAGE_SIZE/512];
  	int zones_used;
  	kdev_t dev = 0;
  	int block_size;
***************
*** 55,61 ****
  		block_size = PAGE_SIZE;
  	} else if (swapf) {
  		int i, j;
! 		unsigned int block = offset
  			<< (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits);
  
  		block_size = swapf->i_sb->s_blocksize;
--- 55,61 ----
  		block_size = PAGE_SIZE;
  	} else if (swapf) {
  		int i, j;
! 		sector_t block = offset
  			<< (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits);
  
  		block_size = swapf->i_sb->s_blocksize;
