[Ocfs2-tools-devel] Add compress dirs option in fsck.ocfs2
Goldwyn Rodrigues
rgoldwyn at gmail.com
Fri Oct 16 09:31:08 PDT 2009
On Tue, Oct 13, 2009 at 03:46:46PM -0700, Joel Becker wrote:
> [Hi Goldwyn. Sorry it took me so long to get back on this]
No problem.
>
> On Thu, Sep 03, 2009 at 10:49:44AM -0500, Goldwyn Rodrigues wrote:
> > >> No, I do not skip the dirent record if dirent->inode==0. I still
> > >> memmove() it and set prev to dirent (the empty one).
> > >>
> > >> prev is responsible for skipping empty records (by not updating write_off)
>
> I think I see what you are doing. You slide things over those
> empty records.
> Here's an example in ascii-art:
>
> d - dirent pointer
> p - prev pointer
> o - offset
> w - write offset
> N - inode number
>
> --------
>
> Start:
> w
> d
> p o
> [100 |0 |101 |0 |102 |0 ]
>
> Looped past 100:
> w
> d
> p o
> [100 |0 |101 |0 |102 |0 ]
>
> Looped past 0:
> w
> d
> p o
> [100 |0 |101 |0 |102 |0 ]
>
> Shifted 101 down:
> w
> d
> p o
> [100 |101 |0 |102 |0 ]
>
> Looped past 101:
> w
> d
> p o
> [100 |101 |0 |102 |0 ]
>
> Adjust 101:
> w
> d
> p o
> [100 |101 | |0 |102 |0 ]
>
> Shift 0 down:
> w
> d
> p o
> [100 |101 |0 |102 |0 ]
>
> Looped past 0:
> w
> d
> p o
> [100 |101 |0 |102 |0 ]
>
> Shift 102 down:
> w
> d
> p o
> [100 |101 |102 |0 ]
>
> Looped past 102:
> w
> d
> p o
> [100 |101 |102 |0 ]
>
> Adjust 102:
> w
> d
> p o
> [100 |101 |102 | |0 ]
>
> Shift 0 down:
> w
> d
> p o
> [100 |101 |102 |0 ]
>
> --------
>
> So there you have a valid compressed dirblock. Every state that
> is after going around the loop - a place where we can potentially write
> - is safe. The only squirrelly thing is that last empty dirent. It
> doesn't get squished with 102. But it is still valid, so it's fine.
> Do I have it correct? Let me know if I've misunderstood
> anything. I'm going to go back and look at the patch in its entirety to
> give a final once-over.
>
Yes. you have it correct.
However, I am not aware of a situation which would get a block like the
one you have shown (with 0 as the last entry in the dirblock). In any
case, it is valid, and the "dirent hole" is at the end of the block.
Thanks,
--
Goldwyn
More information about the Ocfs2-tools-devel
mailing list