* [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2]
@ 2005-01-11 18:47 Tony Battersby
2005-01-13 19:45 ` Dave Kleikamp
0 siblings, 1 reply; 2+ messages in thread
From: Tony Battersby @ 2005-01-11 18:47 UTC (permalink / raw)
To: linux-fsdevel
This patch fixes some LBD problems in the core Linux filesystem code.
I will send another message that has fixes for various filesystems.
(For review, enabling LBD [large block device support] changes sector_t
to a 64-bit quantity on i386 to support disks >= 2 TB. All sector
numbers should be of type sector_t rather than long or unsigned long,
which are only 32-bit on i386. One must also be careful to typecast
long or int values to a 64-bit value before shifting left to avoid
losing bits.)
I haven't tested these changes at all, so please review and comment.
Anthony J. Battersby
Cybernetics
diff -urpN linux-2.6.10/fs/buffer.c linux-2.6.10-lbd-fix/fs/buffer.c
--- linux-2.6.10/fs/buffer.c Fri Dec 24 16:34:58 2004
+++ linux-2.6.10-lbd-fix/fs/buffer.c Wed Dec 29 10:30:31 2004
@@ -1754,7 +1754,7 @@ static int __block_write_full_page(struc
* handle that here by just cleaning them.
*/
- block = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ block = (sector_t) page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
head = page_buffers(page);
bh = head;
@@ -2536,7 +2536,7 @@ int block_truncate_page(struct address_s
pgoff_t index = from >> PAGE_CACHE_SHIFT;
unsigned offset = from & (PAGE_CACHE_SIZE-1);
unsigned blocksize;
- pgoff_t iblock;
+ sector_t iblock;
unsigned length, pos;
struct inode *inode = mapping->host;
struct page *page;
@@ -2552,7 +2552,7 @@ int block_truncate_page(struct address_s
return 0;
length = blocksize - length;
- iblock = index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ iblock = (sector_t) index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
page = grab_cache_page(mapping, index);
err = -ENOMEM;
diff -urpN linux-2.6.10/fs/mpage.c linux-2.6.10-lbd-fix/fs/mpage.c
--- linux-2.6.10/fs/mpage.c Fri Dec 24 16:34:26 2004
+++ linux-2.6.10-lbd-fix/fs/mpage.c Wed Dec 29 09:20:34 2004
@@ -226,7 +226,7 @@ do_mpage_readpage(struct bio *bio, struc
if (page_has_buffers(page))
goto confused;
- block_in_file = page->index << (PAGE_CACHE_SHIFT - blkbits);
+ block_in_file = (sector_t) page->index << (PAGE_CACHE_SHIFT - blkbits);
last_block = (i_size_read(inode) + blocksize - 1) >> blkbits;
bh.b_page = page;
@@ -461,7 +461,7 @@ mpage_writepage(struct bio *bio, struct
* The page has no buffers: map it to disk
*/
BUG_ON(!PageUptodate(page));
- block_in_file = page->index << (PAGE_CACHE_SHIFT - blkbits);
+ block_in_file = (sector_t) page->index << (PAGE_CACHE_SHIFT - blkbits);
last_block = (i_size - 1) >> blkbits;
map_bh.b_page = page;
for (page_block = 0; page_block < blocks_per_page; ) {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2]
2005-01-11 18:47 [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2] Tony Battersby
@ 2005-01-13 19:45 ` Dave Kleikamp
0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2005-01-13 19:45 UTC (permalink / raw)
To: tonyb; +Cc: fsdevel
On Tue, 2005-01-11 at 13:47 -0500, Tony Battersby wrote:
> This patch fixes some LBD problems in the core Linux filesystem code.
> I will send another message that has fixes for various filesystems.
>
> (For review, enabling LBD [large block device support] changes sector_t
> to a 64-bit quantity on i386 to support disks >= 2 TB. All sector
> numbers should be of type sector_t rather than long or unsigned long,
> which are only 32-bit on i386. One must also be careful to typecast
> long or int values to a 64-bit value before shifting left to avoid
> losing bits.)
>
> I haven't tested these changes at all, so please review and comment.
>
> Anthony J. Battersby
> Cybernetics
This patch should fix up jfs. It's probably not really necessary, since
jfs only support a 4K block size, and we're still limited by a 32-bit
page->index. However, jfs uses long longs in most of the code, so it
doesn't hurt to fix the few places where we're inconsistent.
It compiles cleanly. That's the extent that it's tested.
diff -urp linux-2.6.11-rc1/fs/jfs/jfs_metapage.c linux/fs/jfs/jfs_metapage.c
--- linux-2.6.11-rc1/fs/jfs/jfs_metapage.c 2005-01-13 13:14:42.242336808 -0600
+++ linux/fs/jfs/jfs_metapage.c 2005-01-13 13:31:26.039736408 -0600
@@ -162,7 +162,7 @@ void metapage_exit(void)
* Basically same hash as in pagemap.h, but using our hash table
*/
static struct metapage **meta_hash(struct address_space *mapping,
- unsigned long index)
+ sector_t index)
{
#define i (((unsigned long)mapping)/ \
(sizeof(struct inode) & ~(sizeof(struct inode) -1 )))
@@ -174,7 +174,7 @@ static struct metapage **meta_hash(struc
static struct metapage *search_hash(struct metapage ** hash_ptr,
struct address_space *mapping,
- unsigned long index)
+ sector_t index)
{
struct metapage *ptr;
@@ -209,7 +209,7 @@ static void remove_from_hash(struct meta
mp->hash_next->hash_prev = mp->hash_prev;
}
-struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,
+struct metapage *__get_metapage(struct inode *inode, sector_t lblock,
unsigned int size, int absolute,
unsigned long new)
{
@@ -218,10 +218,11 @@ struct metapage *__get_metapage(struct i
int l2bsize;
struct address_space *mapping;
struct metapage *mp;
- unsigned long page_index;
+ sector_t page_index;
unsigned long page_offset;
- jfs_info("__get_metapage: inode = 0x%p, lblock = 0x%lx", inode, lblock);
+ jfs_info("__get_metapage: inode = 0x%p, lblock = 0x%llx", inode,
+ (unsigned long long)lblock);
if (absolute)
mapping = inode->i_sb->s_bdev->bd_inode->i_mapping;
@@ -390,7 +391,7 @@ static void __write_metapage(struct meta
{
int l2bsize = mp->mapping->host->i_blkbits;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize;
- unsigned long page_index;
+ sector_t page_index;
unsigned long page_offset;
int rc;
@@ -513,7 +514,7 @@ void release_metapage(struct metapage *
void __invalidate_metapages(struct inode *ip, s64 addr, int len)
{
struct metapage **hash_ptr;
- unsigned long lblock;
+ sector_t lblock;
int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_blkbits;
/* All callers are interested in block device's mapping */
struct address_space *mapping = ip->i_sb->s_bdev->bd_inode->i_mapping;
diff -urp linux-2.6.11-rc1/fs/jfs/jfs_metapage.h linux/fs/jfs/jfs_metapage.h
--- linux-2.6.11-rc1/fs/jfs/jfs_metapage.h 2005-01-13 13:14:42.243336656 -0600
+++ linux/fs/jfs/jfs_metapage.h 2005-01-13 13:19:45.826185048 -0600
@@ -43,7 +43,7 @@ struct metapage {
* add the metapage to the hash before we have the real page
*/
struct address_space *mapping;
- unsigned long index;
+ sector_t index;
wait_queue_head_t wait;
/* implementation */
@@ -70,7 +70,7 @@ struct metapage {
/* function prototypes */
extern struct metapage *__get_metapage(struct inode *inode,
- unsigned long lblock, unsigned int size,
+ sector_t lblock, unsigned int size,
int absolute, unsigned long new);
#define read_metapage(inode, lblock, size, absolute)\
--
David Kleikamp
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-01-13 19:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-11 18:47 [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2] Tony Battersby
2005-01-13 19:45 ` Dave Kleikamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).