summaryrefslogtreecommitdiff
path: root/libdiskfs/dir-renamed.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-03-15 17:03:19 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-03-15 17:03:19 +0000
commit45a7a79ccdf0a7540d1b2c6779dbe7f39a9a216b (patch)
tree0bc01a77dbb9ebba67d96fe03c9c9aef39c239e2 /libdiskfs/dir-renamed.c
parentdc2c00fee99e8a6bc1f7033b50a672ba36e88304 (diff)
(diskfs_rename_dir): Implement diskfs_synchronous.
Diffstat (limited to 'libdiskfs/dir-renamed.c')
-rw-r--r--libdiskfs/dir-renamed.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c
index d994772f..cdca258c 100644
--- a/libdiskfs/dir-renamed.c
+++ b/libdiskfs/dir-renamed.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994 Free Software Foundation
+ Copyright (C) 1994, 1995 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -126,6 +126,8 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, char *fromname,
}
tdp->dn_stat.st_nlink++;
tdp->dn_set_ctime = 1;
+ if (diskfs_synchronous)
+ diskfs_node_update (tdp, 1);
tmpds = alloca (diskfs_dirstat_size);
err = diskfs_lookup (fnp, "..", RENAME | SPEC_DOTDOT,
@@ -139,11 +141,15 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, char *fromname,
}
err = diskfs_dirrewrite (fnp, tdp, tmpds);
+ if (diskfs_synchronous)
+ diskfs_file_update (fnp, 1);
if (err)
goto out;
fdp->dn_stat.st_nlink--;
fdp->dn_set_ctime = 1;
+ if (diskfs_synchronous)
+ diskfs_node_update (fdp, 1);
/* 3: Increment the link count on the node being moved and rewrite
@@ -171,9 +177,15 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, char *fromname,
tnp->dn_set_ctime = 1;
}
diskfs_clear_directory (tnp, tdp, tocred);
+ /* diskfs_clear_directory will sync both tnp and tdp for us
+ if we are synchronous. */
}
else
- err = diskfs_direnter (tdp, toname, fnp, ds, tocred);
+ {
+ err = diskfs_direnter (tdp, toname, fnp, ds, tocred);
+ if (diskfs_synchronous)
+ diskfs_file_update (tdp, 1);
+ }
if (err)
goto out;
@@ -191,7 +203,12 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, char *fromname,
ds = 0;
fnp->dn_stat.st_nlink--;
fnp->dn_set_ctime = 1;
-
+ if (diskfs_synchronous)
+ {
+ diskfs_file_update (fdp, 1);
+ diskfs_node_update (fnp, 1);
+ }
+
out:
if (tdp)
mutex_unlock (&tdp->lock);