Deleted Added
full compact
ffs_inode.c (170174) ffs_inode.c (173464)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ffs_inode.c 8.13 (Berkeley) 4/21/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_inode.c 170174 2007-06-01 01:12:45Z jeff $");
33__FBSDID("$FreeBSD: head/sys/ufs/ffs/ffs_inode.c 173464 2007-11-08 17:21:51Z obrien $");
34
35#include "opt_quota.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/mount.h>
40#include <sys/proc.h>
41#include <sys/bio.h>

--- 179 unchanged lines hidden (view full) ---

221 }
222 if ((flags & IO_NORMAL) == 0)
223 return (0);
224 if (length > fs->fs_maxfilesize)
225 return (EFBIG);
226 if (vp->v_type == VLNK &&
227 (ip->i_size < vp->v_mount->mnt_maxsymlinklen ||
228 datablocks == 0)) {
34
35#include "opt_quota.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/mount.h>
40#include <sys/proc.h>
41#include <sys/bio.h>

--- 179 unchanged lines hidden (view full) ---

221 }
222 if ((flags & IO_NORMAL) == 0)
223 return (0);
224 if (length > fs->fs_maxfilesize)
225 return (EFBIG);
226 if (vp->v_type == VLNK &&
227 (ip->i_size < vp->v_mount->mnt_maxsymlinklen ||
228 datablocks == 0)) {
229#ifdef DIAGNOSTIC
229#ifdef INVARIANTS
230 if (length != 0)
231 panic("ffs_truncate: partial truncate of symlink");
232#endif
233 bzero(SHORTLINK(ip), (u_int)ip->i_size);
234 ip->i_size = 0;
235 DIP_SET(ip, i_size, 0);
236 ip->i_flag |= IN_CHANGE | IN_UPDATE;
237 if (needextclean)

--- 236 unchanged lines hidden (view full) ---

474 */
475 bn += numfrags(fs, newspace);
476 ffs_blkfree(ump, fs, ip->i_devvp, bn,
477 oldspace - newspace, ip->i_number);
478 blocksreleased += btodb(oldspace - newspace);
479 }
480 }
481done:
230 if (length != 0)
231 panic("ffs_truncate: partial truncate of symlink");
232#endif
233 bzero(SHORTLINK(ip), (u_int)ip->i_size);
234 ip->i_size = 0;
235 DIP_SET(ip, i_size, 0);
236 ip->i_flag |= IN_CHANGE | IN_UPDATE;
237 if (needextclean)

--- 236 unchanged lines hidden (view full) ---

474 */
475 bn += numfrags(fs, newspace);
476 ffs_blkfree(ump, fs, ip->i_devvp, bn,
477 oldspace - newspace, ip->i_number);
478 blocksreleased += btodb(oldspace - newspace);
479 }
480 }
481done:
482#ifdef DIAGNOSTIC
482#ifdef INVARIANTS
483 for (level = SINGLE; level <= TRIPLE; level++)
484 if (newblks[NDADDR + level] != DIP(ip, i_ib[level]))
485 panic("ffs_truncate1");
486 for (i = 0; i < NDADDR; i++)
487 if (newblks[i] != DIP(ip, i_db[i]))
488 panic("ffs_truncate2");
489 VI_LOCK(vp);
490 if (length == 0 &&
491 (fs->fs_magic != FS_UFS2_MAGIC || ip->i_din2->di_extsize == 0) &&
492 (vp->v_bufobj.bo_dirty.bv_cnt > 0 ||
493 vp->v_bufobj.bo_clean.bv_cnt > 0))
494 panic("ffs_truncate3");
495 VI_UNLOCK(vp);
483 for (level = SINGLE; level <= TRIPLE; level++)
484 if (newblks[NDADDR + level] != DIP(ip, i_ib[level]))
485 panic("ffs_truncate1");
486 for (i = 0; i < NDADDR; i++)
487 if (newblks[i] != DIP(ip, i_db[i]))
488 panic("ffs_truncate2");
489 VI_LOCK(vp);
490 if (length == 0 &&
491 (fs->fs_magic != FS_UFS2_MAGIC || ip->i_din2->di_extsize == 0) &&
492 (vp->v_bufobj.bo_dirty.bv_cnt > 0 ||
493 vp->v_bufobj.bo_clean.bv_cnt > 0))
494 panic("ffs_truncate3");
495 VI_UNLOCK(vp);
496#endif /* DIAGNOSTIC */
496#endif /* INVARIANTS */
497 /*
498 * Put back the real size.
499 */
500 ip->i_size = length;
501 DIP_SET(ip, i_size, length);
502 DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased);
503
504 if (DIP(ip, i_blocks) < 0) /* sanity */

--- 143 unchanged lines hidden ---
497 /*
498 * Put back the real size.
499 */
500 ip->i_size = length;
501 DIP_SET(ip, i_size, length);
502 DIP_SET(ip, i_blocks, DIP(ip, i_blocks) - blocksreleased);
503
504 if (DIP(ip, i_blocks) < 0) /* sanity */

--- 143 unchanged lines hidden ---