lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 6 Jan 2011 15:26:37 +0100
From:	Jan Kara <jack@...e.cz>
To:	Lukas Czerner <lczerner@...hat.com>
Cc:	Jan Kara <jack@...e.cz>, linux-ext4@...r.kernel.org,
	greg.freemyer@...il.com, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/2] ext3: Add batched discard support for ext3

  Hi,

On Thu 25-11-10 15:27:09, Lukas Czerner wrote:
> > +/**
> > + * ext3_trim_fs() -- trim ioctl handle function
> > + * @sb:			superblock for filesystem
> > + * @start:		First Byte to trim
> > + * @len:		number of Bytes to trim from start
> > + * @minlen:		minimum extent length in Bytes
> > + *
> > + * ext3_trim_fs goes through all allocation groups containing Bytes from
> > + * start to start+len. For each such a group ext3_trim_all_free function
> > + * is invoked to trim all free space.
> > + */
> > +int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range)
> > +{
> > +	ext3_grpblk_t last_block, first_block, free_blocks;
> > +	unsigned long first_group, last_group;
> > +	unsigned long group, ngroups;
> > +	struct ext3_group_desc *gdp;
> > +	struct ext3_super_block *es;
> > +	uint64_t start, len, minlen, trimmed;
> > +	int ret = 0;
> We probably need to add this:
> 
> ext3_fsblk_t blocks_count = le32_to_cpu(EXT3_SB(sb)->s_es->s_blocks_count);
> 
> > +
> > +	start = range->start >> sb->s_blocksize_bits;
> > +	len = range->len >> sb->s_blocksize_bits;
> > +	minlen = range->minlen >> sb->s_blocksize_bits;
> > +	trimmed = 0;
> and this:
> 
> 	if (len > blocks_count)
> 		len = blocks_count - start;
  Thanks for letting me know. The above could go negative if start is too
big. So I've ended up with checks:

+       if (start >= max_blks)
+               goto out;
+       if (start + len > max_blks)
+               len = max_blks - start;

								Honza
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ