Thread (6 messages) 6 messages, 2 authors, 2017-08-31

Re: e2fsck: set dir_nlink feature if large dir exists

From: Andreas Dilger <hidden>
Date: 2017-08-31 18:18:11

On Aug 30, 2017, at 9:13 AM, Theodore Ts'o [off-list ref] wrote:
On Wed, Aug 30, 2017 at 01:43:30AM -0600, Andreas Dilger wrote:
quoted
On a related note, I was trying to implement the optimization for
more efficient ext2fs_link() insertion, but this has proven to be
much more complex than I expected.  I was thinking I would just
call the link_proc() function directly to handle insertion of the
new name, using block number of the previous caller.  However, this
function depends on the directory leaf buffers having been read
from disk, and being passed a dirent pointer to the free space after
being called through a series of callback indirections.
I think it's more trouble than it's worth to preseve the existing
link_proc() function.  I'd recommend out to be just what is necessary
to do the directory entry insert, and make that a helper function
which is called by link_proc() and the shortcut handling code in
ext2fs_link().
I looked at implementing it this way, but unfortunately that doesn't
appear workable since ext2fs_link() never gets the block numbers to
be able to do this.  I'd essentially have to reimplement all of the
block and directory leaf processing in ext2fs_dir_iterate2() to get
figure out where to store the first entries in the directory.

What I'm looking at now is add a new ext2fs_dir_iterate3() function
that passes *blocknr and blockcnt to the link_proc() and unlink_proc()
callback functions so they can be stored in struct_ext2_filsys, and
used to shortcut the iteration in ext2fs_link() for multiple inserts.
It is added to unlink_proc() so that we can reset the saved state if
entries are being deleted.

Cheers, Andreas




Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help