summaryrefslogtreecommitdiff
path: root/sysfile.c
diff options
context:
space:
mode:
log write() data
usertest for big write()s push begin_trans/commit_trans down into syscalls
Diffstat (limited to 'sysfile.c')
-rw-r--r--sysfile.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/sysfile.c b/sysfile.c
index 4235660..ca54013 100644
--- a/sysfile.c
+++ b/sysfile.c
@@ -121,6 +121,9 @@ sys_link(void)
iunlockput(ip);
return -1;
}
+
+ begin_trans();
+
ip->nlink++;
iupdate(ip);
iunlock(ip);
@@ -134,6 +137,9 @@ sys_link(void)
}
iunlockput(dp);
iput(ip);
+
+ commit_trans();
+
return 0;
bad:
@@ -141,6 +147,7 @@ bad:
ip->nlink--;
iupdate(ip);
iunlockput(ip);
+ commit_trans();
return -1;
}
@@ -195,6 +202,8 @@ sys_unlink(void)
return -1;
}
+ begin_trans();
+
memset(&de, 0, sizeof(de));
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("unlink: writei");
@@ -207,6 +216,9 @@ sys_unlink(void)
ip->nlink--;
iupdate(ip);
iunlockput(ip);
+
+ commit_trans();
+
return 0;
}
@@ -251,6 +263,7 @@ create(char *path, short type, short major, short minor)
panic("create: dirlink");
iunlockput(dp);
+
return ip;
}
@@ -265,7 +278,10 @@ sys_open(void)
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
return -1;
if(omode & O_CREATE){
- if((ip = create(path, T_FILE, 0, 0)) == 0)
+ begin_trans();
+ ip = create(path, T_FILE, 0, 0);
+ commit_trans();
+ if(ip == 0)
return -1;
} else {
if((ip = namei(path)) == 0)
@@ -299,9 +315,13 @@ sys_mkdir(void)
char *path;
struct inode *ip;
- if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0)
+ begin_trans();
+ if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
+ commit_trans();
return -1;
+ }
iunlockput(ip);
+ commit_trans();
return 0;
}
@@ -313,12 +333,16 @@ sys_mknod(void)
int len;
int major, minor;
+ begin_trans();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
- (ip = create(path, T_DEV, major, minor)) == 0)
+ (ip = create(path, T_DEV, major, minor)) == 0){
+ commit_trans();
return -1;
+ }
iunlockput(ip);
+ commit_trans();
return 0;
}