Page MenuHomeFreeBSD

D43978.diff
No OneTemporary

D43978.diff

diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h
--- a/sys/fs/msdosfs/denode.h
+++ b/sys/fs/msdosfs/denode.h
@@ -162,7 +162,7 @@
u_long de_FileSize; /* size of file in bytes */
struct fatcache de_fc[FC_SIZE]; /* FAT cache */
u_quad_t de_modrev; /* Revision level for lease. */
- uint64_t de_inode; /* Inode number (really byte offset of direntry) */
+ uint64_t de_inode; /* Inode number (really index of DOS style direntry) */
};
/*
@@ -217,6 +217,12 @@
#define VTODE(vp) ((struct denode *)(vp)->v_data)
#define DETOV(de) ((de)->de_vnode)
+#define DETOI(pmp, cn, off) \
+ ((cn) == MSDOSFSROOT \
+ ? (((uint64_t)(off) >> 5)) \
+ : (((((uint64_t)pmp->pm_bpcluster * ((cn) - 2) + (off))) >> 5) \
+ + pmp->pm_RootDirEnts))
+
#define DETIMES(dep, acc, mod, cre) do { \
if ((dep)->de_flag & DE_UPDATE) { \
(dep)->de_flag |= DE_MODIFIED; \
diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c
--- a/sys/fs/msdosfs/msdosfs_denode.c
+++ b/sys/fs/msdosfs/msdosfs_denode.c
@@ -133,10 +133,13 @@
* entry that represented the file happens to be reused while the
* deleted file is still open.
*/
- inode = (uint64_t)pmp->pm_bpcluster * dirclust + diroffset;
+ inode = DETOI(pmp, dirclust, diroffset);
error = vfs_hash_get(mntp, inode, lkflags, curthread, &nvp,
de_vncmpf, &inode);
+#ifdef MSDOSFS_DEBUG
+ printf("vfs_hash_get(inode %lu) error %d\n", inode, error);
+#endif
if (error)
return (error);
if (nvp != NULL) {
@@ -191,6 +194,9 @@
}
error = vfs_hash_insert(nvp, inode, lkflags, curthread, &xvp,
de_vncmpf, &inode);
+#ifdef MSDOSFS_DEBUG
+ printf("vfs_hash_insert(inode %lu) error %d\n", inode, error);
+#endif
if (error) {
*depp = NULL;
return (error);
@@ -589,8 +595,11 @@
return;
#endif
vp = DETOV(dep);
- dep->de_inode = (uint64_t)dep->de_pmp->pm_bpcluster * dep->de_dirclust +
- dep->de_diroffset;
+ dep->de_inode = DETOI(dep->de_pmp, dep->de_dirclust, dep->de_diroffset);
+#ifdef MSDOSFS_DEBUG
+ printf("vfs_hash_rehash(inode %lu, refcnt %lu, vp %p)\n",
+ dep->de_inode, dep->de_refcnt, vp);
+#endif
vfs_hash_rehash(vp, dep->de_inode);
}
@@ -608,6 +617,10 @@
/*
* Remove the denode from its hash chain.
*/
+#ifdef MSDOSFS_DEBUG
+ printf("vfs_hash_remove(inode %lu, refcnt %lu, vp %p)\n",
+ dep->de_inode, dep->de_refcnt, vp);
+#endif
vfs_hash_remove(vp);
/*
* Purge old data structures associated with the denode.
diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c
--- a/sys/fs/msdosfs/msdosfs_lookup.c
+++ b/sys/fs/msdosfs/msdosfs_lookup.c
@@ -586,7 +586,7 @@
}
if (FAT32(pmp) && scn == MSDOSFSROOT)
scn = pmp->pm_rootdirblk;
- inode1 = scn * pmp->pm_bpcluster + blkoff;
+ inode1 = DETOI(pmp, scn, blkoff);
if (VTODE(*vpp)->de_inode != inode1) {
vput(*vpp);
goto restart;

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 8:26 PM (16 h, 19 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15746207
Default Alt Text
D43978.diff (2 KB)

Event Timeline