Author: kib Date: Sun Feb 28 17:15:45 2010 New Revision: 204472 URL: http://svn.freebsd.org/changeset/base/204472
Log: Add assertions for FAT bitmap state. Tested by: pho MFC after: 3 weeks Modified: head/sys/fs/msdosfs/msdosfs_fat.c Modified: head/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 28 17:13:59 2010 (r204471) +++ head/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 28 17:15:45 2010 (r204472) @@ -413,7 +413,12 @@ usemap_alloc(pmp, cn) { MSDOSFS_ASSERT_MP_LOCKED(pmp); + + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) + == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); + KASSERT(pmp->pm_freeclustercount > 0, ("usemap_alloc: too little")); pmp->pm_freeclustercount--; } @@ -425,6 +430,9 @@ usemap_free(pmp, cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); pmp->pm_freeclustercount++; + KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) + != 0, ("Freeing unused sector %ld %ld %x", cn, cn % N_INUSEBITS, + (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS)); } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"