Re: [PATCH 7/7] mke2fs: Use io_manager discard_zeroes_data property

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

 



On 10/26/10 12:54 PM, Lukas Czerner wrote:
> We already have discard_zeroes_data variable in struct_io_manager
> structure, so we do nod need mke2fs_discard_zeroes_data() function
> anymore.

OK in spirit I think but I think you may need a new home for
discard_zeroes_data.  :)

-Eric

> Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> ---
>  misc/mke2fs.c |   27 +--------------------------
>  1 files changed, 1 insertions(+), 26 deletions(-)
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index 09ce711..114987c 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -1900,31 +1900,6 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr)
>  	return retval;
>  }
>  
> -#ifdef __linux__
> -
> -#ifndef BLKDISCARDZEROES
> -#define BLKDISCARDZEROES _IO(0x12,124)
> -#endif
> -
> -static int mke2fs_discard_zeroes_data(ext2_filsys fs)
> -{
> -	int fd;
> -	int ret;
> -	int discard_zeroes_data = 0;
> -
> -	fd = open64(fs->device_name, O_RDWR);
> -
> -	if (fd > 0) {
> -		ioctl(fd, BLKDISCARDZEROES, &discard_zeroes_data);
> -		close(fd);
> -	}
> -	return discard_zeroes_data;
> -}
> -#else
> -#define mke2fs_discard_blocks(fs)	1
> -#define mke2fs_discard_zeroes_data(fs)	0
> -#endif
> -
>  int main (int argc, char *argv[])
>  {
>  	errcode_t	retval = 0;
> @@ -1997,7 +1972,7 @@ int main (int argc, char *argv[])
>  				printf(_("succeeded.\n"));
>  		}
>  
> -		if (!retval && mke2fs_discard_zeroes_data(fs)) {
> +		if (!retval && io_ptr->discard_zeroes_data) {
>  			if (verbose)
>  				printf(_("Discard succeeded and will return 0s "
>  					 " - skipping inode table wipe\n"));

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


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux