Commit 763fb9a3 authored by Andrew Morton's avatar Andrew Morton Committed by Patrick Mochel

[PATCH] 64-bit sector_t - filesystems

From Peter Chubb

Filesystem migration to possibly 64-bit sector_t:
 - bmap() now takes and returns a sector_t to allow filesystems
   (e.g., JFS, XFS) that are 64-bit clean to deal with large files
 - buffer handling now 64-bit clean

Enable 64-bit sector_t on IA32 and PPC.

kiobufs takes sector_t array, not array of long.
Fix blkmtd.c to deal in such an array.

Miscellaneous fixes for 64-bit sector_t.
 	 - missed printk formats
	 - ide_floppy_do_request had incorrect signature
	 - in blkmtd.c there was a pointer used to
	   manipulate an array to be used by kiobuf --
 	   it was unsigned long, needed to be sector_t
parent 6179fd18
......@@ -258,3 +258,7 @@ CONFIG_BLK_CPQ_DA
supported by this driver, and for further information on the use of
this driver.
CONFIG_LBD
Say Y here if you want to attach large (bigger than 2TB) discs to
your machine, or if you want to have a raid or loopback device
bigger than 2TB. Otherwise say N.
......@@ -48,4 +48,7 @@ if [ "$CONFIG_BLK_DEV_RAM" = "y" -o "$CONFIG_BLK_DEV_RAM" = "m" ]; then
fi
dep_bool ' Initial RAM disk (initrd) support' CONFIG_BLK_DEV_INITRD $CONFIG_BLK_DEV_RAM
if [ "$CONFIG_X86" = "y" -o "$CONFIG_PPC32" = "y" ]; then
bool 'Support for Large Block Devices' CONFIG_LBD
fi
endmenu
......@@ -685,7 +685,8 @@ static int pf_identify(struct pf_unit *pf)
else {
if (pf->media_status == PF_RO)
printk(", RO");
printk(", %ld blocks\n", get_capacity(pf->disk));
printk(", %llu blocks\n",
(unsigned long long)get_capacity(pf->disk));
}
return 0;
}
......
......@@ -1241,17 +1241,18 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t
/*
* idefloppy_do_request is our request handling function.
*/
static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, unsigned long block)
static ide_startstop_t idefloppy_do_request (ide_drive_t *drive, struct request *rq, sector_t block_s)
{
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_pc_t *pc;
unsigned long block = (unsigned long)block_s;
#if IDEFLOPPY_DEBUG_LOG
printk(KERN_INFO "rq_status: %d, rq_dev: %u, flags: %lx, errors: %d\n",
rq->rq_status, (unsigned int) rq->rq_dev,
rq->flags, rq->errors);
printk(KERN_INFO "sector: %ld, nr_sectors: %ld, "
"current_nr_sectors: %ld\n", rq->sector,
"current_nr_sectors: %ld\n", (long)rq->sector,
rq->nr_sectors, rq->current_nr_sectors);
#endif /* IDEFLOPPY_DEBUG_LOG */
......
......@@ -164,7 +164,7 @@ static int blkmtd_readpage(mtd_raw_dev_data_t *rawdevice, struct page *page)
int err;
int sectornr, sectors, i;
struct kiobuf *iobuf;
unsigned long *blocks;
sector_t *blocks;
if(!rawdevice) {
printk("blkmtd: readpage: PANIC file->private_data == NULL\n");
......@@ -223,7 +223,7 @@ static int blkmtd_readpage(mtd_raw_dev_data_t *rawdevice, struct page *page)
/* Pre 2.4.4 doesn't have space for the block list in the kiobuf */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)
blocks = kmalloc(KIO_MAX_SECTORS * sizeof(unsigned long));
blocks = kmalloc(KIO_MAX_SECTORS * sizeof(*blocks));
if(blocks == NULL) {
printk("blkmtd: cant allocate iobuf blocks\n");
free_kiovec(1, &iobuf);
......@@ -298,7 +298,7 @@ static int write_queue_task(void *data)
int err;
struct task_struct *tsk = current;
struct kiobuf *iobuf;
unsigned long *blocks;
sector_t *blocks;
DECLARE_WAITQUEUE(wait, tsk);
DEBUG(1, "blkmtd: writetask: starting (pid = %d)\n", tsk->pid);
......
......@@ -67,7 +67,7 @@ static int adfs_prepare_write(struct file *file, struct page *page, unsigned int
&ADFS_I(page->mapping->host)->mmu_private);
}
static int _adfs_bmap(struct address_space *mapping, long block)
static sector_t _adfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, adfs_get_block);
}
......
......@@ -338,10 +338,11 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
struct buffer_head *ext_bh;
u32 ext;
pr_debug("AFFS: get_block(%u, %ld)\n", (u32)inode->i_ino, block);
pr_debug("AFFS: get_block(%u, %lu)\n", (u32)inode->i_ino, (unsigned long)block);
if (block < 0)
goto err_small;
if (block > (sector_t)0x7fffffffUL)
BUG();
if (block >= AFFS_I(inode)->i_blkcnt) {
if (block > AFFS_I(inode)->i_blkcnt || !create)
......@@ -352,12 +353,12 @@ affs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh_resul
//lock cache
affs_lock_ext(inode);
ext = block / AFFS_SB(sb)->s_hashsize;
ext = (u32)block / AFFS_SB(sb)->s_hashsize;
block -= ext * AFFS_SB(sb)->s_hashsize;
ext_bh = affs_get_extblock(inode, ext);
if (IS_ERR(ext_bh))
goto err_ext;
map_bh(bh_result, sb, be32_to_cpu(AFFS_BLOCK(sb, ext_bh, block)));
map_bh(bh_result, sb, (sector_t)be32_to_cpu(AFFS_BLOCK(sb, ext_bh, block)));
if (create) {
u32 blocknr = affs_alloc_block(inode, ext_bh->b_blocknr);
......@@ -422,7 +423,7 @@ static int affs_prepare_write(struct file *file, struct page *page, unsigned fro
return cont_prepare_write(page, from, to, affs_get_block,
&AFFS_I(page->mapping->host)->mmu_private);
}
static int _affs_bmap(struct address_space *mapping, long block)
static sector_t _affs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,affs_get_block);
}
......
......@@ -416,7 +416,7 @@ affs_add_entry(struct inode *dir, struct inode *inode, struct dentry *dentry, s3
}
affs_fix_checksum(sb, bh);
mark_buffer_dirty_inode(bh, inode);
dentry->d_fsdata = (void *)bh->b_blocknr;
dentry->d_fsdata = (void *)(long)bh->b_blocknr;
affs_lock_dir(dir);
retval = affs_insert_hash(dir, bh);
......
......@@ -145,7 +145,7 @@ static int bfs_prepare_write(struct file *file, struct page *page, unsigned from
return block_prepare_write(page, from, to, bfs_get_block);
}
static int bfs_bmap(struct address_space *mapping, long block)
static sector_t bfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, bfs_get_block);
}
......
......@@ -1776,7 +1776,7 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
unsigned from, unsigned to, get_block_t *get_block)
{
unsigned block_start, block_end;
unsigned long block;
sector_t block;
int err = 0;
unsigned blocksize, bbits;
struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
......@@ -1792,7 +1792,7 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
head = page_buffers(page);
bbits = inode->i_blkbits;
block = page->index << (PAGE_CACHE_SHIFT - bbits);
block = (sector_t)page->index << (PAGE_CACHE_SHIFT - bbits);
for(bh = head, block_start = 0; bh != head || !block_start;
block++, block_start=block_end, bh = bh->b_this_page) {
......@@ -1933,7 +1933,7 @@ static int __block_commit_write(struct inode *inode, struct page *page,
int block_read_full_page(struct page *page, get_block_t *get_block)
{
struct inode *inode = page->mapping->host;
unsigned long iblock, lblock;
sector_t iblock, lblock;
struct buffer_head *bh, *head, *arr[MAX_BUF_PER_PAGE];
unsigned int blocksize, blocks;
int nr, i;
......@@ -1948,7 +1948,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
head = page_buffers(page);
blocks = PAGE_CACHE_SIZE >> inode->i_blkbits;
iblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
iblock = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
lblock = (inode->i_size+blocksize-1) >> inode->i_blkbits;
bh = head;
nr = 0;
......
......@@ -19,7 +19,7 @@ static int efs_readpage(struct file *file, struct page *page)
{
return block_read_full_page(page,efs_get_block);
}
static int _efs_bmap(struct address_space *mapping, long block)
static sector_t _efs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,efs_get_block);
}
......
......@@ -601,7 +601,7 @@ ext2_prepare_write(struct file *file, struct page *page,
return block_prepare_write(page,from,to,ext2_get_block);
}
static int ext2_bmap(struct address_space *mapping, long block)
static sector_t ext2_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,ext2_get_block);
}
......
......@@ -479,7 +479,7 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino)
!(inode = iget(sb, ino)) || is_bad_inode(inode) ||
NEXT_ORPHAN(inode) > max_ino) {
ext3_warning(sb, __FUNCTION__,
"bad orphan inode %lu! e2fsck was run?\n", ino);
"bad orphan inode %lu! e2fsck was run?\n", (unsigned long)ino);
printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n",
bit,
(unsigned long long)bitmap_bh->b_blocknr,
......
......@@ -1181,7 +1181,7 @@ static int ext3_commit_write(struct file *file, struct page *page,
* So, if we see any bmap calls here on a modified, data-journaled file,
* take extra steps to flush any blocks which might be in the cache.
*/
static int ext3_bmap(struct address_space *mapping, long block)
static sector_t ext3_bmap(struct address_space *mapping, sector_t block)
{
struct inode *inode = mapping->host;
journal_t *journal;
......
......@@ -59,7 +59,7 @@ int fat_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_r
BUG();
return -EIO;
}
if (!(iblock % MSDOS_SB(sb)->cluster_size)) {
if (!((unsigned long)iblock % MSDOS_SB(sb)->cluster_size)) {
int error;
error = fat_add_cluster(inode);
......
......@@ -998,7 +998,7 @@ fat_commit_write(struct file *file, struct page *page,
return generic_commit_write(file, page, from, to);
}
static int _fat_bmap(struct address_space *mapping, long block)
static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,fat_get_block);
}
......
......@@ -43,7 +43,7 @@
static int vxfs_readpage(struct file *, struct page *);
static int vxfs_bmap(struct address_space *, long);
static sector_t vxfs_bmap(struct address_space *, sector_t);
struct address_space_operations vxfs_aops = {
.readpage = vxfs_readpage,
......@@ -186,8 +186,8 @@ vxfs_readpage(struct file *file, struct page *page)
* Locking status:
* We are under the bkl.
*/
static int
vxfs_bmap(struct address_space *mapping, long block)
static sector_t
vxfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, vxfs_getblk);
}
......@@ -242,7 +242,7 @@ static int hfs_prepare_write(struct file *file, struct page *page, unsigned from
return cont_prepare_write(page,from,to,hfs_get_block,
&HFS_I(page->mapping->host)->mmu_private);
}
static int hfs_bmap(struct address_space *mapping, long block)
static sector_t hfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,hfs_get_block);
}
......
......@@ -111,7 +111,7 @@ static int hpfs_prepare_write(struct file *file, struct page *page, unsigned fro
return cont_prepare_write(page,from,to,hpfs_get_block,
&hpfs_i(page->mapping->host)->mmu_private);
}
static int _hpfs_bmap(struct address_space *mapping, long block)
static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,hpfs_get_block);
}
......
......@@ -907,9 +907,9 @@ void iput(struct inode *inode)
* file.
*/
int bmap(struct inode * inode, int block)
sector_t bmap(struct inode * inode, sector_t block)
{
int res = 0;
sector_t res = 0;
if (inode->i_mapping->a_ops->bmap)
res = inode->i_mapping->a_ops->bmap(inode->i_mapping, block);
return res;
......
......@@ -1045,9 +1045,9 @@ static int isofs_bmap(struct inode *inode, int block)
return 0;
}
struct buffer_head *isofs_bread(struct inode *inode, unsigned int block)
struct buffer_head *isofs_bread(struct inode *inode, sector_t block)
{
unsigned int blknr = isofs_bmap(inode, block);
sector_t blknr = isofs_bmap(inode, block);
if (!blknr)
return NULL;
return sb_bread(inode->i_sb, blknr);
......@@ -1058,7 +1058,7 @@ static int isofs_readpage(struct file *file, struct page *page)
return block_read_full_page(page,isofs_get_block);
}
static int _isofs_bmap(struct address_space *mapping, long block)
static sector_t _isofs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,isofs_get_block);
}
......
......@@ -305,7 +305,7 @@ static int jfs_prepare_write(struct file *file,
return block_prepare_write(page, from, to, jfs_get_block);
}
static int jfs_bmap(struct address_space *mapping, long block)
static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping, block, jfs_get_block);
}
......
......@@ -328,7 +328,7 @@ static int minix_prepare_write(struct file *file, struct page *page, unsigned fr
{
return block_prepare_write(page,from,to,minix_get_block);
}
static int minix_bmap(struct address_space *mapping, long block)
static sector_t minix_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,minix_get_block);
}
......
......@@ -444,7 +444,7 @@ static int qnx4_prepare_write(struct file *file, struct page *page,
return cont_prepare_write(page, from, to, qnx4_get_block,
&qnx4_inode->mmu_private);
}
static int qnx4_bmap(struct address_space *mapping, long block)
static sector_t qnx4_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,qnx4_get_block);
}
......
......@@ -2029,7 +2029,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
}
static int reiserfs_aop_bmap(struct address_space *as, long block) {
static sector_t reiserfs_aop_bmap(struct address_space *as, sector_t block) {
return generic_block_bmap(as, block, reiserfs_bmap) ;
}
......
......@@ -459,7 +459,7 @@ static int sysv_prepare_write(struct file *file, struct page *page, unsigned fro
{
return block_prepare_write(page,from,to,get_block);
}
static int sysv_bmap(struct address_space *mapping, long block)
static sector_t sysv_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,get_block);
}
......
......@@ -146,7 +146,7 @@ static int udf_prepare_write(struct file *file, struct page *page, unsigned from
return block_prepare_write(page, from, to, udf_get_block);
}
static int udf_bmap(struct address_space *mapping, long block)
static sector_t udf_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,udf_get_block);
}
......
......@@ -457,7 +457,7 @@ static int ufs_prepare_write(struct file *file, struct page *page, unsigned from
{
return block_prepare_write(page,from,to,ufs_getfrag_block);
}
static int ufs_bmap(struct address_space *mapping, long block)
static sector_t ufs_bmap(struct address_space *mapping, sector_t block)
{
return generic_block_bmap(mapping,block,ufs_getfrag_block);
}
......
......@@ -692,10 +692,11 @@ linvfs_direct_IO(
linvfs_get_blocks_direct);
}
STATIC int
STATIC sector_t
linvfs_bmap(
struct address_space *mapping,
long block)
sector_t block)
{
struct inode *inode = (struct inode *)mapping->host;
vnode_t *vp = LINVFS_GET_VP(inode);
......
......@@ -52,6 +52,11 @@ typedef u32 dma_addr_t;
#endif
typedef u64 dma64_addr_t;
#ifdef CONFIG_LBD
typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
#endif /* __KERNEL__ */
#endif
......@@ -45,6 +45,11 @@ typedef __vector128 vector128;
typedef u32 dma_addr_t;
typedef u64 dma64_addr_t;
#ifdef CONFIG_LBD
typedef u64 sector_t;
#define HAVE_SECTOR_T
#endif
#endif /* __KERNEL__ */
/*
......
......@@ -305,7 +305,7 @@ struct address_space_operations {
int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
/* Unfortunately this kludge is needed for FIBMAP. Don't use it */
int (*bmap)(struct address_space *, long);
sector_t (*bmap)(struct address_space *, sector_t);
int (*invalidatepage) (struct page *, unsigned long);
int (*releasepage) (struct page *, int);
int (*direct_IO)(int, struct file *, const struct iovec *iov,
......@@ -356,7 +356,7 @@ struct block_device {
int bd_holders;
struct block_device * bd_contains;
unsigned bd_block_size;
unsigned long bd_offset;
sector_t bd_offset;
unsigned bd_part_count;
int bd_invalidated;
};
......@@ -1141,7 +1141,7 @@ extern void write_inode_now(struct inode *, int);
extern int filemap_fdatawrite(struct address_space *);
extern int filemap_fdatawait(struct address_space *);
extern void sync_supers(void);
extern int bmap(struct inode *, int);
extern sector_t bmap(struct inode *, sector_t);
extern int notify_change(struct dentry *, struct iattr *);
extern int permission(struct inode *, int);
extern int vfs_permission(struct inode *, int);
......
......@@ -230,7 +230,7 @@ int get_joliet_filename(struct iso_directory_record *, unsigned char *, struct i
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 *, unsigned int);
extern struct buffer_head *isofs_bread(struct inode *, sector_t);
extern int isofs_get_blocks(struct inode *, sector_t, struct buffer_head **, unsigned long);
extern struct inode_operations isofs_dir_inode_operations;
......
......@@ -117,13 +117,11 @@ typedef __s64 int64_t;
#endif
/*
* transition to 64-bit sector_t, possibly making it an option...
* The type used for indexing onto a disc or disc partition.
* If required, asm/types.h can override it and define
* HAVE_SECTOR_T
*/
#undef BLK_64BIT_SECTOR
#ifdef BLK_64BIT_SECTOR
typedef u64 sector_t;
#else
#ifndef HAVE_SECTOR_T
typedef unsigned long sector_t;
#endif
......
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