xfs
[Top] [All Lists]

Re: [PATCH] xfsprogs: add fpunch command for hole punching via fallocate

To: Josef Bacik <josef@xxxxxxxxxx>
Subject: Re: [PATCH] xfsprogs: add fpunch command for hole punching via fallocate
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 18 Jan 2011 07:51:12 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1295009545-17839-1-git-send-email-josef@xxxxxxxxxx>
References: <1295009545-17839-1-git-send-email-josef@xxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
Looks mostly good, but I wonder what the point of a new command for this
is.  It's just one new flag to fallocate, so I'd also implement it as
a flag to the fallocate command.

> @@ -153,8 +156,10 @@ fallocate_f(
>       xfs_flock64_t   segment;
>       int             mode = 0;
>       int             c;
> +     const char      *opts;
>  
> -     while ((c = getopt(argc, argv, "k")) != EOF) {
> +     opts = "k";
> +     while ((c = getopt(argc, argv, opts)) != EOF) {
>               switch (c) {
>               case 'k':
>                       mode = FALLOC_FL_KEEP_SIZE;

Why do you change unrelated code?

> +#if defined (FALLOC_FL_PUNCH_HOLE)

I'd rather have a

#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE    0x02
#endif

to avoid requiring newest kernel headers.

<Prev in Thread] Current Thread [Next in Thread>