Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ffs/ffs_snapshot.c
Show First 20 Lines • Show All 1,078 Lines • ▼ Show 20 Lines | expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype, clearmode) | ||||
*/ | */ | ||||
dip = (struct ufs1_dinode *)bp->b_data + | dip = (struct ufs1_dinode *)bp->b_data + | ||||
ino_to_fsbo(fs, cancelip->i_number); | ino_to_fsbo(fs, cancelip->i_number); | ||||
if (clearmode || cancelip->i_effnlink == 0) | if (clearmode || cancelip->i_effnlink == 0) | ||||
dip->di_mode = 0; | dip->di_mode = 0; | ||||
dip->di_size = 0; | dip->di_size = 0; | ||||
dip->di_blocks = 0; | dip->di_blocks = 0; | ||||
dip->di_flags &= ~SF_SNAPSHOT; | dip->di_flags &= ~SF_SNAPSHOT; | ||||
bzero(&dip->di_db[0], (UFS_NDADDR + UFS_NIADDR) * sizeof(ufs1_daddr_t)); | bzero(dip->di_db, UFS_NDADDR * sizeof(ufs1_daddr_t)); | ||||
bzero(dip->di_ib, UFS_NIADDR * sizeof(ufs1_daddr_t)); | |||||
bdwrite(bp); | bdwrite(bp); | ||||
/* | /* | ||||
* Now go through and expunge all the blocks in the file | * Now go through and expunge all the blocks in the file | ||||
* using the function requested. | * using the function requested. | ||||
*/ | */ | ||||
numblks = howmany(cancelip->i_size, fs->fs_bsize); | numblks = howmany(cancelip->i_size, fs->fs_bsize); | ||||
if ((error = (*acctfunc)(snapvp, &cancelip->i_din1->di_db[0], | if ((error = (*acctfunc)(snapvp, &cancelip->i_din1->di_db[0], | ||||
&cancelip->i_din1->di_db[UFS_NDADDR], fs, 0, expungetype))) | &cancelip->i_din1->di_db[UFS_NDADDR], fs, 0, expungetype))) | ||||
▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype, clearmode) | ||||
* Set a snapshot inode to be a zero length file, regular files | * Set a snapshot inode to be a zero length file, regular files | ||||
* to be completely unallocated. | * to be completely unallocated. | ||||
*/ | */ | ||||
dip = (struct ufs2_dinode *)bp->b_data + | dip = (struct ufs2_dinode *)bp->b_data + | ||||
ino_to_fsbo(fs, cancelip->i_number); | ino_to_fsbo(fs, cancelip->i_number); | ||||
dip->di_size = 0; | dip->di_size = 0; | ||||
dip->di_blocks = 0; | dip->di_blocks = 0; | ||||
dip->di_flags &= ~SF_SNAPSHOT; | dip->di_flags &= ~SF_SNAPSHOT; | ||||
bzero(&dip->di_db[0], (UFS_NDADDR + UFS_NIADDR) * sizeof(ufs2_daddr_t)); | bzero(dip->di_db, UFS_NDADDR * sizeof(ufs2_daddr_t)); | ||||
bzero(dip->di_ib, UFS_NIADDR * sizeof(ufs2_daddr_t)); | |||||
if (clearmode || cancelip->i_effnlink == 0) | if (clearmode || cancelip->i_effnlink == 0) | ||||
dip->di_mode = 0; | dip->di_mode = 0; | ||||
else | else | ||||
ffs_update_dinode_ckhash(fs, dip); | ffs_update_dinode_ckhash(fs, dip); | ||||
bdwrite(bp); | bdwrite(bp); | ||||
/* | /* | ||||
* Now go through and expunge all the blocks in the file | * Now go through and expunge all the blocks in the file | ||||
* using the function requested. | * using the function requested. | ||||
▲ Show 20 Lines • Show All 1,369 Lines • Show Last 20 Lines |