[Ocfs2-tools-devel] [PATCH 2/4] defrag.ocfs2: Defrag files

Goldwyn Rodrigues rgoldwyn at gmail.com
Wed Nov 17 15:13:30 PST 2010


Hi Joel,

>>
>
> ok
>
>>> +static errcode_t free_extents(ocfs2_filesys *fs, uint32_t len,
>>> +             uint64_t start, void *private)
>>> +{
>>> +     struct save_cluster *sc = (struct save_cluster *)private;
>>> +     int i;
>>> +     for (i = 0; i < sc->num_recs; i++) {
>>> +             if ((start == sc->rec[i].start) && (len == sc->rec[i].len)) {
>>> +                     verbosef("Preserved %"PRIu64" l %d\n",
>>> +                             sc->rec[i].start, sc->rec[i].len);
>>> +                     return 0;
>>> +             }
>>> +     }
>>> +     /* TODO: change call ocfs2_truncate_clusters to incorporate
>>> +        refcounting */
>>> +     verbosef("Generic free: %"PRIu64" l %d\n", start, len);
>>> +     return ocfs2_free_clusters(fs, len, start);
>>
>>        This TODO is important before inclusion.
>


While working on this I realized if we defrag files which have been
refcounted, we might end up using more disk space than we started with
because all the refcounted extents will be duplicated and merged into
larger extents.

Do you think we should preserve extents which are refcounted  using
the save_cluster structures and not attempt to defrag such extents?

-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list