aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ufs/ffs/ffs_inode.c')
-rw-r--r--sys/ufs/ffs/ffs_inode.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 0b4172b34300..3df7bf8e8596 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -34,6 +34,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_ufs.h"
#include "opt_quota.h"
#include <sys/param.h>
@@ -59,6 +60,10 @@ __FBSDID("$FreeBSD$");
#include <ufs/ufs/quota.h>
#include <ufs/ufs/ufsmount.h>
#include <ufs/ufs/inode.h>
+#include <ufs/ufs/dir.h>
+#ifdef UFS_DIRHASH
+#include <ufs/ufs/dirhash.h>
+#endif
#include <ufs/ufs/ufs_extern.h>
#include <ufs/ffs/fs.h>
@@ -456,6 +461,10 @@ ffs_truncate(vp, length, flags, cred)
ip->i_size = length;
DIP_SET(ip, i_size, length);
UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE);
+#ifdef UFS_DIRHASH
+ if (vp->v_type == VDIR && ip->i_dirhash != NULL)
+ ufsdirhash_dirtrunc(ip, length);
+#endif
} else {
lbn = lblkno(fs, length);
flags |= BA_CLRBUF;
@@ -482,6 +491,10 @@ ffs_truncate(vp, length, flags, cred)
return (error);
ip->i_size = length;
DIP_SET(ip, i_size, length);
+#ifdef UFS_DIRHASH
+ if (vp->v_type == VDIR && ip->i_dirhash != NULL)
+ ufsdirhash_dirtrunc(ip, length);
+#endif
size = blksize(fs, ip, lbn);
if (vp->v_type != VDIR && offset != 0)
bzero((char *)bp->b_data + offset,