From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2_grow: write one rindex entry and then the rest
Date: Fri, 27 May 2011 10:23:27 +0100 [thread overview]
Message-ID: <1306488207.2857.5.camel@menhir> (raw)
In-Reply-To: <1306443293-25821-1-git-send-email-bmarzins@redhat.com>
Hi,
Looks good to me,
Steve.
On Thu, 2011-05-26 at 15:54 -0500, Benjamin Marzinski wrote:
> There is a problem with gfs2_grow when the rindex file is stuffed, or the
> filesystem blocksize is smaller than the pagesize. When gfs2_grow writes
> out all the rindex entries at once, there needs to be enough space left for
> it to be able to write the first page of data without doing any allocations.
> If there isn't gfs2_grow will fail, even though there is space for
> additional resrouce groups in the last block of the rindex file. This patch
> makes gfs2_grow write one rindex entry frist, to grow the filesystem by
> one resource group's worth of space. Then it writes the rest. Since
> the code guarantees that there will always be enough space in the rindex
> file for one more rindex entry, the first write will never require an
> allocation.
>
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
> gfs2/mkfs/main_grow.c | 14 ++++++++++++--
> 1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
> index 03eb57b..81f492b 100644
> --- a/gfs2/mkfs/main_grow.c
> +++ b/gfs2/mkfs/main_grow.c
> @@ -244,8 +244,18 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
> }
> /* Now write the new RGs to the end of the rindex */
> lseek(rindex_fd, 0, SEEK_END);
> - count = write(rindex_fd, buf, writelen);
> - if (count != writelen) {
> + count = write(rindex_fd, buf, sizeof(struct gfs2_rindex));
> + if (count != sizeof(struct gfs2_rindex)) {
> + log_crit("Error writing first new rindex entry;"
> + "aborted.\n");
> + if (count > 0)
> + goto trunc;
> + else
> + goto out;
> + }
> + count = write(rindex_fd, buf + sizeof(struct gfs2_rindex),
> + writelen - sizeof(struct gfs2_rindex));
> + if (count != writelen - sizeof(struct gfs2_rindex)) {
> log_crit("Error writing new rindex entries;"
> "aborted.\n");
> if (count > 0)
prev parent reply other threads:[~2011-05-27 9:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 20:54 [Cluster-devel] [PATCH] gfs2_grow: write one rindex entry and then the rest Benjamin Marzinski
2011-05-27 9:23 ` Steven Whitehouse [this message]
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=1306488207.2857.5.camel@menhir \
--to=swhiteho@redhat.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).