[Ocfs2-tools-devel] Add compress dirs option in fsck.ocfs2

Joel Becker Joel.Becker at oracle.com
Tue Oct 13 15:46:46 PDT 2009


[Hi Goldwyn.  Sorry it took me so long to get back on this]

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.

Joel

-- 

"The nice thing about egotists is that they don't talk about other
 people."
         - Lucille S. Harper

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list