1/*-
2 * modified for Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * Copyright (c) 1982, 1986, 1989, 1993
--- 19 unchanged lines hidden (view full) ---
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
36 * $FreeBSD: head/sys/fs/ext2fs/ext2_inode.c 245820 2013-01-22 18:54:03Z pfg $
37 */
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/mount.h>
42#include <sys/bio.h>
43#include <sys/buf.h>
44#include <sys/vnode.h>
--- 69 unchanged lines hidden (view full) ---
114 int flags;
115 struct ucred *cred;
116 struct thread *td;
117{
118 struct vnode *ovp = vp;
119 int32_t lastblock;
120 struct inode *oip;
121 int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
122 uint32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
123 struct bufobj *bo;
124 struct m_ext2fs *fs;
125 struct buf *bp;
126 int offset, size, level;
127 long count, nblocks, blocksreleased = 0;
128 int error, i, allerror;
129 off_t osize;
130
--- 206 unchanged lines hidden (view full) ---
337 panic("itrunc3");
338 BO_UNLOCK(bo);
339#endif /* DIAGNOSTIC */
340 /*
341 * Put back the real size.
342 */
343 oip->i_size = length;
344 oip->i_blocks -= blocksreleased;
345 if (oip->i_blocks > blocksreleased)
346 oip->i_blocks -= blocksreleased;
347 else /* sanity */
348 oip->i_blocks = 0;
349 oip->i_flag |= IN_CHANGE;
350 vnode_pager_setsize(ovp, length);
351 return (allerror);
352}
353
354/*
355 * Release blocks associated with the inode ip and stored in the indirect
--- 178 unchanged lines hidden ---
2 * modified for Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * Copyright (c) 1982, 1986, 1989, 1993
--- 19 unchanged lines hidden (view full) ---
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 *
35 * @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
36 * $FreeBSD: head/sys/fs/ext2fs/ext2_inode.c 245820 2013-01-22 18:54:03Z pfg $
37 */
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/mount.h>
42#include <sys/bio.h>
43#include <sys/buf.h>
44#include <sys/vnode.h>
--- 69 unchanged lines hidden (view full) ---
114 int flags;
115 struct ucred *cred;
116 struct thread *td;
117{
118 struct vnode *ovp = vp;
119 int32_t lastblock;
120 struct inode *oip;
121 int32_t bn, lbn, lastiblock[NIADDR], indir_lbn[NIADDR];
122 uint32_t oldblks[NDADDR + NIADDR], newblks[NDADDR + NIADDR];
123 struct bufobj *bo;
124 struct m_ext2fs *fs;
125 struct buf *bp;
126 int offset, size, level;
127 long count, nblocks, blocksreleased = 0;
128 int error, i, allerror;
129 off_t osize;
130
--- 206 unchanged lines hidden (view full) ---
337 panic("itrunc3");
338 BO_UNLOCK(bo);
339#endif /* DIAGNOSTIC */
340 /*
341 * Put back the real size.
342 */
343 oip->i_size = length;
344 oip->i_blocks -= blocksreleased;
345 if (oip->i_blocks > blocksreleased)
346 oip->i_blocks -= blocksreleased;
347 else /* sanity */
348 oip->i_blocks = 0;
349 oip->i_flag |= IN_CHANGE;
350 vnode_pager_setsize(ovp, length);
351 return (allerror);
352}
353
354/*
355 * Release blocks associated with the inode ip and stored in the indirect
--- 178 unchanged lines hidden ---