Re: [PATCH] fat: make discard a mount option

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

 



Christoph Hellwig <hch@xxxxxx> writes:

> Currently shipping discard capable SSDs and arrays have rather sub-optimal
> implementations of the command and can the use of it can cause massive
> slowdowns.  Make issueing these commands option as it's already in btrfs
> and gfs2.

Thanks. Looks good to me, I'll apply as is.

BTW, what value is default for those users? And from users of some
filesystems, it might be better to do in lower layer or VFS?

> Index: linux-2.6/fs/fat/fat.h
> ===================================================================
> --- linux-2.6.orig/fs/fat/fat.h	2009-11-18 13:47:49.380003970 +0100
> +++ linux-2.6/fs/fat/fat.h	2009-11-18 13:48:13.169014622 +0100
> @@ -44,7 +44,8 @@ struct fat_mount_options {
>  		 nocase:1,	  /* Does this need case conversion? 0=need case conversion*/
>  		 usefree:1,	  /* Use free_clusters for FAT32 */
>  		 tz_utc:1,	  /* Filesystem timestamps are in UTC */
> -		 rodir:1;	  /* allow ATTR_RO for directory */
> +		 rodir:1,	  /* allow ATTR_RO for directory */
> +		 discard:1;	  /* Issue discard requests on deletions */
>  };
>  
>  #define FAT_HASH_BITS	8
> Index: linux-2.6/fs/fat/fatent.c
> ===================================================================
> --- linux-2.6.orig/fs/fat/fatent.c	2009-11-18 13:48:24.102254108 +0100
> +++ linux-2.6/fs/fat/fatent.c	2009-11-18 13:49:14.338033708 +0100
> @@ -573,8 +573,11 @@ int fat_free_clusters(struct inode *inod
>  		if (cluster != fatent.entry + 1) {
>  			int nr_clus = fatent.entry - first_cl + 1;
>  
> -			sb_issue_discard(sb, fat_clus_to_blknr(sbi, first_cl),
> -					 nr_clus * sbi->sec_per_clus);
> +			if (sbi->options.discard) {
> +				sb_issue_discard(sb,
> +					fat_clus_to_blknr(sbi, first_cl),
> +					nr_clus * sbi->sec_per_clus);
> +			}
>  			first_cl = cluster;
>  		}
>  
> Index: linux-2.6/fs/fat/inode.c
> ===================================================================
> --- linux-2.6.orig/fs/fat/inode.c	2009-11-18 13:46:40.484256340 +0100
> +++ linux-2.6/fs/fat/inode.c	2009-11-18 13:47:39.457256306 +0100
> @@ -871,7 +871,7 @@ enum {
>  	Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
>  	Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
>  	Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont,
> -	Opt_err_panic, Opt_err_ro, Opt_err,
> +	Opt_err_panic, Opt_err_ro, Opt_discard, Opt_err,
>  };
>  
>  static const match_table_t fat_tokens = {
> @@ -910,6 +910,7 @@ static const match_table_t fat_tokens = 
>  	{Opt_obsolate, "cvf_format=%20s"},
>  	{Opt_obsolate, "cvf_options=%100s"},
>  	{Opt_obsolate, "posix"},
> +	{Opt_discard, "discard"},
>  	{Opt_err, NULL},
>  };
>  static const match_table_t msdos_tokens = {
> @@ -1136,6 +1137,9 @@ static int parse_options(char *options, 
>  		case Opt_rodir:
>  			opts->rodir = 1;
>  			break;
> +		case Opt_discard:
> +			opts->discard = 1;
> +			break;
>  
>  		/* obsolete mount options */
>  		case Opt_obsolate:
-- 
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux