diff options
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 32 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 58 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 2 |
4 files changed, 47 insertions, 49 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index bb3a48c..fa679ef 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -583,7 +583,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) else bap2 = (ufs2_daddr_t *)bp->b_data; if (lastbn != -1) { - MALLOC(copy, caddr_t, fs->fs_bsize, M_TEMP, M_WAITOK); + copy = malloc(fs->fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bp->b_data, copy, (u_int)fs->fs_bsize); for (i = last + 1; i < NINDIR(fs); i++) if (ip->i_ump->um_fstype == UFS1) @@ -637,7 +637,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) } } if (copy != NULL) { - FREE(copy, M_TEMP); + free(copy, M_TEMP); } else { bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp); diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 20fbefc..bb39bd6 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -361,7 +361,7 @@ restart: * the suspension period. */ len = howmany(fs->fs_ncg, NBBY); - MALLOC(space, void *, len, M_DEVBUF, M_WAITOK|M_ZERO); + space = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); UFS_LOCK(ump); fs->fs_active = space; UFS_UNLOCK(ump); @@ -626,7 +626,7 @@ loop: * keep us out of deadlock until the full one is ready. */ if (xp == NULL) { - MALLOC(snapblklist, daddr_t *, snaplistsize * sizeof(daddr_t), + snapblklist = malloc(snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); blkp = &snapblklist[1]; *blkp++ = lblkno(fs, fs->fs_sblockloc); @@ -707,7 +707,7 @@ out1: /* * Allocate space for the full list of preallocated snapshot blocks. */ - MALLOC(snapblklist, daddr_t *, snaplistsize * sizeof(daddr_t), + snapblklist = malloc(snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); ip->i_snapblklist = &snapblklist[1]; /* @@ -721,7 +721,7 @@ out1: error = expunge_ufs2(vp, ip, copy_fs, mapacct_ufs2, BLK_SNAP); if (error) { fs->fs_snapinum[snaploc] = 0; - FREE(snapblklist, M_UFSMNT); + free(snapblklist, M_UFSMNT); goto done; } if (snaplistsize < ip->i_snapblklist - snapblklist) @@ -743,7 +743,7 @@ out1: auio.uio_td = td; if ((error = VOP_WRITE(vp, &auio, IO_UNIT, td->td_ucred)) != 0) { fs->fs_snapinum[snaploc] = 0; - FREE(snapblklist, M_UFSMNT); + free(snapblklist, M_UFSMNT); goto done; } /* @@ -758,7 +758,7 @@ out1: if (error) { brelse(nbp); fs->fs_snapinum[snaploc] = 0; - FREE(snapblklist, M_UFSMNT); + free(snapblklist, M_UFSMNT); goto done; } bcopy(space, nbp->b_data, fs->fs_bsize); @@ -775,7 +775,7 @@ out1: sn->sn_listsize = snaplistsize; VI_UNLOCK(devvp); if (space != NULL) - FREE(space, M_UFSMNT); + free(space, M_UFSMNT); /* * If another process is currently writing the buffer containing * the inode for this snapshot then a deadlock can occur. Drop @@ -793,7 +793,7 @@ out1: else vrele(vp); /* Drop extra reference */ done: - FREE(copy_fs->fs_csp, M_UFSMNT); + free(copy_fs->fs_csp, M_UFSMNT); bawrite(sbp); out: NDFREE(&nd, NDF_ONLY_PNBUF); @@ -807,7 +807,7 @@ out: } UFS_LOCK(ump); if (fs->fs_active != 0) { - FREE(fs->fs_active, M_DEVBUF); + free(fs->fs_active, M_DEVBUF); fs->fs_active = 0; } UFS_UNLOCK(ump); @@ -1090,7 +1090,7 @@ indiracct_ufs1(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, last = howmany(remblks, blksperindir); if (last > NINDIR(fs)) last = NINDIR(fs); - MALLOC(bap, ufs1_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK); + bap = malloc(fs->fs_bsize, M_DEVBUF, M_WAITOK); bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize); bqrelse(bp); error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs, @@ -1112,7 +1112,7 @@ indiracct_ufs1(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, remblks -= blksperindir; } out: - FREE(bap, M_DEVBUF); + free(bap, M_DEVBUF); return (error); } @@ -1370,7 +1370,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, last = howmany(remblks, blksperindir); if (last > NINDIR(fs)) last = NINDIR(fs); - MALLOC(bap, ufs2_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK); + bap = malloc(fs->fs_bsize, M_DEVBUF, M_WAITOK); bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize); bqrelse(bp); error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs, @@ -1392,7 +1392,7 @@ indiracct_ufs2(snapvp, cancelvp, level, blkno, lbn, rlbn, remblks, remblks -= blksperindir; } out: - FREE(bap, M_DEVBUF); + free(bap, M_DEVBUF); return (error); } @@ -1979,7 +1979,7 @@ ffs_snapshot_mount(mp) VOP_UNLOCK(vp, 0); return; } - MALLOC(snapblklist, void *, snaplistsize * sizeof(daddr_t), + snapblklist = malloc(snaplistsize * sizeof(daddr_t), M_UFSMNT, M_WAITOK); auio.uio_iovcnt = 1; aiov.iov_base = snapblklist; @@ -1989,7 +1989,7 @@ ffs_snapshot_mount(mp) if ((error = VOP_READ(vp, &auio, IO_UNIT, td->td_ucred)) != 0) { printf("ffs_snapshot_mount: read_2 failed %d\n", error); VOP_UNLOCK(vp, 0); - FREE(snapblklist, M_UFSMNT); + free(snapblklist, M_UFSMNT); return; } VOP_UNLOCK(vp, 0); @@ -2525,7 +2525,7 @@ try_free_snapdata(struct vnode *devvp) sn->sn_listsize = 0; lockmgr(&sn->sn_lock, LK_RELEASE, NULL); if (snapblklist != NULL) - FREE(snapblklist, M_UFSMNT); + free(snapblklist, M_UFSMNT); ffs_snapdata_free(sn); } diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 3c9a906..460c1df 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -630,7 +630,7 @@ workitem_free(item, type) ump = VFSTOUFS(item->wk_mp); if (--ump->softdep_deps == 0 && ump->softdep_req) wakeup(&ump->softdep_deps); - FREE(item, DtoM(type)); + free(item, DtoM(type)); } static void @@ -1216,7 +1216,7 @@ pagedep_lookup(ip, lbn, flags, pagedeppp) if (*pagedeppp || (flags & DEPALLOC) == 0) return (ret); FREE_LOCK(&lk); - MALLOC(pagedep, struct pagedep *, sizeof(struct pagedep), + pagedep = malloc(sizeof(struct pagedep), M_PAGEDEP, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&pagedep->pd_list, D_PAGEDEP, mp); ACQUIRE_LOCK(&lk); @@ -1296,7 +1296,7 @@ inodedep_lookup(mp, inum, flags, inodedeppp) if (num_inodedep > max_softdeps && (flags & NODELAY) == 0) request_cleanup(mp, FLUSH_INODES); FREE_LOCK(&lk); - MALLOC(inodedep, struct inodedep *, sizeof(struct inodedep), + inodedep = malloc(sizeof(struct inodedep), M_INODEDEP, M_SOFTDEP_FLAGS); workitem_alloc(&inodedep->id_list, D_INODEDEP, mp); ACQUIRE_LOCK(&lk); @@ -1374,11 +1374,11 @@ newblk_lookup(fs, newblkno, flags, newblkpp) if ((flags & DEPALLOC) == 0) return (0); FREE_LOCK(&lk); - MALLOC(newblk, struct newblk *, sizeof(struct newblk), + newblk = malloc(sizeof(struct newblk), M_NEWBLK, M_SOFTDEP_FLAGS); ACQUIRE_LOCK(&lk); if (newblk_find(newblkhd, fs, newblkno, newblkpp)) { - FREE(newblk, M_NEWBLK); + free(newblk, M_NEWBLK); return (1); } newblk->nb_state = 0; @@ -1600,7 +1600,7 @@ bmsafemap_lookup(mp, bp) if (wk->wk_type == D_BMSAFEMAP) return (WK_BMSAFEMAP(wk)); FREE_LOCK(&lk); - MALLOC(bmsafemap, struct bmsafemap *, sizeof(struct bmsafemap), + bmsafemap = malloc(sizeof(struct bmsafemap), M_BMSAFEMAP, M_SOFTDEP_FLAGS); workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); bmsafemap->sm_buf = bp; @@ -1661,7 +1661,7 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) struct mount *mp; mp = UFSTOVFS(ip->i_ump); - MALLOC(adp, struct allocdirect *, sizeof(struct allocdirect), + adp = malloc(sizeof(struct allocdirect), M_ALLOCDIRECT, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&adp->ad_list, D_ALLOCDIRECT, mp); adp->ad_lbn = lbn; @@ -1705,7 +1705,7 @@ softdep_setup_allocdirect(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) LIST_INSERT_HEAD(&bmsafemap->sm_allocdirecthd, adp, ad_deps); } LIST_REMOVE(newblk, nb_hash); - FREE(newblk, M_NEWBLK); + free(newblk, M_NEWBLK); inodedep_lookup(mp, ip->i_number, DEPALLOC | NODELAY, &inodedep); adp->ad_inodedep = inodedep; @@ -1822,7 +1822,7 @@ newfreefrag(ip, blkno, size) fs = ip->i_fs; if (fragnum(fs, blkno) + numfrags(fs, size) > fs->fs_frag) panic("newfreefrag: frag size"); - MALLOC(freefrag, struct freefrag *, sizeof(struct freefrag), + freefrag = malloc(sizeof(struct freefrag), M_FREEFRAG, M_SOFTDEP_FLAGS); workitem_alloc(&freefrag->ff_list, D_FREEFRAG, UFSTOVFS(ip->i_ump)); freefrag->ff_inum = ip->i_number; @@ -1871,7 +1871,7 @@ softdep_setup_allocext(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) struct mount *mp; mp = UFSTOVFS(ip->i_ump); - MALLOC(adp, struct allocdirect *, sizeof(struct allocdirect), + adp = malloc(sizeof(struct allocdirect), M_ALLOCDIRECT, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&adp->ad_list, D_ALLOCDIRECT, mp); adp->ad_lbn = lbn; @@ -1903,7 +1903,7 @@ softdep_setup_allocext(ip, lbn, newblkno, oldblkno, newsize, oldsize, bp) LIST_INSERT_HEAD(&bmsafemap->sm_allocdirecthd, adp, ad_deps); } LIST_REMOVE(newblk, nb_hash); - FREE(newblk, M_NEWBLK); + free(newblk, M_NEWBLK); WORKLIST_INSERT(&bp->b_dep, &adp->ad_list); if (lbn >= NXADDR) @@ -1981,7 +1981,7 @@ newallocindir(ip, ptrno, newblkno, oldblkno) { struct allocindir *aip; - MALLOC(aip, struct allocindir *, sizeof(struct allocindir), + aip = malloc(sizeof(struct allocindir), M_ALLOCINDIR, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&aip->ai_list, D_ALLOCINDIR, UFSTOVFS(ip->i_ump)); aip->ai_state = ATTACHED; @@ -2095,7 +2095,7 @@ setup_allocindir_phase2(bp, ip, aip) aip, ai_deps); } LIST_REMOVE(newblk, nb_hash); - FREE(newblk, M_NEWBLK); + free(newblk, M_NEWBLK); aip->ai_indirdep = indirdep; /* * Check to see if there is an existing dependency @@ -2144,7 +2144,7 @@ setup_allocindir_phase2(bp, ip, aip) ACQUIRE_LOCK(&lk); break; } - MALLOC(newindirdep, struct indirdep *, sizeof(struct indirdep), + newindirdep = malloc(sizeof(struct indirdep), M_INDIRDEP, M_SOFTDEP_FLAGS); workitem_alloc(&newindirdep->ir_list, D_INDIRDEP, UFSTOVFS(ip->i_ump)); @@ -2216,7 +2216,7 @@ softdep_setup_freeblocks(ip, length, flags) mp = UFSTOVFS(ip->i_ump); if (length != 0) panic("softdep_setup_freeblocks: non-zero length"); - MALLOC(freeblks, struct freeblks *, sizeof(struct freeblks), + freeblks = malloc(sizeof(struct freeblks), M_FREEBLKS, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&freeblks->fb_list, D_FREEBLKS, mp); freeblks->fb_state = ATTACHED; @@ -2597,7 +2597,7 @@ softdep_freefile(pvp, ino, mode) /* * This sets up the inode de-allocation dependency. */ - MALLOC(freefile, struct freefile *, sizeof(struct freefile), + freefile = malloc(sizeof(struct freefile), M_FREEFILE, M_SOFTDEP_FLAGS); workitem_alloc(&freefile->fx_list, D_FREEFILE, pvp->v_mount); freefile->fx_mode = mode; @@ -2674,7 +2674,7 @@ check_inode_unwritten(inodedep) if (inodedep->id_state & ONWORKLIST) WORKLIST_REMOVE(&inodedep->id_list); if (inodedep->id_savedino1 != NULL) { - FREE(inodedep->id_savedino1, M_SAVEDINO); + free(inodedep->id_savedino1, M_SAVEDINO); inodedep->id_savedino1 = NULL; } if (free_inodedep(inodedep) == 0) @@ -3011,14 +3011,14 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk) fs = dp->i_fs; lbn = lblkno(fs, diroffset); offset = blkoff(fs, diroffset); - MALLOC(dap, struct diradd *, sizeof(struct diradd), M_DIRADD, + dap = malloc(sizeof(struct diradd), M_DIRADD, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&dap->da_list, D_DIRADD, mp); dap->da_offset = offset; dap->da_newinum = newinum; dap->da_state = ATTACHED; if (isnewblk && lbn < NDADDR && fragoff(fs, diroffset) == 0) { - MALLOC(newdirblk, struct newdirblk *, sizeof(struct newdirblk), + newdirblk = malloc(sizeof(struct newdirblk), M_NEWDIRBLK, M_SOFTDEP_FLAGS); workitem_alloc(&newdirblk->db_list, D_NEWDIRBLK, mp); } @@ -3027,12 +3027,12 @@ softdep_setup_directory_add(bp, dp, diroffset, newinum, newdirbp, isnewblk) ACQUIRE_LOCK(&lk); } else { dap->da_state |= MKDIR_BODY | MKDIR_PARENT; - MALLOC(mkdir1, struct mkdir *, sizeof(struct mkdir), M_MKDIR, + mkdir1 = malloc(sizeof(struct mkdir), M_MKDIR, M_SOFTDEP_FLAGS); workitem_alloc(&mkdir1->md_list, D_MKDIR, mp); mkdir1->md_state = MKDIR_BODY; mkdir1->md_diradd = dap; - MALLOC(mkdir2, struct mkdir *, sizeof(struct mkdir), M_MKDIR, + mkdir2 = malloc(sizeof(struct mkdir), M_MKDIR, M_SOFTDEP_FLAGS); workitem_alloc(&mkdir2->md_list, D_MKDIR, mp); mkdir2->md_state = MKDIR_PARENT; @@ -3313,7 +3313,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirremp) (void) request_cleanup(ITOV(dp)->v_mount, FLUSH_REMOVE); num_dirrem += 1; FREE_LOCK(&lk); - MALLOC(dirrem, struct dirrem *, sizeof(struct dirrem), + dirrem = malloc(sizeof(struct dirrem), M_DIRREM, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&dirrem->dm_list, D_DIRREM, ITOV(dp)->v_mount); dirrem->dm_state = isrmdir ? RMDIR : 0; @@ -3410,7 +3410,7 @@ softdep_setup_directory_change(bp, dp, ip, newinum, isrmdir) * Whiteouts do not need diradd dependencies. */ if (newinum != WINO) { - MALLOC(dap, struct diradd *, sizeof(struct diradd), + dap = malloc(sizeof(struct diradd), M_DIRADD, M_SOFTDEP_FLAGS|M_ZERO); workitem_alloc(&dap->da_list, D_DIRADD, mp); dap->da_state = DIRCHG | ATTACHED | DEPCOMPLETE; @@ -3812,7 +3812,7 @@ softdep_disk_io_initiation(bp) * Replace up-to-date version with safe version. */ FREE_LOCK(&lk); - MALLOC(indirdep->ir_saveddata, caddr_t, bp->b_bcount, + indirdep->ir_saveddata = malloc(bp->b_bcount, M_INDIRDEP, M_SOFTDEP_FLAGS); ACQUIRE_LOCK(&lk); indirdep->ir_state &= ~ATTACHED; @@ -3920,8 +3920,7 @@ initiate_write_inodeblock_ufs1(inodedep, bp) if (inodedep->id_savedino1 != NULL) panic("initiate_write_inodeblock_ufs1: I/O underway"); FREE_LOCK(&lk); - MALLOC(sip, struct ufs1_dinode *, - sizeof(struct ufs1_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS); + sip = malloc( sizeof(struct ufs1_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS); ACQUIRE_LOCK(&lk); inodedep->id_savedino1 = sip; *inodedep->id_savedino1 = *dp; @@ -4066,8 +4065,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp) if (inodedep->id_savedino2 != NULL) panic("initiate_write_inodeblock_ufs2: I/O underway"); FREE_LOCK(&lk); - MALLOC(sip, struct ufs2_dinode *, - sizeof(struct ufs2_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS); + sip = malloc( sizeof(struct ufs2_dinode), M_SAVEDINO, M_SOFTDEP_FLAGS); ACQUIRE_LOCK(&lk); inodedep->id_savedino2 = sip; *inodedep->id_savedino2 = *dp; @@ -4335,7 +4333,7 @@ softdep_disk_write_complete(bp) if (indirdep->ir_state & GOINGAWAY) panic("disk_write_complete: indirdep gone"); bcopy(indirdep->ir_saveddata, bp->b_data, bp->b_bcount); - FREE(indirdep->ir_saveddata, M_INDIRDEP); + free(indirdep->ir_saveddata, M_INDIRDEP); indirdep->ir_saveddata = 0; indirdep->ir_state &= ~UNDONE; indirdep->ir_state |= ATTACHED; @@ -4522,7 +4520,7 @@ handle_written_inodeblock(inodedep, bp) *dp1 = *inodedep->id_savedino1; else *dp2 = *inodedep->id_savedino2; - FREE(inodedep->id_savedino1, M_SAVEDINO); + free(inodedep->id_savedino1, M_SAVEDINO); inodedep->id_savedino1 = NULL; if ((bp->b_flags & B_DELWRI) == 0) stat_inode_bitmap++; diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 483ad33..6e66c88 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1404,7 +1404,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) fs = ump->um_fs; /* - * If this MALLOC() is performed after the getnewvnode() + * If this malloc() is performed after the getnewvnode() * it might block, leaving a vnode with a NULL v_data to be * found by ffs_sync() if a sync happens to fire right then, * which will cause a panic because ffs_sync() blindly |