From: Suparna Bhattacharya <suparna@in.ibm.com>
To: bcrl@redhat.com, akpm@digeo.com
Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 7/7] Filesystem AIO rdwr: async get block for ext2
Date: Thu, 24 Apr 2003 10:58:05 +0530 [thread overview]
Message-ID: <20030424105805.G2288@in.ibm.com> (raw)
In-Reply-To: <20030424102221.A2166@in.ibm.com>; from suparna@in.ibm.com on Thu, Apr 24, 2003 at 10:22:22AM +0530
On Thu, Apr 24, 2003 at 10:22:22AM +0530, Suparna Bhattacharya wrote:
> Here is a revised version of the filesystem AIO patches
> for 2.5.68.
>
> 07ext2getblk_wq.patch : Async get block support for
> the ext2 filesystem
ext2_get_block_wq() is used only by ext2_prepare_write().
All other cases still use the synchronous get block
version.
Regards
Suparna
--
Suparna Bhattacharya (suparna@in.ibm.com)
Linux Technology Center
IBM Software Labs, India
07ext2getblk_wq.patch
.....................
fs/ext2/inode.c | 44 +++++++++++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 9 deletions(-)
diff -ur -X /home/kiran/dontdiff linux-2.5.68/fs/ext2/inode.c linux-aio-2568/fs/ext2/inode.c
--- linux-2.5.68/fs/ext2/inode.c Fri Apr 11 21:10:49 2003
+++ linux-aio-2568/fs/ext2/inode.c Wed Apr 16 22:48:49 2003
@@ -257,11 +258,12 @@
* or when it reads all @depth-1 indirect blocks successfully and finds
* the whole chain, all way to the data (returns %NULL, *err == 0).
*/
-static Indirect *ext2_get_branch(struct inode *inode,
+static Indirect *ext2_get_branch_wq(struct inode *inode,
int depth,
int *offsets,
Indirect chain[4],
- int *err)
+ int *err,
+ wait_queue_t *wait)
{
struct super_block *sb = inode->i_sb;
Indirect *p = chain;
@@ -273,8 +275,8 @@
if (!p->key)
goto no_block;
while (--depth) {
- bh = sb_bread(sb, le32_to_cpu(p->key));
- if (!bh)
+ bh = sb_bread_wq(sb, le32_to_cpu(p->key), wait);
+ if (!bh || IS_ERR(bh))
goto failure;
read_lock(&EXT2_I(inode)->i_meta_lock);
if (!verify_chain(chain, p))
@@ -292,11 +294,21 @@
*err = -EAGAIN;
goto no_block;
failure:
- *err = -EIO;
+ *err = IS_ERR(bh) ? PTR_ERR(bh) : -EIO;
no_block:
return p;
}
+static Indirect *ext2_get_branch(struct inode *inode,
+ int depth,
+ int *offsets,
+ Indirect chain[4],
+ int *err)
+{
+ return ext2_get_branch_wq(inode, depth, offsets, chain,
+ err, NULL);
+}
+
/**
* ext2_find_near - find a place for allocation with sufficient locality
* @inode: owner
@@ -536,7 +548,8 @@
* reachable from inode.
*/
-static int ext2_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
+static int ext2_get_block_wq(struct inode *inode, sector_t iblock,
+ struct buffer_head *bh_result, int create, wait_queue_t *wait)
{
int err = -EIO;
int offsets[4];
@@ -551,7 +564,8 @@
goto out;
reread:
- partial = ext2_get_branch(inode, depth, offsets, chain, &err);
+ partial = ext2_get_branch_wq(inode, depth, offsets, chain, &err,
+ wait);
/* Simplest case - block found, no allocation needed */
if (!partial) {
@@ -565,7 +579,7 @@
}
/* Next simple case - plain lookup or failed read of indirect block */
- if (!create || err == -EIO) {
+ if (!create || err == -EIO || err == -EIOCBRETRY) {
cleanup:
while (partial > chain) {
brelse(partial->bh);
@@ -606,6 +620,19 @@
goto reread;
}
+static int ext2_get_block_async(struct inode *inode, sector_t iblock,
+ struct buffer_head *bh_result, int create)
+{
+ return ext2_get_block_wq(inode, iblock, bh_result, create,
+ current->io_wait);
+}
+
+static int ext2_get_block(struct inode *inode, sector_t iblock,
+ struct buffer_head *bh_result, int create)
+{
+ return ext2_get_block_wq(inode, iblock, bh_result, create, NULL);
+}
+
static int ext2_writepage(struct page *page, struct writeback_control *wbc)
{
return block_write_full_page(page, ext2_get_block, wbc);
@@ -627,7 +654,7 @@
ext2_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
- return block_prepare_write(page,from,to,ext2_get_block);
+ return block_prepare_write(page,from,to,ext2_get_block_async);
}
static int
next prev parent reply other threads:[~2003-04-24 5:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-24 4:52 Filesystem AIO read-write patches Suparna Bhattacharya
2003-04-24 4:52 ` Suparna Bhattacharya
2003-04-24 5:00 ` [PATCH 1/7] Filesystem AIO rdwr - aio retry core changes Suparna Bhattacharya
2003-04-24 5:00 ` Suparna Bhattacharya
2003-04-24 5:04 ` [PATCH 2/7] Filesystem AIO rdwr - aio read Suparna Bhattacharya
2003-04-24 5:04 ` Suparna Bhattacharya
2003-04-24 5:11 ` Filesystem AIO read-write patches Suparna Bhattacharya
2003-04-24 5:11 ` Suparna Bhattacharya
2003-04-24 12:48 ` Matthew Wilcox
2003-04-24 12:48 ` Matthew Wilcox
2003-04-24 5:16 ` [PATCH 4/7] Filesystem AIO rdwr - async down (x86) Suparna Bhattacharya
2003-04-24 5:16 ` Suparna Bhattacharya
2003-04-24 5:19 ` [5/7] Filesystem AIO rdwr - use down_wq for aio write Suparna Bhattacharya
2003-04-24 5:19 ` Suparna Bhattacharya
2003-04-24 5:21 ` [PATCH 6/7] Filesystem AIO rdwr - async bread Suparna Bhattacharya
2003-04-24 5:21 ` Suparna Bhattacharya
2003-04-24 5:28 ` Suparna Bhattacharya [this message]
2003-04-24 13:13 ` Filesystem AIO read-write patches Benjamin LaHaise
2003-04-24 14:27 ` Suparna Bhattacharya
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=20030424105805.G2288@in.ibm.com \
--to=suparna@in.ibm.com \
--cc=akpm@digeo.com \
--cc=bcrl@redhat.com \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.