From: Tao Ma <tao.ma@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: Try to free truncate log when meeting ENOSPC in write.
Date: Thu, 04 Nov 2010 13:38:41 +0800 [thread overview]
Message-ID: <4CD246E1.1030608@oracle.com> (raw)
In-Reply-To: <20101104014623.GC14640@mail.oracle.com>
On 11/04/2010 09:46 AM, Joel Becker wrote:
> On Tue, Oct 26, 2010 at 03:29:08PM +0800, Tao Ma wrote:
>> Recently, one of our colleagues meet with a problem that if we
>> write/delete a 32mb files repeatly, we will get an ENOSPC in
>> the end. And the corresponding bug is 1288.
>> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1288
>>
>> The real problem is that although we have freed the clusters,
>> they are in truncate log and they will be summed up so that
>> we can free them once in a whole.
>>
>> So this patch just try to resolve it. In case we see -ENOSPC
>> in ocfs2_write_begin_no_lock, we will check whether the truncate
>> log has enough clusters for our need, if yes, we will try to
>> flush the truncate log at that point and try again. This method
>> is inspired by Mark Fasheh<mfasheh@suse.com>. Thanks.
>
> Ok, this is more like what I was thinking about. I guess I wish
> we could do it inside the allocation routines, but I think we have too
> many locks at that point.
yeah, the locks are really the biggest problem for us.
> This patch doesn't help any place that
> allocates other than write() and mmap(). Is this something that could
> be added to extending truncate and unwritten allocation?
I haven't tried in other cases. but in general it could be possible
since all the work is done in ocfs2_try_to_free_truncate_log. We may try
it in other place after thinking carefully of the lock there. But I
guess we can let it in first to see how it works. If it is right and
robust, I can generate another patch for them later. :)
> I agree that we only care to have one pass. Have you run it
> against the test case from
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1288? If so, modulo
> any cleanups you did after others commented, I'm happy ;-)
yes, I have run the test case overnight and didn't hit ENOSPC any more.
So do you think of accepting it? If yes, I will regenerate the patch for
your merge.
>
>> diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
>> index d840821..de06558 100644
>> --- a/fs/ocfs2/ocfs2.h
>> +++ b/fs/ocfs2/ocfs2.h
>> @@ -439,6 +439,8 @@ struct ocfs2_super
>> /* rb tree root for refcount lock. */
>> struct rb_root osb_rf_lock_tree;
>> struct ocfs2_refcount_tree *osb_ref_tree_lru;
>> +
>> + unsigned int truncated_clusters;
>
> Make sure you comment what lock is needed to access
> truncated_clusters.
OK, I will add comment for it.
Regards,
Tao
next prev parent reply other threads:[~2010-11-04 5:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-26 7:29 [Ocfs2-devel] [PATCH] ocfs2: Try to free truncate log when meeting ENOSPC in write Tao Ma
2010-10-26 8:28 ` tristan
2010-10-26 8:54 ` Tao Ma
2010-10-26 9:05 ` tristan
2010-11-04 1:46 ` Joel Becker
2010-11-04 5:38 ` Tao Ma [this message]
2010-11-04 6:19 ` Joel Becker
2010-11-04 7:14 ` [Ocfs2-devel] [PATCH v2] " Tao Ma
2010-12-08 1:58 ` Joel Becker
2010-12-08 2:15 ` Sunil Mushran
2010-12-16 8:51 ` Joel Becker
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=4CD246E1.1030608@oracle.com \
--to=tao.ma@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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).