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