On 2/25/14, 8:11 PM, Christoph Hellwig wrote:
> On Mon, Feb 24, 2014 at 11:27:35PM -0600, Eric Sandeen wrote:
>> xfs_set_maxicount() overflowed fairly easily for large filesystems
>> and large maxicount; we started out by multiplying dblocks by
>> the percentage, *then* dividing by 100, and never checked for
>> an overflow. The calculations were also, IMHO, a little hard
>> to follow.
>
> Would be useful to get this test case into xfstests..
Ok so I was going on Dave's assertion about that. ;)
To overflow, we'd need dblocks * 100 to be > 2^64-1:
so dblocks would need to be > (2^64-1)/100
for 4k blocks that's 655 exabytes. Maybe not so possible after all ;)
Dave, maybe just removing the open-code is enough here.
-Eric
>> -STATIC void
>> +void
>> xfs_set_maxicount(xfs_mount_t *mp)
>> {
>> xfs_sb_t *sbp = &(mp->m_sb);
>> - __uint64_t icount;
>> + __uint64_t iblocks;
>
> Seems like this could move into the if clause below.
>
>> @@ -388,6 +388,7 @@ extern int xfs_mod_incore_sb_batch(xfs_mount_t *,
>> xfs_mod_sb_t *,
>> extern int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
>> extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
>> extern int xfs_readsb(xfs_mount_t *, int);
>> +void xfs_set_maxicount(xfs_mount_t *mp);
>> extern void xfs_freesb(xfs_mount_t *);
>> extern int xfs_fs_writable(xfs_mount_t *);
>> extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t);
>
> A missing extern while all other prototypes around it have one seems
> rather odd.
>
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
>
|