* [PATCH] ext4: retry failed direct IO allocations
@ 2009-10-02 22:39 Eric Sandeen
2009-10-03 2:04 ` Theodore Tso
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2009-10-02 22:39 UTC (permalink / raw)
To: ext4 development
On a 256M filesystem, doing this in a loop:
xfs_io -F -f -d -c 'pwrite 0 64m' test
rm -f test
eventually leads to ENOSPC. (the xfs_io command does a
64m direct IO write to the file "test")
As with other block allocation callers, it looks like we need to
potentially retry the allocations on the initial ENOSPC.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 4abd683..098c466 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3291,6 +3291,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
ssize_t ret;
int orphan = 0;
size_t count = iov_length(iov, nr_segs);
+ int retries = 0;
if (rw == WRITE) {
loff_t final_size = offset + count;
@@ -3313,9 +3314,12 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
}
}
+retry:
ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
offset, nr_segs,
ext4_get_block, NULL);
+ if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+ goto retry;
if (orphan) {
int err;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: retry failed direct IO allocations
2009-10-02 22:39 [PATCH] ext4: retry failed direct IO allocations Eric Sandeen
@ 2009-10-03 2:04 ` Theodore Tso
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Tso @ 2009-10-03 2:04 UTC (permalink / raw)
To: Eric Sandeen; +Cc: ext4 development
On Fri, Oct 02, 2009 at 05:39:11PM -0500, Eric Sandeen wrote:
> On a 256M filesystem, doing this in a loop:
>
> xfs_io -F -f -d -c 'pwrite 0 64m' test
> rm -f test
>
> eventually leads to ENOSPC. (the xfs_io command does a
> 64m direct IO write to the file "test")
>
> As with other block allocation callers, it looks like we need to
> potentially retry the allocations on the initial ENOSPC.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Thanks, added to the ext4 patch queue.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-03 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-02 22:39 [PATCH] ext4: retry failed direct IO allocations Eric Sandeen
2009-10-03 2:04 ` Theodore Tso
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).