On Fri, Dec 16, 2022 at 07:57:37AM +1100, Dave Chinner wrote: > > > > Well, that's why my patch uses kvmalloc() to allocate the bitmap. > > > > I did originally think it was going to have to be a sparse bitmap that ties into > > the shrinker so that pages of it can be evicted. But if you do the math, the > > required bitmap size is only 1 / 2^22 the size of the file, assuming the Merkle > > tree uses SHA-256 and 4K blocks. So a 100MB file only needs a 24-byte bitmap, > > and the bitmap for any file under 17GB fits in a 4K page. > > > > My patch puts an arbitrary limit at a 1 MiB bitmap, which would be a 4.4TB file. > > > > It's not ideal to say "4 TB Ought To Be Enough For Anybody". But it does feel > > that it's not currently worth the extra complexity and runtime overhead of > > implementing a full-blown sparse bitmap with cache eviction support, when no one > > currently has a use case for fsverity on files anywhere near that large. > > I think we can live with that for the moment, but I suspect that 4TB > filesize limit will become an issue sooner rather than later. What > will happen if someone tries to measure a file larger than this > limit? What's the failure mode? > FS_IOC_ENABLE_VERITY will fail with EFBIG. - Eric