From: Sami Liedes <sami.liedes@iki.fi>
To: Andreas Dilger <adilger@dilger.ca>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 4/5] libext2fs: Implement ext2fs_find_first_zero_generic_bmap().
Date: Mon, 12 Mar 2012 21:15:14 +0200 [thread overview]
Message-ID: <20120312191514.GS6961@sli.dy.fi> (raw)
In-Reply-To: <5E845FD5-30E4-47A1-AF8E-70A288E3442D@dilger.ca>
[-- Attachment #1: Type: text/plain, Size: 2065 bytes --]
On Sun, Mar 11, 2012 at 03:51:05AM -0600, Andreas Dilger wrote:
> Rather than making the bitmap searching loop more efficient, I've always thought
> it would be better to have an interface that iterates over the bitmap and returns
> the next set bit. It is similar to what you implemented with ->find_first_zero(),
> but it would be better to have (IMHO) ->find_next_zero() and ->find_next_set().
I've been thinking about this. Such an interface might be a good idea,
and I could implement it and a corresponding backend implementation
for the bit array backend, but I don't think ext2fs_new_inode() could
properly exercise it and I'm hesitant to submit code that isn't tested
by being actually properly used somewhere. I will still do it if
there's a general consensus that it's a good idea.
It could be something along the lines of
* type ext2fs_bitmap_iterator, opaque to calling code, mainly a magic
number and backend-specific private data. In the bitarray case it
could just be the number of the bit pointed to and the end of the
range to iterate.
* bool bitmap_ops->deref_iterator(ext2fs_generic_bitmap, ext2fs_bitmap_iterator)
* ext2fs_bitmap_iterator ops->create_iterator()
->create_ranged_iterator(__u64 start, __u64 end)
->free_iterator(ext2fs_bitmap_iterator)
* __u64 bitmap_ops->iterator_position(...)
* errcode_t ops->find_next_zero(..., __u64 *pos),
->find_next_set(..., __u64 *pos)
* These would both increment the iterator and, if pos != NULL, set
*pos to the new bit position
* Modifying a bitmap invalidates all its iterators in such a way that
the only legal operation for them afterwards is ->free_iterator()
In the case of ext2fs_new_inode(), the function does not actually
iterate through all zero bits; it really only wants to find the first
zero in a certain range, after which it returns. So for simplicity of
use (and efficiency) I think it still makes sense to have
->find_first_zero() too.
Sami
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-03-12 19:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-10 21:33 [PATCH 0/5] Make filesystem shrinking faster and less CPU-intensive Sami Liedes
2012-03-10 21:34 ` [PATCH 1/5] libext2fs: Move a modulo operation out of a hot loop Sami Liedes
2012-03-11 9:50 ` Andreas Dilger
2012-03-10 21:35 ` [PATCH 2/5] resize2fs: Use EXT2_FLAG_64BITS Sami Liedes
2012-03-10 21:36 ` [PATCH 3/5] libext2fs: Document EXT2_FLAG_64BITS in ext2fs_open2() Sami Liedes
2012-03-10 21:37 ` [PATCH 4/5] libext2fs: Implement ext2fs_find_first_zero_generic_bmap() Sami Liedes
2012-03-11 9:51 ` Andreas Dilger
2012-03-12 19:15 ` Sami Liedes [this message]
2012-03-12 23:09 ` Andreas Dilger
2012-03-23 22:33 ` Ted Ts'o
2012-03-26 13:53 ` Sami Liedes
2012-03-26 15:34 ` Ted Ts'o
2012-03-26 2:39 ` Ted Ts'o
2012-03-10 21:38 ` [PATCH 5/5] libext2fs: Implement fast find_first_zero() for bitarray bitmaps Sami Liedes
2012-03-26 2:34 ` Ted Ts'o
2012-03-26 13:22 ` Sami Liedes
2012-03-26 15:26 ` Ted Ts'o
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=20120312191514.GS6961@sli.dy.fi \
--to=sami.liedes@iki.fi \
--cc=adilger@dilger.ca \
--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 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.