Date: Sat, 14 Dec 2002 12:29:46 -0800 From: Kirk McKusick <mckusick@beastie.mckusick.com> To: Ian Dowse <iedowse@maths.tcd.ie> Cc: Jake Burkholder <jake@locore.ca>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, re@FreeBSD.org Subject: Re: cvs commit: src/sys/ufs/ufs inode.h src/sys/sys conf.h src/sys/ufs/ffs ffs_snapshot.c Message-ID: <200212142029.gBEKTk59012126@beastie.mckusick.com> In-Reply-To: Your message of "Sat, 14 Dec 2002 16:56:07 GMT." <200212141656.aa51164@salmon.maths.tcd.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
As a followup to my previous message, here is my proposed (and even tested!) change to use an appropriately wide field. Kirk McKusick =-=-=-=-= Index: ufs/ufs/inode.h =================================================================== RCS file: /usr/ncvs/src/sys/ufs/ufs/inode.h,v retrieving revision 1.42 diff -c -r1.42 inode.h *** ufs/ufs/inode.h 2002/12/14 01:36:59 1.42 --- ufs/ufs/inode.h 2002/12/14 20:22:06 *************** *** 85,91 **** ino_t i_ino; /* Inode number of found directory. */ u_int32_t i_reclen; /* Size of found directory entry. */ ! struct dirhash *i_dirhash; /* Hashing for large directories */ /* * Data for extended attribute modification. --- 85,94 ---- ino_t i_ino; /* Inode number of found directory. */ u_int32_t i_reclen; /* Size of found directory entry. */ ! union { ! struct dirhash *dirhash; /* Hashing for large directories. */ ! daddr_t *snapblklist; /* Collect expunged snapshot blocks. */ ! } i_un; /* * Data for extended attribute modification. *************** *** 124,129 **** --- 127,134 ---- #define IN_LAZYMOD 0x0040 /* Modified, but don't write yet. */ #define IN_SPACECOUNTED 0x0080 /* Blocks to be freed in free count. */ + #define i_dirhash i_un.dirhash + #define i_snapblklist i_un.snapblklist #define i_din1 dinode_u.din1 #define i_din2 dinode_u.din2 Index: ufs/ffs/ffs_snapshot.c =================================================================== RCS file: /usr/ncvs/src/sys/ufs/ffs/ffs_snapshot.c,v retrieving revision 1.54 diff -c -r1.54 ffs_snapshot.c *** ufs/ffs/ffs_snapshot.c 2002/12/14 01:36:59 1.54 --- ufs/ffs/ffs_snapshot.c 2002/12/14 20:16:37 *************** *** 532,549 **** } /* * Allocate the space for the list of preallocated snapshot blocks. - * The i_offset field is borrowed to pass the value of snapblklist - * down into the expunge functions. */ snaplistsize = fs->fs_ncg + howmany(fs->fs_cssize, fs->fs_bsize) + FSMAXSNAP + 1 /* superblock */ + 1 /* last block */ + 1 /* size */; MALLOC(snapblklist, daddr_t *, snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); ! ((daddr_t *)(ip->i_offset)) = &snapblklist[1]; /* * Expunge the blocks used by the snapshots from the set of * blocks marked as used in the snapshot bitmaps. Also, collect ! * the list of allocated blocks in i_offset. */ if (ip->i_ump->um_fstype == UFS1) error = expunge_ufs1(vp, ip, copy_fs, mapacct_ufs1, BLK_SNAP); --- 532,547 ---- } /* * Allocate the space for the list of preallocated snapshot blocks. */ snaplistsize = fs->fs_ncg + howmany(fs->fs_cssize, fs->fs_bsize) + FSMAXSNAP + 1 /* superblock */ + 1 /* last block */ + 1 /* size */; MALLOC(snapblklist, daddr_t *, snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); ! ip->i_snapblklist = &snapblklist[1]; /* * Expunge the blocks used by the snapshots from the set of * blocks marked as used in the snapshot bitmaps. Also, collect ! * the list of allocated blocks in i_snapblklist. */ if (ip->i_ump->um_fstype == UFS1) error = expunge_ufs1(vp, ip, copy_fs, mapacct_ufs1, BLK_SNAP); *************** *** 554,562 **** FREE(snapblklist, M_UFSMNT); goto done; } ! snaplistsize = ((daddr_t *)(ip->i_offset)) - snapblklist; snapblklist[0] = snaplistsize; ! ip->i_offset = 0; /* * Write out the list of allocated blocks to the end of the snapshot. */ --- 552,560 ---- FREE(snapblklist, M_UFSMNT); goto done; } ! snaplistsize = ip->i_snapblklist - snapblklist; snapblklist[0] = snaplistsize; ! ip->i_snapblklist = 0; /* * Write out the list of allocated blocks to the end of the snapshot. */ *************** *** 999,1005 **** if (blkno == 0 || blkno == BLK_NOCOPY) continue; if (expungetype == BLK_SNAP && blkno != BLK_SNAP) ! *((daddr_t *)(ip->i_offset))++ = lblkno; if (blkno == BLK_SNAP) blkno = blkstofrags(fs, lblkno); ffs_blkfree(fs, vp, blkno, fs->fs_bsize, inum); --- 997,1003 ---- if (blkno == 0 || blkno == BLK_NOCOPY) continue; if (expungetype == BLK_SNAP && blkno != BLK_SNAP) ! *ip->i_snapblklist++ = lblkno; if (blkno == BLK_SNAP) blkno = blkstofrags(fs, lblkno); ffs_blkfree(fs, vp, blkno, fs->fs_bsize, inum); *************** *** 1275,1281 **** if (blkno == 0 || blkno == BLK_NOCOPY) continue; if (expungetype == BLK_SNAP && blkno != BLK_SNAP) ! *((daddr_t *)(ip->i_offset))++ = lblkno; if (blkno == BLK_SNAP) blkno = blkstofrags(fs, lblkno); ffs_blkfree(fs, vp, blkno, fs->fs_bsize, inum); --- 1273,1279 ---- if (blkno == 0 || blkno == BLK_NOCOPY) continue; if (expungetype == BLK_SNAP && blkno != BLK_SNAP) ! *ip->i_snapblklist++ = lblkno; if (blkno == BLK_SNAP) blkno = blkstofrags(fs, lblkno); ffs_blkfree(fs, vp, blkno, fs->fs_bsize, inum); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212142029.gBEKTk59012126>