Lines Matching refs:ip

97 static void ufs_undo_allocation(inode_t *ip, int block_count,
205 bmap_read(struct inode *ip, u_offset_t off, daddr_t *bnp, int *lenp) in bmap_read() argument
208 ufsvfs_t *ufsvfsp = ip->i_ufsvfs; in bmap_read()
217 ASSERT(RW_LOCK_HELD(&ip->i_contents)); in bmap_read()
228 ip->i_size, &ip->i_db[lbn], NDADDR - lbn, 1, in bmap_read()
255 nb = ip->i_ib[NIADDR - j]; in bmap_read()
267 ip->i_dev, fsbtodb(fs, ob), fs->fs_bsize); in bmap_read()
274 ASSERT(!ufs_indir_badblock(ip, bap)); in bmap_read()
287 DOEXTENT(fs, lbn, boff, bnp, lenp, ip->i_size, &bap[i], in bmap_read()
288 MIN(NINDIR(fs) - i, (daddr_t)lblkno(fs, ip->i_size - 1) - lbn + 1), in bmap_read()
308 bmap_write(struct inode *ip, u_offset_t off, int size, in bmap_write() argument
319 struct vnode *vp = ITOV(ip); in bmap_write()
334 ASSERT(RW_WRITE_HELD(&ip->i_contents)); in bmap_write()
339 ufsvfsp = ip->i_ufsvfs; in bmap_write()
344 if (ip->i_blocks >= VERYLARGEFILESIZE) in bmap_write()
346 llbn = (daddr_t)((ip->i_size) ? lblkno(fs, ip->i_size - 1) : 0); in bmap_write()
348 if (((ip->i_mode & IFMT) == IFDIR) || in bmap_write()
349 ((ip->i_mode & IFMT) == IFATTRDIR)) in bmap_write()
351 else if ((ip->i_mode & IFMT) == IFSHAD) in bmap_write()
353 else if (ip->i_ufsvfs->vfs_qinod == ip) in bmap_write()
356 issync = ((ip->i_flag & ISYNC) != 0); in bmap_write()
367 if (llbn < NDADDR && llbn < lbn && (ob = ip->i_db[llbn]) != 0) { in bmap_write()
368 osize = blksize(fs, ip, llbn); in bmap_write()
376 if (((unsigned)ip->i_blocks + in bmap_write()
393 fbread(ITOV(ip), ((offset_t)llbn << fs->fs_bshift), in bmap_write()
397 pref = blkpref(ip, llbn, (int)llbn, &ip->i_db[0]); in bmap_write()
398 err = realloccg(ip, ob, pref, (int)osize, (int)bsize, in bmap_write()
405 ASSERT(!ufs_badblock(ip, nb)); in bmap_write()
413 TRANS_MATA_ALLOC(ufsvfsp, ip, nb, bsize, 0); in bmap_write()
414 ip->i_db[llbn] = nb; in bmap_write()
416 ip); in bmap_write()
417 ip->i_blocks += btodb(bsize - osize); in bmap_write()
418 ASSERT((unsigned)ip->i_blocks <= INT_MAX); in bmap_write()
419 TRANS_INODE(ufsvfsp, ip); in bmap_write()
420 ip->i_flag |= IUPD | ICHG | IATTCHG; in bmap_write()
428 (void) ufs_fbiwrite(fbp, ip, nb, fs->fs_fsize); in bmap_write()
435 (void) free(ip, ob, (off_t)osize, metaflag); in bmap_write()
444 nb = ip->i_db[lbn]; in bmap_write()
446 ip->i_size < ((u_offset_t)(lbn + 1)) << fs->fs_bshift) { in bmap_write()
449 osize = fragroundup(fs, blkoff(fs, ip->i_size)); in bmap_write()
459 if (((unsigned)ip->i_blocks + in bmap_write()
468 pref = blkpref(ip, lbn, (int)lbn, in bmap_write()
469 &ip->i_db[0]); in bmap_write()
470 err = realloccg(ip, ob, pref, (int)osize, in bmap_write()
476 ASSERT(!ufs_badblock(ip, nb)); in bmap_write()
483 if (ip->i_size < in bmap_write()
494 if (((unsigned)ip->i_blocks + in bmap_write()
499 pref = blkpref(ip, lbn, (int)lbn, &ip->i_db[0]); in bmap_write()
500 err = alloc(ip, pref, (int)nsize, &nb, cr); in bmap_write()
505 ASSERT(!ufs_badblock(ip, nb)); in bmap_write()
526 fbzero(ITOV(ip), in bmap_write()
536 (void) free(ip, nb, in bmap_write()
539 (void) free(ip, in bmap_write()
545 (void) chkdq(ip, in bmap_write()
552 TRANS_MATA_ALLOC(ufsvfsp, ip, nb, nsize, 0); in bmap_write()
553 ip->i_db[lbn] = nb; in bmap_write()
554 ip->i_blocks += btodb(nsize - osize); in bmap_write()
555 ASSERT((unsigned)ip->i_blocks <= INT_MAX); in bmap_write()
556 TRANS_INODE(ufsvfsp, ip); in bmap_write()
557 ip->i_flag |= IUPD | ICHG | IATTCHG; in bmap_write()
567 if (isdirquota && (ip->i_size || in bmap_write()
573 (void) ufs_fbiwrite(fbp, ip, nb, fs->fs_fsize); in bmap_write()
579 (void) free(ip, ob, (off_t)osize, metaflag); in bmap_write()
590 nindirshift = ip->i_ufsvfs->vfs_nindirshift; in bmap_write()
591 nindiroffset = ip->i_ufsvfs->vfs_nindiroffset; in bmap_write()
611 dev = ip->i_dev; in bmap_write()
612 nb = ip->i_ib[NIADDR - j]; in bmap_write()
620 if (((unsigned)ip->i_blocks + btodb(bsize)) in bmap_write()
628 pref = blkpref(ip, lbn, 0, (daddr32_t *)0); in bmap_write()
629 err = alloc(ip, pref, (int)bsize, &nb, cr); in bmap_write()
632 TRANS_MATA_ALLOC(ufsvfsp, ip, nb, bsize, 1); in bmap_write()
633 ASSERT(!ufs_badblock(ip, nb)); in bmap_write()
662 ufs_undo_allocation(ip, alloced_blocks, in bmap_write()
668 ip->i_ib[NIADDR - j] = nb; in bmap_write()
670 ip->i_blocks += btodb(bsize); in bmap_write()
671 ASSERT((unsigned)ip->i_blocks <= INT_MAX); in bmap_write()
672 TRANS_INODE(ufsvfsp, ip); in bmap_write()
673 ip->i_flag |= IUPD | ICHG | IATTCHG; in bmap_write()
696 bp = UFS_BREAD(ufsvfsp, ip->i_dev, fsbtodb(fs, ob), bsize); in bmap_write()
711 ufs_undo_allocation(ip, alloced_blocks, in bmap_write()
727 if (((unsigned)ip->i_blocks + btodb(bsize)) in bmap_write()
730 ufs_undo_allocation(ip, alloced_blocks, in bmap_write()
738 pref = blkpref(ip, lbn, 0, in bmap_write()
742 pref = blkpref(ip, lbn, i, &bap[0]); in bmap_write()
751 err = alloc(ip, pref, (int)bsize, &nb, cr); in bmap_write()
756 ufs_undo_allocation(ip, alloced_blocks, in bmap_write()
761 ASSERT(!ufs_badblock(ip, nb)); in bmap_write()
776 TRANS_MATA_ALLOC(ufsvfsp, ip, nb, bsize, 1); in bmap_write()
795 ufs_undo_allocation(ip, in bmap_write()
804 TRANS_MATA_ALLOC(ufsvfsp, ip, nb, bsize, 0); in bmap_write()
805 fbzero(ITOV(ip), in bmap_write()
837 (void) ufs_fbiwrite(fbp, ip, nb, in bmap_write()
847 ip->i_dev, fsbtodb(fs, ob), bsize); in bmap_write()
854 ufs_undo_allocation(ip, in bmap_write()
874 ip->i_blocks += btodb(bsize); in bmap_write()
875 ASSERT((unsigned)ip->i_blocks <= INT_MAX); in bmap_write()
876 TRANS_INODE(ufsvfsp, ip); in bmap_write()
877 ip->i_flag |= IUPD | ICHG | IATTCHG; in bmap_write()
895 ufs_undo_allocation(ip, in bmap_write()
916 bmap_has_holes(struct inode *ip) in bmap_has_holes() argument
918 struct fs *fs = ip->i_fs; in bmap_has_holes()
935 if (ip->i_writer != NULL && ip->i_writer != curthread) { in bmap_has_holes()
939 dblks = (ip->i_size + fsboffset) >> fsbshift; in bmap_has_holes()
940 mblks = (ldbtob((u_offset_t)ip->i_blocks) + fsboffset) >> fsbshift; in bmap_has_holes()
947 nindirshift = ip->i_ufsvfs->vfs_nindirshift; in bmap_has_holes()
949 nindiroffset = ip->i_ufsvfs->vfs_nindiroffset; in bmap_has_holes()
1044 inode_t *ip, in ufs_undo_allocation() argument
1057 ufsvfsp = ip->i_ufsvfs; in ufs_undo_allocation()
1074 ip->i_db[table[i].owner_offset] = 0; in ufs_undo_allocation()
1079 ip->i_ib[table[i].owner_offset] = 0; in ufs_undo_allocation()
1089 (VBSIZE(ITOV(ip)) / sizeof (daddr32_t))); in ufs_undo_allocation()
1091 bp = UFS_BREAD(ufsvfsp, ip->i_dev, in ufs_undo_allocation()
1093 VBSIZE(ITOV(ip))); in ufs_undo_allocation()
1132 (void) ufs_fault(ITOV(ip), in ufs_undo_allocation()
1150 ip->i_blocks -= inode_sector_adjust; in ufs_undo_allocation()
1151 ASSERT((unsigned)ip->i_blocks <= INT_MAX); in ufs_undo_allocation()
1152 TRANS_INODE(ufsvfsp, ip); in ufs_undo_allocation()
1153 ip->i_flag |= IUPD | ICHG | IATTCHG; in ufs_undo_allocation()
1154 ip->i_seq++; in ufs_undo_allocation()
1156 ufs_iupdat(ip, I_SYNC); in ufs_undo_allocation()
1166 free(ip, table[i].this_block, table[i].block_size, in ufs_undo_allocation()
1181 bmap_find(struct inode *ip, boolean_t hole, u_offset_t *off) in bmap_find() argument
1183 ufsvfs_t *ufsvfsp = ip->i_ufsvfs; in bmap_find()
1191 u_offset_t isz = (offset_t)ip->i_size; in bmap_find()
1199 ASSERT(RW_LOCK_HELD(&ip->i_contents)); in bmap_find()
1211 if ((hole && (ip->i_db[lbn] == 0)) || in bmap_find()
1212 (!hole && (ip->i_db[lbn] != 0))) { in bmap_find()
1223 dev = ip->i_dev; in bmap_find()
1253 nb = ip->i_ib[NIADDR - j]; in bmap_find()
1333 struct inode *ip; in bmap_set_bn() local
1344 ip = VTOI(vp); in bmap_set_bn()
1345 ufsvfsp = ip->i_ufsvfs; in bmap_set_bn()
1349 ASSERT(RW_LOCK_HELD(&ip->i_contents)); in bmap_set_bn()
1358 ip->i_db[lbn] = bn; in bmap_set_bn()
1362 nindirshift = ip->i_ufsvfs->vfs_nindirshift; in bmap_set_bn()
1363 nindiroffset = ip->i_ufsvfs->vfs_nindiroffset; in bmap_set_bn()
1384 nb = ip->i_ib[NIADDR - j]; in bmap_set_bn()
1386 err = ufs_fault(ITOV(ip), "ufs_set_bn: nb == UFS_HOLE"); in bmap_set_bn()
1396 ip->i_dev, fsbtodb(fs, ob), fs->fs_bsize); in bmap_set_bn()
1404 ASSERT(!ufs_indir_badblock(ip, bap)); in bmap_set_bn()
1411 err = ufs_fault(ITOV(ip), "ufs_set_bn: nb == UFS_HOLE"); in bmap_set_bn()