Re: [PATCH] Skip non-regular files in recursive defrag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 01, 2014 at 03:10:25PM +0100, Pascal VITOUX wrote:
> ---
>  cmds-filesystem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> index 1c1926b..979dbd9 100644
> --- a/cmds-filesystem.c
> +++ b/cmds-filesystem.c
> @@ -646,7 +646,7 @@ static int defrag_callback(const char *fpath, const struct stat *sb,
>  	int e = 0;
>  	int fd = 0;
>  
> -	if (typeflag == FTW_F) {
> +	if ((typeflag == FTW_F) && S_ISREG(sb->st_mode)) {

The ftw(3) documentation states that FTW_F gets the regular files, do you have a
reproducer whre this does not work as expected?

I think the check could be placed into cmd_defrag, there's a st_mode
check for directories already. Defragmenting makes most sense for
regular files (though there's the option to defrag portions of the
metadata b-trees), so it's fine to handle just directories and regular
files in userspace.

If you're going to resend the patch, please add 'btrfs-progs: ' string
to the subject, write a short changlog and add your Signed-off-by line.

thanks,
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux