Commit be48ef9e authored by Andrew Morton's avatar Andrew Morton Committed by Patrick Mochel

[PATCH] 64-bit sector_t - printk changes and sector_t cleanup

From Peter Chubb

printk changes: A sector_t can be either 64 or 32 bits, so cast it to a
printable type that is at least as large as 64-bits on all platforms
(i.e., cast to unsigned long long and use a %llu format)

Transition to 64-bit sector_t: fix isofs_get_blocks by converting the
(possibly 64-bit) arg to a long.

SCSI 64-bit sector_t cleanup: capacity now stored as sector_t; make
sure that the READ_CAPACITY command doesn't sign-extend its returned
value; avoid 64-bit division when printing size in MB.

Still to do:
 - 16-byte SCSI commands
 - Individual scsi drivers.
parent 9f2f568c
...@@ -177,16 +177,16 @@ static int show_partition(struct seq_file *part, void *v) ...@@ -177,16 +177,16 @@ static int show_partition(struct seq_file *part, void *v)
return 0; return 0;
/* show the full disk and all non-0 size partitions of it */ /* show the full disk and all non-0 size partitions of it */
seq_printf(part, "%4d %4d %10ld %s\n", seq_printf(part, "%4d %4d %10llu %s\n",
sgp->major, sgp->first_minor, sgp->major, sgp->first_minor,
get_capacity(sgp) >> 1, (unsigned long long)get_capacity(sgp) >> 1,
disk_name(sgp, 0, buf)); disk_name(sgp, 0, buf));
for (n = 0; n < (1<<sgp->minor_shift) - 1; n++) { for (n = 0; n < (1<<sgp->minor_shift) - 1; n++) {
if (sgp->part[n].nr_sects == 0) if (sgp->part[n].nr_sects == 0)
continue; continue;
seq_printf(part, "%4d %4d %10ld %s\n", seq_printf(part, "%4d %4d %10llu %s\n",
sgp->major, n + 1 + sgp->first_minor, sgp->major, n + 1 + sgp->first_minor,
sgp->part[n].nr_sects >> 1 , (unsigned long long)sgp->part[n].nr_sects >> 1 ,
disk_name(sgp, n + 1, buf)); disk_name(sgp, n + 1, buf));
} }
......
...@@ -671,7 +671,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg) ...@@ -671,7 +671,7 @@ void blk_dump_rq_flags(struct request *rq, char *msg)
} while (bit < __REQ_NR_BITS); } while (bit < __REQ_NR_BITS);
if (rq->flags & REQ_CMD) if (rq->flags & REQ_CMD)
printk("sector %lu, nr/cnr %lu/%u\n", rq->sector, printk("sector %llu, nr/cnr %lu/%u\n", (unsigned long long)rq->sector,
rq->nr_sectors, rq->nr_sectors,
rq->current_nr_sectors); rq->current_nr_sectors);
...@@ -1817,10 +1817,10 @@ void generic_make_request(struct bio *bio) ...@@ -1817,10 +1817,10 @@ void generic_make_request(struct bio *bio)
* device, e.g., when mounting a device. */ * device, e.g., when mounting a device. */
printk(KERN_INFO printk(KERN_INFO
"attempt to access beyond end of device\n"); "attempt to access beyond end of device\n");
printk(KERN_INFO "%s: rw=%ld, want=%ld, limit=%Lu\n", printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
bdevname(bio->bi_bdev), bdevname(bio->bi_bdev),
bio->bi_rw, bio->bi_rw,
sector + nr_sectors, (unsigned long long) sector + nr_sectors,
(long long) maxsector); (long long) maxsector);
set_bit(BIO_EOF, &bio->bi_flags); set_bit(BIO_EOF, &bio->bi_flags);
...@@ -1849,8 +1849,10 @@ void generic_make_request(struct bio *bio) ...@@ -1849,8 +1849,10 @@ void generic_make_request(struct bio *bio)
} }
if (unlikely(bio_sectors(bio) > q->max_sectors)) { if (unlikely(bio_sectors(bio) > q->max_sectors)) {
printk("bio too big (%u > %u)\n", bio_sectors(bio), printk("bio too big device %s (%u > %u)\n",
q->max_sectors); bdevname(bio->bi_bdev),
bio_sectors(bio),
q->max_sectors);
goto end_io; goto end_io;
} }
...@@ -1953,8 +1955,8 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors) ...@@ -1953,8 +1955,8 @@ int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
req->errors = 0; req->errors = 0;
if (!uptodate) { if (!uptodate) {
printk("end_request: I/O error, dev %s, sector %lu\n", printk("end_request: I/O error, dev %s, sector %llu\n",
kdevname(req->rq_dev), req->sector); kdevname(req->rq_dev), (unsigned long long)req->sector);
error = -EIO; error = -EIO;
} }
......
...@@ -90,7 +90,7 @@ static devfs_handle_t devfs_handle; /* For the directory */ ...@@ -90,7 +90,7 @@ static devfs_handle_t devfs_handle; /* For the directory */
* Transfer functions * Transfer functions
*/ */
static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf,
char *loop_buf, int size, int real_block) char *loop_buf, int size, sector_t real_block)
{ {
if (raw_buf != loop_buf) { if (raw_buf != loop_buf) {
if (cmd == READ) if (cmd == READ)
...@@ -103,7 +103,7 @@ static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf, ...@@ -103,7 +103,7 @@ static int transfer_none(struct loop_device *lo, int cmd, char *raw_buf,
} }
static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf, static int transfer_xor(struct loop_device *lo, int cmd, char *raw_buf,
char *loop_buf, int size, int real_block) char *loop_buf, int size, sector_t real_block)
{ {
char *in, *out, *key; char *in, *out, *key;
int i, keysize; int i, keysize;
...@@ -179,18 +179,18 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos) ...@@ -179,18 +179,18 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
struct address_space_operations *aops = mapping->a_ops; struct address_space_operations *aops = mapping->a_ops;
struct page *page; struct page *page;
char *kaddr, *data; char *kaddr, *data;
unsigned long index; pgoff_t index;
unsigned size, offset; unsigned size, offset;
int len; int len;
int ret = 0; int ret = 0;
down(&mapping->host->i_sem); down(&mapping->host->i_sem);
index = pos >> PAGE_CACHE_SHIFT; index = pos >> PAGE_CACHE_SHIFT;
offset = pos & (PAGE_CACHE_SIZE - 1); offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1);
data = kmap(bvec->bv_page) + bvec->bv_offset; data = kmap(bvec->bv_page) + bvec->bv_offset;
len = bvec->bv_len; len = bvec->bv_len;
while (len > 0) { while (len > 0) {
int IV = index * (PAGE_CACHE_SIZE/bsize) + offset/bsize; sector_t IV = index * (PAGE_CACHE_SIZE/bsize) + offset/bsize;
int transfer_result; int transfer_result;
size = PAGE_CACHE_SIZE - offset; size = PAGE_CACHE_SIZE - offset;
...@@ -209,7 +209,7 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos) ...@@ -209,7 +209,7 @@ do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
* The transfer failed, but we still write the data to * The transfer failed, but we still write the data to
* keep prepare/commit calls balanced. * keep prepare/commit calls balanced.
*/ */
printk(KERN_ERR "loop: transfer error block %ld\n", index); printk(KERN_ERR "loop: transfer error block %llu\n", (unsigned long long)index);
memset(kaddr + offset, 0, size); memset(kaddr + offset, 0, size);
} }
flush_dcache_page(page); flush_dcache_page(page);
...@@ -700,7 +700,11 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, ...@@ -700,7 +700,11 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
lo->lo_backing_file = file; lo->lo_backing_file = file;
lo->transfer = NULL; lo->transfer = NULL;
lo->ioctl = NULL; lo->ioctl = NULL;
figure_loop_size(lo); if (figure_loop_size(lo)) {
error = -EFBIG;
fput(file);
goto out_putf;
}
lo->old_gfp_mask = inode->i_mapping->gfp_mask; lo->old_gfp_mask = inode->i_mapping->gfp_mask;
inode->i_mapping->gfp_mask = GFP_NOIO; inode->i_mapping->gfp_mask = GFP_NOIO;
...@@ -820,6 +824,7 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg) ...@@ -820,6 +824,7 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg)
struct loop_info info; struct loop_info info;
int err; int err;
unsigned int type; unsigned int type;
loff_t offset;
if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid && if (lo->lo_encrypt_key_size && lo->lo_key_owner != current->uid &&
!capable(CAP_SYS_ADMIN)) !capable(CAP_SYS_ADMIN))
...@@ -835,13 +840,23 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg) ...@@ -835,13 +840,23 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg)
return -EINVAL; return -EINVAL;
if (type == LO_CRYPT_XOR && info.lo_encrypt_key_size == 0) if (type == LO_CRYPT_XOR && info.lo_encrypt_key_size == 0)
return -EINVAL; return -EINVAL;
err = loop_release_xfer(lo); err = loop_release_xfer(lo);
if (!err) if (!err)
err = loop_init_xfer(lo, type, &info); 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) if (err)
return err; return err;
lo->lo_offset = info.lo_offset;
strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE); strncpy(lo->lo_name, info.lo_name, LO_NAME_SIZE);
lo->transfer = xfer_funcs[type]->transfer; lo->transfer = xfer_funcs[type]->transfer;
...@@ -854,7 +869,7 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg) ...@@ -854,7 +869,7 @@ static int loop_set_status(struct loop_device *lo, struct loop_info *arg)
info.lo_encrypt_key_size); info.lo_encrypt_key_size);
lo->lo_key_owner = current->uid; lo->lo_key_owner = current->uid;
} }
figure_loop_size(lo);
return 0; return 0;
} }
...@@ -1059,7 +1074,7 @@ int __init loop_init(void) ...@@ -1059,7 +1074,7 @@ int __init loop_init(void)
for (i = 0; i < max_loop; i++) { for (i = 0; i < max_loop; i++) {
struct loop_device *lo = &loop_dev[i]; struct loop_device *lo = &loop_dev[i];
struct gendisk *disk = disks[i]; struct gendisk *disk = disks[i];
memset(lo, 0, sizeof(struct loop_device)); memset(lo, 0, sizeof(*lo));
init_MUTEX(&lo->lo_ctl_mutex); init_MUTEX(&lo->lo_ctl_mutex);
init_MUTEX_LOCKED(&lo->lo_sem); init_MUTEX_LOCKED(&lo->lo_sem);
init_MUTEX_LOCKED(&lo->lo_bh_mutex); init_MUTEX_LOCKED(&lo->lo_bh_mutex);
......
...@@ -535,8 +535,9 @@ static void do_ps2esdi_request(request_queue_t * q) ...@@ -535,8 +535,9 @@ static void do_ps2esdi_request(request_queue_t * q)
} }
/* is request is valid */ /* is request is valid */
else { else {
printk("Grrr. error. ps2esdi_drives: %d, %lu %lu\n", ps2esdi_drives, printk("Grrr. error. ps2esdi_drives: %d, %lu %llu\n",
CURRENT->sector, get_capacity(ps2esdi_gendisk[unit])); ps2esdi_drives, CURRENT->sector,
(unsigned long long)get_capacity(ps2esdi_gendisk[unit]));
end_request(CURRENT, FAIL); end_request(CURRENT, FAIL);
} }
......
...@@ -3160,12 +3160,13 @@ static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int ge ...@@ -3160,12 +3160,13 @@ static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int ge
heads = 64; heads = 64;
sectors = 32; sectors = 32;
cylinders = disk->capacity / (heads * sectors); cylinders = (int)disk->capacity / (heads * sectors);
if (cylinders > 1024) { if (cylinders > 1024) {
heads = 255; heads = 255;
sectors = 63; sectors = 63;
cylinders = disk->capacity / (heads * sectors); cylinders = (int)disk->capacity / (heads * sectors);
} }
geom[0] = heads; geom[0] = heads;
......
...@@ -19,3 +19,16 @@ obj-$(CONFIG_BLK_DEV_MD) += md.o ...@@ -19,3 +19,16 @@ obj-$(CONFIG_BLK_DEV_MD) += md.o
obj-$(CONFIG_BLK_DEV_LVM) += lvm-mod.o obj-$(CONFIG_BLK_DEV_LVM) += lvm-mod.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
# I can't get around the need for 64-bit division in raid[0-5]
ifdef CONFIG_LBD
LIBGCC:= $(shell ${CC} ${CFLAGS} -print-libgcc-file-name)
md.o: md.c _udivdi3.o _umoddi3.o
$(CC) $(c_flags) -c -o md-tmp.o md.c
$(LD) -r -o md.o md-tmp.o _udivdi3.o _umoddi3.o
_udivdi3.o _umoddi3.o: $(LIBGCC)
$(AR) x $(LIBGCC) $@
endif
...@@ -802,9 +802,9 @@ void nftl_request(RQFUNC_ARG) ...@@ -802,9 +802,9 @@ void nftl_request(RQFUNC_ARG)
DEBUG(MTD_DEBUG_LEVEL2, "NFTL_request\n"); DEBUG(MTD_DEBUG_LEVEL2, "NFTL_request\n");
DEBUG(MTD_DEBUG_LEVEL3, DEBUG(MTD_DEBUG_LEVEL3,
"NFTL %s request, from sector 0x%04lx for %d sectors\n", "NFTL %s request, from sector 0x%04llx for %d sectors\n",
(req->cmd == READ) ? "Read " : "Write", (req->cmd == READ) ? "Read " : "Write",
req->sector, req->current_nr_sectors); (unsigned long long)req->sector, req->current_nr_sectors);
dev = minor(req->rq_dev); dev = minor(req->rq_dev);
block = req->sector; block = req->sector;
......
...@@ -2748,7 +2748,7 @@ ahc_linux_biosparam(Disk *disk, struct block_device *bdev, int geom[]) ...@@ -2748,7 +2748,7 @@ ahc_linux_biosparam(Disk *disk, struct block_device *bdev, int geom[])
} }
heads = 64; heads = 64;
sectors = 32; sectors = 32;
cylinders = disk->capacity / (heads * sectors); cylinders = sector_div(disk->capacity, (heads * sectors));
if (aic7xxx_extended != 0) if (aic7xxx_extended != 0)
extended = 1; extended = 1;
...@@ -2759,7 +2759,7 @@ ahc_linux_biosparam(Disk *disk, struct block_device *bdev, int geom[]) ...@@ -2759,7 +2759,7 @@ ahc_linux_biosparam(Disk *disk, struct block_device *bdev, int geom[])
if (extended && cylinders >= 1024) { if (extended && cylinders >= 1024) {
heads = 255; heads = 255;
sectors = 63; sectors = 63;
cylinders = disk->capacity / (heads * sectors); cylinders = sector_div(disk->capacity, (heads * sectors));
} }
geom[0] = heads; geom[0] = heads;
geom[1] = sectors; geom[1] = sectors;
......
...@@ -2509,16 +2509,16 @@ static void scsi_dump_status(int level) ...@@ -2509,16 +2509,16 @@ static void scsi_dump_status(int level)
for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) { for (SDpnt = shpnt->host_queue; SDpnt; SDpnt = SDpnt->next) {
for (SCpnt = SDpnt->device_queue; SCpnt; SCpnt = SCpnt->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 */ /* (0) h:c:t:l (dev sect nsect cnumsec sg) (ret all flg) (to/cmd to ito) cmd snse result %d %x */
printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4ld %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n", printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4llu %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n",
i++, i++,
SCpnt->host->host_no, SCpnt->host->host_no,
SCpnt->channel, SCpnt->channel,
SCpnt->target, SCpnt->target,
SCpnt->lun, SCpnt->lun,
kdevname(SCpnt->request->rq_dev), kdevname(SCpnt->request->rq_dev),
SCpnt->request->sector, (unsigned long long)SCpnt->request->sector,
SCpnt->request->nr_sectors, SCpnt->request->nr_sectors,
(long)SCpnt->request->current_nr_sectors, (long)SCpnt->request->current_nr_sectors,
SCpnt->request->rq_status, SCpnt->request->rq_status,
......
...@@ -299,7 +299,8 @@ static struct gendisk **sd_disks; ...@@ -299,7 +299,8 @@ static struct gendisk **sd_disks;
**/ **/
static int sd_init_command(Scsi_Cmnd * SCpnt) static int sd_init_command(Scsi_Cmnd * SCpnt)
{ {
int dsk_nr, part_nr, block, this_count; int dsk_nr, part_nr, this_count;
sector_t block;
Scsi_Device *sdp; Scsi_Device *sdp;
#if CONFIG_SCSI_LOGGING #if CONFIG_SCSI_LOGGING
char nbuff[6]; char nbuff[6];
...@@ -316,8 +317,8 @@ static int sd_init_command(Scsi_Cmnd * SCpnt) ...@@ -316,8 +317,8 @@ static int sd_init_command(Scsi_Cmnd * SCpnt)
block = SCpnt->request->sector; block = SCpnt->request->sector;
this_count = SCpnt->request_bufflen >> 9; this_count = SCpnt->request_bufflen >> 9;
SCSI_LOG_HLQUEUE(1, printk("sd_command_init: dsk_nr=%d, block=%d, " SCSI_LOG_HLQUEUE(1, printk("sd_command_init: dsk_nr=%d, block=%llu, "
"count=%d\n", dsk_nr, block, this_count)); "count=%d\n", dsk_nr, (unsigned long long)block, this_count));
sdp = SCpnt->device; sdp = SCpnt->device;
/* >>>>> the "(part_nr & 0xf)" excludes 15th partition, why?? */ /* >>>>> the "(part_nr & 0xf)" excludes 15th partition, why?? */
...@@ -340,8 +341,8 @@ static int sd_init_command(Scsi_Cmnd * SCpnt) ...@@ -340,8 +341,8 @@ static int sd_init_command(Scsi_Cmnd * SCpnt)
return 0; return 0;
} }
SCSI_LOG_HLQUEUE(2, sd_dskname(dsk_nr, nbuff)); SCSI_LOG_HLQUEUE(2, sd_dskname(dsk_nr, nbuff));
SCSI_LOG_HLQUEUE(2, printk("%s : [part_nr=%d], block=%d\n", SCSI_LOG_HLQUEUE(2, printk("%s : [part_nr=%d], block=%llu\n",
nbuff, part_nr, block)); nbuff, part_nr, (unsigned long long)block));
/* /*
* If we have a 1K hardware sectorsize, prevent access to single * If we have a 1K hardware sectorsize, prevent access to single
...@@ -604,8 +605,8 @@ static void sd_rw_intr(Scsi_Cmnd * SCpnt) ...@@ -604,8 +605,8 @@ static void sd_rw_intr(Scsi_Cmnd * SCpnt)
int result = SCpnt->result; int result = SCpnt->result;
int this_count = SCpnt->bufflen >> 9; int this_count = SCpnt->bufflen >> 9;
int good_sectors = (result == 0 ? this_count : 0); int good_sectors = (result == 0 ? this_count : 0);
int block_sectors = 1; sector_t block_sectors = 1;
long error_sector; sector_t error_sector;
#if CONFIG_SCSI_LOGGING #if CONFIG_SCSI_LOGGING
char nbuff[6]; char nbuff[6];
...@@ -1008,7 +1009,7 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname, ...@@ -1008,7 +1009,7 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname,
SRpnt->sr_sense_buffer[2] == NOT_READY) SRpnt->sr_sense_buffer[2] == NOT_READY)
sdp->changed = 1; sdp->changed = 1;
/* Either no media are present but the drive didnt tell us, /* Either no media are present but the drive didn't tell us,
or they are present but the read capacity command fails */ or they are present but the read capacity command fails */
/* sdkp->media_present = 0; -- not always correct */ /* sdkp->media_present = 0; -- not always correct */
sdkp->capacity = 0x200000; /* 1 GB - random */ sdkp->capacity = 0x200000; /* 1 GB - random */
...@@ -1016,7 +1017,7 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname, ...@@ -1016,7 +1017,7 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname,
return; return;
} }
sdkp->capacity = 1 + ((buffer[0] << 24) | sdkp->capacity = 1 + (((sector_t)buffer[0] << 24) |
(buffer[1] << 16) | (buffer[1] << 16) |
(buffer[2] << 8) | (buffer[2] << 8) |
buffer[3]); buffer[3]);
...@@ -1052,24 +1053,31 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname, ...@@ -1052,24 +1053,31 @@ sd_read_capacity(Scsi_Disk *sdkp, char *diskname,
* Jacques Gelinas (Jacques@solucorp.qc.ca) * Jacques Gelinas (Jacques@solucorp.qc.ca)
*/ */
int hard_sector = sector_size; int hard_sector = sector_size;
int sz = sdkp->capacity * (hard_sector/256); sector_t sz = sdkp->capacity * (hard_sector/256);
request_queue_t *queue = &sdp->request_queue; request_queue_t *queue = &sdp->request_queue;
sector_t mb;
blk_queue_hardsect_size(queue, hard_sector); blk_queue_hardsect_size(queue, hard_sector);
/* avoid 64-bit division on 32-bit platforms */
mb = sz >> 1;
sector_div(sz, 1250);
mb -= sz - 974;
sector_div(mb, 1950);
printk(KERN_NOTICE "SCSI device %s: " printk(KERN_NOTICE "SCSI device %s: "
"%d %d-byte hdwr sectors (%d MB)\n", "%llu %d-byte hdwr sectors (%llu MB)\n",
diskname, sdkp->capacity, diskname, (unsigned long long)sdkp->capacity,
hard_sector, (sz/2 - sz/1250 + 974)/1950); hard_sector, (unsigned long long)mb);
} }
/* Rescale capacity to 512-byte units */ /* Rescale capacity to 512-byte units */
if (sector_size == 4096) if (sector_size == 4096)
sdkp->capacity <<= 3; sdkp->capacity <<= 3;
if (sector_size == 2048) else if (sector_size == 2048)
sdkp->capacity <<= 2; sdkp->capacity <<= 2;
if (sector_size == 1024) else if (sector_size == 1024)
sdkp->capacity <<= 1; sdkp->capacity <<= 1;
if (sector_size == 256) else if (sector_size == 256)
sdkp->capacity >>= 1; sdkp->capacity >>= 1;
sdkp->device->sector_size = sector_size; sdkp->device->sector_size = sector_size;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#endif #endif
typedef struct scsi_disk { typedef struct scsi_disk {
unsigned capacity; /* size in 512-byte sectors */ sector_t capacity; /* size in 512-byte sectors */
Scsi_Device *device; Scsi_Device *device;
unsigned char media_present; unsigned char media_present;
unsigned char write_prot; unsigned char write_prot;
......
...@@ -323,7 +323,7 @@ static int sr_init_command(Scsi_Cmnd * SCpnt) ...@@ -323,7 +323,7 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
/* /*
* request doesn't start on hw block boundary, add scatter pads * request doesn't start on hw block boundary, add scatter pads
*/ */
if ((SCpnt->request->sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) { if (((unsigned int)SCpnt->request->sector % (s_size >> 9)) || (SCpnt->request_bufflen % s_size)) {
printk("sr: unaligned transfer\n"); printk("sr: unaligned transfer\n");
return 0; return 0;
} }
...@@ -339,7 +339,7 @@ static int sr_init_command(Scsi_Cmnd * SCpnt) ...@@ -339,7 +339,7 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
SCpnt->cmnd[1] = (SCpnt->device->scsi_level <= SCSI_2) ? SCpnt->cmnd[1] = (SCpnt->device->scsi_level <= SCSI_2) ?
((SCpnt->lun << 5) & 0xe0) : 0; ((SCpnt->lun << 5) & 0xe0) : 0;
block = SCpnt->request->sector / (s_size >> 9); block = (unsigned int)SCpnt->request->sector / (s_size >> 9);
if (this_count > 0xffff) if (this_count > 0xffff)
this_count = 0xffff; this_count = 0xffff;
......
...@@ -479,9 +479,10 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino) ...@@ -479,9 +479,10 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino)
!(inode = iget(sb, ino)) || is_bad_inode(inode) || !(inode = iget(sb, ino)) || is_bad_inode(inode) ||
NEXT_ORPHAN(inode) > max_ino) { NEXT_ORPHAN(inode) > max_ino) {
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"bad orphan inode %ld! e2fsck was run?\n", ino); "bad orphan inode %lu! e2fsck was run?\n", ino);
printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%ld) = %d\n", printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n",
bit, bitmap_bh->b_blocknr, bit,
(unsigned long long)bitmap_bh->b_blocknr,
ext3_test_bit(bit, bitmap_bh->b_data)); ext3_test_bit(bit, bitmap_bh->b_data));
printk(KERN_NOTICE "inode=%p\n", inode); printk(KERN_NOTICE "inode=%p\n", inode);
if (inode) { if (inode) {
......
...@@ -934,21 +934,22 @@ static int isofs_statfs (struct super_block *sb, struct statfs *buf) ...@@ -934,21 +934,22 @@ static int isofs_statfs (struct super_block *sb, struct statfs *buf)
* or getblk() if they are not. Returns the number of blocks inserted * or getblk() if they are not. Returns the number of blocks inserted
* (0 == error.) * (0 == error.)
*/ */
int isofs_get_blocks(struct inode *inode, sector_t iblock, int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
struct buffer_head **bh, unsigned long nblocks) struct buffer_head **bh, unsigned long nblocks)
{ {
unsigned long b_off; unsigned long b_off;
unsigned offset, sect_size; unsigned offset, sect_size;
unsigned int firstext; unsigned int firstext;
unsigned long nextino; unsigned long nextino;
long iblock = (long)iblock_s;
int section, rv; int section, rv;
struct iso_inode_info *ei = ISOFS_I(inode); struct iso_inode_info *ei = ISOFS_I(inode);
lock_kernel(); lock_kernel();
rv = 0; rv = 0;
if (iblock < 0) { if (iblock < 0 || iblock != iblock_s) {
printk("isofs_get_blocks: block < 0\n"); printk("isofs_get_blocks: block number too large\n");
goto abort; goto abort;
} }
......
...@@ -355,8 +355,8 @@ void journal_commit_transaction(journal_t *journal) ...@@ -355,8 +355,8 @@ void journal_commit_transaction(journal_t *journal)
} }
bh = jh2bh(descriptor); bh = jh2bh(descriptor);
jbd_debug(4, "JBD: got buffer %ld (%p)\n", jbd_debug(4, "JBD: got buffer %llu (%p)\n",
bh->b_blocknr, bh->b_data); (unsigned long long)bh->b_blocknr, bh->b_data);
header = (journal_header_t *)&bh->b_data[0]; header = (journal_header_t *)&bh->b_data[0];
header->h_magic = htonl(JFS_MAGIC_NUMBER); header->h_magic = htonl(JFS_MAGIC_NUMBER);
header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK); header->h_blocktype = htonl(JFS_DESCRIPTOR_BLOCK);
......
...@@ -388,7 +388,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) ...@@ -388,7 +388,7 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
record = find_revoke_record(journal, bh->b_blocknr); record = find_revoke_record(journal, bh->b_blocknr);
if (record) { if (record) {
jbd_debug(4, "cancelled existing revoke on " jbd_debug(4, "cancelled existing revoke on "
"blocknr %lu\n", bh->b_blocknr); "blocknr %llu\n", (u64)bh->b_blocknr);
list_del(&record->hash); list_del(&record->hash);
kmem_cache_free(revoke_record_cache, record); kmem_cache_free(revoke_record_cache, record);
did_revoke = 1; did_revoke = 1;
......
...@@ -1011,15 +1011,15 @@ static int flush_journal_list(struct super_block *s, ...@@ -1011,15 +1011,15 @@ static int flush_journal_list(struct super_block *s,
** is not marked JDirty_wait ** is not marked JDirty_wait
*/ */
if ((!was_jwait) && !buffer_locked(saved_bh)) { if ((!was_jwait) && !buffer_locked(saved_bh)) {
printk("journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction\n", saved_bh->b_blocknr, printk("journal-813: BAD! buffer %llu %cdirty %cjwait, not in a newer tranasction\n", (unsigned long long)saved_bh->b_blocknr,
was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ; was_dirty ? ' ' : '!', was_jwait ? ' ' : '!') ;
} }
/* kupdate_one_transaction waits on the buffers it is writing, so we /* kupdate_one_transaction waits on the buffers it is writing, so we
** should never see locked buffers here ** should never see locked buffers here
*/ */
if (buffer_locked(saved_bh)) { if (buffer_locked(saved_bh)) {
printk("clm-2083: locked buffer %lu in flush_journal_list\n", printk("clm-2083: locked buffer %llu in flush_journal_list\n",
saved_bh->b_blocknr) ; (unsigned long long)saved_bh->b_blocknr) ;
wait_on_buffer(saved_bh) ; wait_on_buffer(saved_bh) ;
if (!buffer_uptodate(saved_bh)) { if (!buffer_uptodate(saved_bh)) {
reiserfs_panic(s, "journal-923: buffer write failed\n") ; reiserfs_panic(s, "journal-923: buffer write failed\n") ;
...@@ -1032,8 +1032,8 @@ printk("journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction ...@@ -1032,8 +1032,8 @@ printk("journal-813: BAD! buffer %lu %cdirty %cjwait, not in a newer tranasction
submit_logged_buffer(saved_bh) ; submit_logged_buffer(saved_bh) ;
count++ ; count++ ;
} else { } else {
printk("clm-2082: Unable to flush buffer %lu in flush_journal_list\n", printk("clm-2082: Unable to flush buffer %llu in flush_journal_list\n",
saved_bh->b_blocknr) ; (unsigned long long)saved_bh->b_blocknr) ;
} }
free_cnode: free_cnode:
last = cn ; last = cn ;
...@@ -2315,7 +2315,7 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th, struct super_bloc ...@@ -2315,7 +2315,7 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th, struct super_bloc
** could get to disk too early. NOT GOOD. ** could get to disk too early. NOT GOOD.
*/ */
if (!prepared || buffer_locked(bh)) { if (!prepared || buffer_locked(bh)) {
printk("journal-1777: buffer %lu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", bh->b_blocknr, prepared ? ' ' : '!', printk("journal-1777: buffer %llu bad state %cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT\n", (unsigned long long)bh->b_blocknr, prepared ? ' ' : '!',
buffer_locked(bh) ? ' ' : '!', buffer_locked(bh) ? ' ' : '!',
buffer_dirty(bh) ? ' ' : '!', buffer_dirty(bh) ? ' ' : '!',
buffer_journal_dirty(bh) ? ' ' : '!') ; buffer_journal_dirty(bh) ? ' ' : '!') ;
......
...@@ -139,8 +139,8 @@ static void sprintf_block_head (char * buf, struct buffer_head * bh) ...@@ -139,8 +139,8 @@ static void sprintf_block_head (char * buf, struct buffer_head * bh)
static void sprintf_buffer_head (char * buf, struct buffer_head * bh) static void sprintf_buffer_head (char * buf, struct buffer_head * bh)
{ {
sprintf (buf, "dev %s, size %d, blocknr %ld, count %d, state 0x%lx, page %p, (%s, %s, %s)", sprintf (buf, "dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
bdevname (bh->b_bdev), bh->b_size, bh->b_blocknr, bdevname (bh->b_bdev), bh->b_size, (unsigned long long)bh->b_blocknr,
atomic_read (&(bh->b_count)), atomic_read (&(bh->b_count)),
bh->b_state, bh->b_page, bh->b_state, bh->b_page,
buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE", buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE",
...@@ -367,7 +367,7 @@ void print_path (struct tree_balance * tb, struct path * path) ...@@ -367,7 +367,7 @@ void print_path (struct tree_balance * tb, struct path * path)
if (tb) { if (tb) {
while (tb->insert_size[h]) { while (tb->insert_size[h]) {
bh = PATH_H_PBUFFER (path, h); bh = PATH_H_PBUFFER (path, h);
printk ("block %lu (level=%d), position %d\n", bh ? bh->b_blocknr : 0, printk ("block %llu (level=%d), position %d\n", bh ? (unsigned long long)bh->b_blocknr : 0LL,
bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h)); bh ? B_LEVEL (bh) : 0, PATH_H_POSITION (path, h));
h ++; h ++;
} }
...@@ -377,8 +377,8 @@ void print_path (struct tree_balance * tb, struct path * path) ...@@ -377,8 +377,8 @@ void print_path (struct tree_balance * tb, struct path * path)
printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n"); printk ("Offset Bh (b_blocknr, b_count) Position Nr_item\n");
while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) { while ( offset > ILLEGAL_PATH_ELEMENT_OFFSET ) {
bh = PATH_OFFSET_PBUFFER (path, offset); bh = PATH_OFFSET_PBUFFER (path, offset);
printk ("%6d %10p (%9lu, %7d) %8d %7d\n", offset, printk ("%6d %10p (%9llu, %7d) %8d %7d\n", offset,
bh, bh ? bh->b_blocknr : 0, bh ? atomic_read (&(bh->b_count)) : 0, bh, bh ? (unsigned long long)bh->b_blocknr : 0LL, bh ? atomic_read (&(bh->b_count)) : 0,
PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1); PATH_OFFSET_POSITION (path, offset), bh ? B_NR_ITEMS (bh) : -1);
offset --; offset --;
...@@ -510,8 +510,8 @@ static int print_super_block (struct buffer_head * bh) ...@@ -510,8 +510,8 @@ static int print_super_block (struct buffer_head * bh)
return 1; return 1;
} }
printk ("%s\'s super block is in block %ld\n", bdevname (bh->b_bdev), printk ("%s\'s super block is in block %llu\n", bdevname (bh->b_bdev),
bh->b_blocknr); (unsigned long long)bh->b_blocknr);
printk ("Reiserfs version %s\n", version ); printk ("Reiserfs version %s\n", version );
printk ("Block count %u\n", sb_block_count(rs)); printk ("Block count %u\n", sb_block_count(rs));
printk ("Blocksize %d\n", sb_blocksize(rs)); printk ("Blocksize %d\n", sb_blocksize(rs));
...@@ -547,8 +547,8 @@ static int print_desc_block (struct buffer_head * bh) ...@@ -547,8 +547,8 @@ static int print_desc_block (struct buffer_head * bh)
if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8)) if (memcmp(desc->j_magic, JOURNAL_DESC_MAGIC, 8))
return 1; return 1;
printk ("Desc block %lu (j_trans_id %d, j_mount_id %d, j_len %d)", printk ("Desc block %llu (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); (unsigned long long)bh->b_blocknr, desc->j_trans_id, desc->j_mount_id, desc->j_len);
return 0; return 0;
} }
...@@ -573,7 +573,7 @@ void print_block (struct buffer_head * bh, ...)//int print_mode, int first, int ...@@ -573,7 +573,7 @@ void print_block (struct buffer_head * bh, ...)//int print_mode, int first, int
if (print_internal (bh, first, last)) if (print_internal (bh, first, last))
if (print_super_block (bh)) if (print_super_block (bh))
if (print_desc_block (bh)) if (print_desc_block (bh))
printk ("Block %ld contains unformatted data\n", bh->b_blocknr); printk ("Block %llu contains unformatted data\n", (unsigned long long)bh->b_blocknr);
} }
...@@ -608,19 +608,19 @@ void store_print_tb (struct tree_balance * tb) ...@@ -608,19 +608,19 @@ void store_print_tb (struct tree_balance * tb)
tbFh = 0; tbFh = 0;
} }
sprintf (print_tb_buf + strlen (print_tb_buf), sprintf (print_tb_buf + strlen (print_tb_buf),
"* %d * %3ld(%2d) * %3ld(%2d) * %3ld(%2d) * %5ld * %5ld * %5ld * %5ld * %5ld *\n", "* %d * %3lld(%2d) * %3lld(%2d) * %3lld(%2d) * %5lld * %5lld * %5lld * %5lld * %5lld *\n",
h, h,
(tbSh) ? (tbSh->b_blocknr):(-1), (tbSh) ? (long long)(tbSh->b_blocknr):(-1LL),
(tbSh) ? atomic_read (&(tbSh->b_count)) : -1, (tbSh) ? atomic_read (&(tbSh->b_count)) : -1,
(tb->L[h]) ? (tb->L[h]->b_blocknr):(-1), (tb->L[h]) ? (long long)(tb->L[h]->b_blocknr):(-1LL),
(tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1, (tb->L[h]) ? atomic_read (&(tb->L[h]->b_count)) : -1,
(tb->R[h]) ? (tb->R[h]->b_blocknr):(-1), (tb->R[h]) ? (long long)(tb->R[h]->b_blocknr):(-1LL),
(tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -1, (tb->R[h]) ? atomic_read (&(tb->R[h]->b_count)) : -1,
(tbFh) ? (tbFh->b_blocknr):(-1), (tbFh) ? (long long)(tbFh->b_blocknr):(-1LL),
(tb->FL[h]) ? (tb->FL[h]->b_blocknr):(-1), (tb->FL[h]) ? (long long)(tb->FL[h]->b_blocknr):(-1LL),
(tb->FR[h]) ? (tb->FR[h]->b_blocknr):(-1), (tb->FR[h]) ? (long long)(tb->FR[h]->b_blocknr):(-1LL),
(tb->CFL[h]) ? (tb->CFL[h]->b_blocknr):(-1), (tb->CFL[h]) ? (long long)(tb->CFL[h]->b_blocknr):(-1LL),
(tb->CFR[h]) ? (tb->CFR[h]->b_blocknr):(-1)); (tb->CFR[h]) ? (long long)(tb->CFR[h]->b_blocknr):(-1LL));
} }
sprintf (print_tb_buf + strlen (print_tb_buf), sprintf (print_tb_buf + strlen (print_tb_buf),
...@@ -647,7 +647,7 @@ void store_print_tb (struct tree_balance * tb) ...@@ -647,7 +647,7 @@ void store_print_tb (struct tree_balance * tb)
h = 0; h = 0;
for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++) for (i = 0; i < sizeof (tb->FEB) / sizeof (tb->FEB[0]); i ++)
sprintf (print_tb_buf + strlen (print_tb_buf), sprintf (print_tb_buf + strlen (print_tb_buf),
"%p (%lu %d)%s", tb->FEB[i], tb->FEB[i] ? tb->FEB[i]->b_blocknr : 0, "%p (%llu %d)%s", tb->FEB[i], tb->FEB[i] ? (unsigned long long)tb->FEB[i]->b_blocknr : 0ULL,
tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0, tb->FEB[i] ? atomic_read (&(tb->FEB[i]->b_count)) : 0,
(i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", "); (i == sizeof (tb->FEB) / sizeof (tb->FEB[0]) - 1) ? "\n" : ", ");
......
...@@ -916,8 +916,8 @@ static int read_super_block (struct super_block * s, int offset) ...@@ -916,8 +916,8 @@ static int read_super_block (struct super_block * s, int offset)
rs = (struct reiserfs_super_block *)bh->b_data; rs = (struct reiserfs_super_block *)bh->b_data;
if (sb_blocksize(rs) != s->s_blocksize) { if (sb_blocksize(rs) != s->s_blocksize) {
printk ("sh-2011: read_super_block: " printk ("sh-2011: read_super_block: "
"can't find a reiserfs filesystem on (dev %s, block %lu, size %lu)\n", "can't find a reiserfs filesystem on (dev %s, block %Lu, size %lu)\n",
reiserfs_bdevname (s), bh->b_blocknr, s->s_blocksize); reiserfs_bdevname (s), (unsigned long long)bh->b_blocknr, s->s_blocksize);
brelse (bh); brelse (bh);
return 1; return 1;
} }
...@@ -980,8 +980,8 @@ static int reread_meta_blocks(struct super_block *s) { ...@@ -980,8 +980,8 @@ static int reread_meta_blocks(struct super_block *s) {
ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh)) ; ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh)) ;
wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ; wait_on_buffer(SB_AP_BITMAP(s)[i].bh) ;
if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) { if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) {
printk("reread_meta_blocks, error reading bitmap block number %d at printk("reread_meta_blocks, error reading bitmap block number %d at %llu\n",
%ld\n", i, SB_AP_BITMAP(s)[i].bh->b_blocknr) ; i, (unsigned long long)SB_AP_BITMAP(s)[i].bh->b_blocknr) ;
return 1 ; return 1 ;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment