[Ocfs2-tools-devel] Add compress dirs option in fsck.ocfs2
Joel Becker
Joel.Becker at oracle.com
Tue Oct 13 15:54:41 PDT 2009
On Mon, Aug 31, 2009 at 06:47:00PM -0500, Goldwyn Rodrigues wrote:
> This attempt is after incorporating Joel's comments.
>
> This patch adds the option to compress directories (-D) in fsck.
> The option compresses the directory entries and consolidates a hole at
> the end of the directory block. This consolidated hole increases the
> chance of ocfs2_prepare_dir_for_insert (kmp) to find a hole using
> ocfs2_find_dir_space_* functions while inserting a new directory entry
> in the directory.
>
> ---
> diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
> index 74c18ac..57310a9 100644
> --- a/fsck.ocfs2/fsck.c
> +++ b/fsck.ocfs2/fsck.c
> @@ -650,7 +650,7 @@ int main(int argc, char **argv)
> setlinebuf(stderr);
> setlinebuf(stdout);
>
> - while((c = getopt(argc, argv, "b:B:fFGnuvVyr:")) != EOF) {
> + while((c = getopt(argc, argv, "b:B:DfFGnuvVyr:")) != EOF) {
> switch (c) {
> case 'b':
> blkno = read_number(optarg);
> @@ -675,6 +675,9 @@ int main(int argc, char **argv)
> goto out;
> }
> break;
> + case 'D':
> + ost->ost_compress_dirs = 1;
> + break;
How do you want to handle readonly fsck and fsck -n? Silently
ignore it? Let the user see the errors? fsck.ocfs2 opens the
filesystem in readonly mode when you specify '-n'. So you can't
actually do the dir compression.
I think you should fail fsck if the user specified '-D' and
'-n' at the same time. It won't work, and it's much less surprising
than -D silently doing nothing.
Joel
--
"Copy from one, it's plagiarism; copy from two, it's research."
- Wilson Mizner
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