Date: Fri, 10 Oct 1997 23:34:17 +0200 From: Poul-Henning Kamp <phk@freebsd.org> To: current@freebsd.org Subject: ext2fs patch, please test! Message-ID: <5743.876519257@critter.freebsd.dk>
next in thread | raw e-mail | index | archive | help
If some EXT2FS filesystem users would please test this patch.
It takes us a fair step closer to having a LKM'able ext2fs.
Poul-Henning
Index: gnu/ext2fs/ext2_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_vfsops.c,v
retrieving revision 1.19
diff -u -r1.19 ext2_vfsops.c
--- ext2_vfsops.c 1997/10/10 18:13:05 1.19
+++ ext2_vfsops.c 1997/10/10 21:00:17
@@ -663,6 +663,11 @@
ump->um_nindir = EXT2_ADDR_PER_BLOCK(fs);
ump->um_bptrtodb = fs->s_es->s_log_block_size + 1;
ump->um_seqinc = EXT2_FRAGS_PER_BLOCK(fs);
+ ump->um_dirremove = ext2_dirremove;
+ ump->um_dirempty = ext2_dirempty;
+ ump->um_direnter = ext2_direnter;
+ ump->um_checkpath = ext2_checkpath;
+ ump->um_dirrewrite = ext2_dirrewrite;
for (i = 0; i < MAXQUOTAS; i++)
ump->um_quotas[i] = NULLVP;
devvp->v_specflags |= SI_MOUNTEDON;
Index: ufs/ffs/ffs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vfsops.c,v
retrieving revision 1.57
diff -u -r1.57 ffs_vfsops.c
--- ffs_vfsops.c 1997/10/10 18:16:59 1.57
+++ ffs_vfsops.c 1997/10/10 21:02:43
@@ -603,6 +603,11 @@
ump->um_nindir = fs->fs_nindir;
ump->um_bptrtodb = fs->fs_fsbtodb;
ump->um_seqinc = fs->fs_frag;
+ ump->um_dirremove = ufs_dirremove;
+ ump->um_dirempty = ufs_dirempty;
+ ump->um_direnter = ufs_direnter;
+ ump->um_checkpath = ufs_checkpath;
+ ump->um_dirrewrite = ufs_dirrewrite;
for (i = 0; i < MAXQUOTAS; i++)
ump->um_quotas[i] = NULLVP;
devvp->v_specflags |= SI_MOUNTEDON;
Index: ufs/lfs/lfs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/lfs/lfs_vfsops.c,v
retrieving revision 1.23
diff -u -r1.23 lfs_vfsops.c
--- lfs_vfsops.c 1997/10/10 18:17:21 1.23
+++ lfs_vfsops.c 1997/10/10 21:19:04
@@ -416,6 +416,11 @@
ump->um_bptrtodb = 0;
ump->um_seqinc = 1 << fs->lfs_fsbtodb;
ump->um_nindir = fs->lfs_nindir;
+ ump->um_dirremove = ufs_dirremove;
+ ump->um_dirempty = ufs_dirempty;
+ ump->um_direnter = ufs_direnter;
+ ump->um_checkpath = ufs_checkpath;
+ ump->um_dirrewrite = ufs_dirrewrite;
for (i = 0; i < MAXQUOTAS; i++)
ump->um_quotas[i] = NULLVP;
devvp->v_specflags |= SI_MOUNTEDON;
Index: ufs/ufs/ufs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.58
diff -u -r1.58 ufs_vnops.c
--- ufs_vnops.c 1997/09/21 04:24:14 1.58
+++ ufs_vnops.c 1997/10/10 21:17:05
@@ -655,15 +655,7 @@
error = EPERM;
goto out;
}
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(dvp)) {
- error = ext2_dirremove(dvp, ap->a_cnp);
- } else {
- error = ufs_dirremove(dvp, ap->a_cnp);
- }
-#else
- error = ufs_dirremove(dvp, ap->a_cnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(dvp->v_mount)->um_dirremove(dvp, ap->a_cnp);
if (error == 0) {
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
@@ -725,15 +717,7 @@
gettime(&tv);
error = VOP_UPDATE(vp, &tv, &tv, 1);
if (!error) {
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(tdvp)) {
- error = ext2_direnter(ip, tdvp, cnp);
- } else {
- error = ufs_direnter(ip, tdvp, cnp);
- }
-#else
- error = ufs_direnter(ip, tdvp, cnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(tdvp->v_mount)->um_direnter(ip, tdvp, cnp);
}
if (error) {
@@ -1006,15 +990,8 @@
goto bad;
if (xp != NULL)
vput(tvp);
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(tdvp)) {
- error = ext2_checkpath(ip, dp, tcnp->cn_cred);
- } else {
- error = ufs_checkpath(ip, dp, tcnp->cn_cred);
- }
-#else
- error = ufs_checkpath(ip, dp, tcnp->cn_cred);
-#endif /* EXT2FS */
+ error = VFSTOUFS(tdvp->v_mount)->
+ um_checkpath(ip, dp, tcnp->cn_cred);
if (error)
goto out;
if ((tcnp->cn_flags & SAVESTART) == 0)
@@ -1055,15 +1032,7 @@
if (error)
goto bad;
}
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(tdvp)) {
- error = ext2_direnter(ip, tdvp, tcnp);
- } else {
- error = ufs_direnter(ip, tdvp, tcnp);
- }
-#else
- error = ufs_direnter(ip, tdvp, tcnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(tdvp->v_mount)->um_direnter(ip, tdvp, tcnp);
if (error) {
if (doingdirectory && newparent) {
dp->i_nlink--;
@@ -1099,13 +1068,8 @@
* (both directories, or both not directories).
*/
if ((xp->i_mode&IFMT) == IFDIR) {
-#ifdef EXT2FS
- if (! (IS_EXT2_VNODE(ITOV(xp)) ?
- ext2_dirempty : ufs_dirempty)
-#else
- if (! ufs_dirempty
-#endif /* EXT2FS */
- (xp, dp->i_number, tcnp->cn_cred) ||
+ if (!VFSTOUFS(ITOV(xp)->v_mount)->
+ um_dirempty(xp, dp->i_number, tcnp->cn_cred) ||
xp->i_nlink > 2) {
error = ENOTEMPTY;
goto bad;
@@ -1119,15 +1083,8 @@
error = EISDIR;
goto bad;
}
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(ITOV(dp))) {
- error = ext2_dirrewrite(dp, ip, tcnp);
- } else {
- error = ufs_dirrewrite(dp, ip, tcnp);
- }
-#else
- error = ufs_dirrewrite(dp, ip, tcnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(ITOV(dp)->v_mount)->
+ um_dirrewrite(dp, ip, tcnp);
if (error)
goto bad;
/*
@@ -1245,15 +1202,7 @@
}
}
}
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(fdvp)) {
- error = ext2_dirremove(fdvp, fcnp);
- } else {
- error = ufs_dirremove(fdvp, fcnp);
- }
-#else
- error = ufs_dirremove(fdvp, fcnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(fdvp->v_mount)->um_dirremove(fdvp, fcnp);
if (!error) {
xp->i_nlink--;
xp->i_flag |= IN_CHANGE;
@@ -1409,15 +1358,7 @@
}
/* Directory set up, now install it's entry in the parent directory. */
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(dvp)) {
- error = ext2_direnter(ip, dvp, cnp);
- } else {
- error = ufs_direnter(ip, dvp, cnp);
- }
-#else
- error = ufs_direnter(ip, dvp, cnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(dvp->v_mount)->um_direnter(ip, dvp, cnp);
if (error) {
dp->i_nlink--;
dp->i_flag |= IN_CHANGE;
@@ -1472,12 +1413,8 @@
*/
error = 0;
if (ip->i_nlink != 2 ||
-#ifdef EXT2FS
- !(IS_EXT2_VNODE(ITOV(ip)) ? ext2_dirempty : ufs_dirempty)
- (ip, dp->i_number, cnp->cn_cred)) {
-#else
- !ufs_dirempty(ip, dp->i_number, cnp->cn_cred)) {
-#endif /* EXT2FS */
+ !(VFSTOUFS(ITOV(ip)->v_mount)->
+ um_dirempty(ip, dp->i_number, cnp->cn_cred))) {
error = ENOTEMPTY;
goto out;
}
@@ -1491,15 +1428,7 @@
* inode. If we crash in between, the directory
* will be reattached to lost+found,
*/
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(dvp)) {
- error = ext2_dirremove(dvp, cnp);
- } else {
- error = ufs_dirremove(dvp, cnp);
- }
-#else
- error = ufs_dirremove(dvp, cnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(dvp->v_mount)->um_dirremove(dvp, cnp);
if (error)
goto out;
dp->i_nlink--;
@@ -2128,15 +2057,7 @@
error = VOP_UPDATE(tvp, &tv, &tv, 1);
if (error)
goto bad;
-#ifdef EXT2FS
- if (IS_EXT2_VNODE(dvp)) {
- error = ext2_direnter(ip, dvp, cnp);
- } else {
- error = ufs_direnter(ip, dvp, cnp);
- }
-#else
- error = ufs_direnter(ip, dvp, cnp);
-#endif /* EXT2FS */
+ error = VFSTOUFS(dvp->v_mount)->um_direnter(ip, dvp, cnp);
if (error)
goto bad;
Index: ufs/ufs/ufsmount.h
===================================================================
RCS file: /home/ncvs/src/sys/ufs/ufs/ufsmount.h,v
retrieving revision 1.9
diff -u -r1.9 ufsmount.h
--- ufsmount.h 1997/10/10 18:18:13 1.9
+++ ufsmount.h 1997/10/10 21:05:43
@@ -92,6 +92,11 @@
struct netexport um_export; /* export information */
int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */
struct malloc_type *um_malloctype; /* The inodes malloctype */
+ int (*um_dirremove) __P((struct vnode *, struct componentname *));
+ int (*um_dirempty) __P((struct inode *, ino_t, struct ucred *));
+ int (*um_direnter) __P((struct inode *, struct vnode *, struct componentname *));
+ int (*um_dirrewrite) __P((struct inode *, struct inode *, struct componentname *));
+ int (*um_checkpath) __P((struct inode *, struct inode *, struct ucred *));
};
/*
--
Poul-Henning Kamp FreeBSD coreteam member
phk@FreeBSD.ORG "Real hackers run -current on their laptop."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5743.876519257>
