linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Amir Goldstein <amir73il@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH, RFC 03/12] ext4: Convert instances of EXT4_BLOCKS_PER_GROUP to EXT4_CLUSTERS_PER_GROUP
Date: Mon, 21 Mar 2011 09:12:11 -0400	[thread overview]
Message-ID: <20110321131211.GH4135@thunk.org> (raw)
In-Reply-To: <AANLkTik962xWpBCaFgfu9Xm0YkPJ8+RwTJH9Oj48Wh2r@mail.gmail.com>

On Sun, Mar 20, 2011 at 12:26:57PM +0200, Amir Goldstein wrote:
> If I am not mistaken, while 'bit' was already converted to cluster units,
> 'count' is still in block units.
> 
> I think ext4_free_blocks() need to do 2 things:
> 1. convert 'count' to clusters (after issuing journal_forget())
> 2. round 'bit' up (and round 'count' down) if start block is not
> on cluster boundary, so truncate/punch hole, will not free a
> cluster when it's 'base' block is still allocated.

Good catch!  It's actually more complicated than that, though.
Whether or not we can free the first and the last cluster in an
unaligned extent is going to depend on whether or not there are any
blocks still in use --- which is something that has to be communicated
by extents.c, since mballoc has no way of knowing this.  (Consider
what happens with sparse blocks.)  What I think I'm going to have to
do is to teach truncate to check to see whether this is an unaligned
truncate, and if so, whether there are any blocks still left used.  If
so, it will need to pass a flag to ext4_free_blocks() to tell it to
skip the first incomplete cluster.

Similarly, when the punch code lands, we'll need to worry about this
at the end of the region which gets "punched" out, and we'll need a
similar flag telling ext4_free_blocks() whether or not to release the
last incomplete cluster.

Thanks for catching this; I have a bit more coding work to do to deal
with this case.

						- Ted

  reply	other threads:[~2011-03-21 13:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19 21:28 [PATCH, RFC 00/12] bigalloc patchset Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 01/12] ext4: read-only support for bigalloc file systems Theodore Ts'o
2011-03-21 19:35   ` Lukas Czerner
2011-03-22 17:02     ` Ted Ts'o
2011-03-23 10:28       ` Lukas Czerner
2011-03-19 21:28 ` [PATCH, RFC 02/12] ext4: enforce bigalloc restrictions (e.g., no online resizing, etc.) Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 03/12] ext4: Convert instances of EXT4_BLOCKS_PER_GROUP to EXT4_CLUSTERS_PER_GROUP Theodore Ts'o
2011-03-20 10:26   ` Amir Goldstein
2011-03-21 13:12     ` Ted Ts'o [this message]
2011-03-19 21:28 ` [PATCH, RFC 04/12] ext4: Remove block bitmap initialization in ext4_new_inode() Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 05/12] ext4: factor out block group accounting into functions Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 06/12] ext4: split out ext4_free_blocks_after_init() Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 07/12] ext4: bigalloc changes to block bitmap initialization functions Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 08/12] ext4: Convert block group-relative offsets to use clusters Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 09/12] ext4: teach ext4_ext_map_blocks() about the bigalloc feature Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 10/12] ext4: teach ext4_statfs() to deal with clusters if bigalloc is enabled Theodore Ts'o
2011-03-21 20:17   ` Lukas Czerner
2011-03-22 22:09     ` Ted Ts'o
2011-03-19 21:28 ` [PATCH, RFC 11/12] ext4: tune mballoc's default group prealloc size for bigalloc file systems Theodore Ts'o
2011-03-19 21:28 ` [PATCH, RFC 12/12] ext4: enable mounting bigalloc as read/write Theodore Ts'o
2011-03-20 10:33 ` [PATCH, RFC 00/12] bigalloc patchset Amir Goldstein
2011-03-21  8:55 ` Andreas Dilger
2011-03-21 11:31   ` Rogier Wolff
2011-03-21 13:24   ` Ted Ts'o
2011-03-21 23:42     ` Andreas Dilger
2011-04-05 17:23 ` Coly Li

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=20110321131211.GH4135@thunk.org \
    --to=tytso@mit.edu \
    --cc=amir73il@gmail.com \
    --cc=linux-ext4@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;
as well as URLs for NNTP newsgroup(s).