From: Chris Mason <mason@suse.com>
To: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: [PATCH] reading the last block on a bdev
Date: Tue, 09 Mar 2004 16:19:49 -0500 [thread overview]
Message-ID: <1078867189.25064.1449.camel@watt.suse.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Hello everyone,
This patch fixes a problem we're hitting on ia64 with page sizes > 4k.
When the page size is greater than the block size, and parts of the page
fall past the end of the device, readpage will fail because
blkdev_get_block returns -EIO for blocks past i_size.
The attached patch changes blkdev_get_block to return holes when reading
past the end of the device, which allows us to read that last valid 4k
block and then fill the rest of the page with zeros. Writes will still
fail with -EIO.
-chris
[-- Attachment #2: blkdev_get_block-partial --]
[-- Type: text/x-patch, Size: 801 bytes --]
Index: linux.t/fs/block_dev.c
===================================================================
--- linux.t.orig/fs/block_dev.c 2004-03-08 09:56:06.000000000 -0500
+++ linux.t/fs/block_dev.c 2004-03-09 09:48:15.000000000 -0500
@@ -116,9 +116,18 @@ static int
blkdev_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh, int create)
{
- if (iblock >= max_block(I_BDEV(inode)))
- return -EIO;
-
+ if (iblock >= max_block(I_BDEV(inode))) {
+ if (create)
+ return -EIO;
+
+ /*
+ * for reads, we're just trying to fill a partial page.
+ * return a hole, they will have to call get_block again
+ * before they can fill it, and they will get -EIO at that
+ * time
+ */
+ return 0;
+ }
bh->b_bdev = I_BDEV(inode);
bh->b_blocknr = iblock;
set_buffer_mapped(bh);
reply other threads:[~2004-03-09 21:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1078867189.25064.1449.camel@watt.suse.com \
--to=mason@suse.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®