ACKED: [PATCH] eCryptfs: Improve statfs reporting

Andy Whitcroft apw at canonical.com
Sat Dec 24 12:37:25 UTC 2011


On Fri, Dec 23, 2011 at 09:42:07AM -0600, Tyler Hicks wrote:

> > > +	/* Return a safe estimate for the uncommon cases */
> > > +	(*namelen) = lower_namelen;
> > > +	(*namelen) -= ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE;
> > This is outside the encrypted part.
> > > +	/* Since this is the max decoded size, subtract 1 "decoded block" len */
> > > +	(*namelen) = ecryptfs_max_decoded_size(*namelen) - 3;
> > > +	(*namelen) -= ECRYPTFS_TAG_70_MAX_METADATA_SIZE;
> > > +	(*namelen) -= ECRYPTFS_FILENAME_MIN_RANDOM_PREPEND_BYTES;
> > These are inside the encrypted part.
> > > +	/* Worst case is that the filename is padded nearly a full block size */
> > > +	(*namelen) -= cipher_blocksize - 1;
[...]
> > Other than that perhaps personally I would have calculated the namelen in a
> > local variable assigning it once if valid, it looks to do what is intended.
> 
> I had it stored in the private data of the superblock for a while. But
> then I figured that we do these same calculations (plus a lot more) on
> readdir() and cold lookup()'s, so doing it in statfs() isn't insane.

Ahh I didn't mean store it for all time, just calculate the thing in
long x, and assign X to (*namelen) at the end.

-apw




More information about the kernel-team mailing list