linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tony Battersby" <tonyb@cybernetics.com>
To: <linux-fsdevel@vger.kernel.org>
Subject: [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2]
Date: Tue, 11 Jan 2005 13:47:31 -0500	[thread overview]
Message-ID: <05Jan11.134758est.332232@cyborg.cybernetics.com> (raw)

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; ) {


             reply	other threads:[~2005-01-11 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-11 18:47 Tony Battersby [this message]
2005-01-13 19:45 ` [PATCH] [RFC] LBD fixes for Linux 2.6.10 [1/2] Dave Kleikamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05Jan11.134758est.332232@cyborg.cybernetics.com \
    --to=tonyb@cybernetics.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).