diff options
author | Robert Morris <rtm@csail.mit.edu> | 2011-08-12 09:25:39 -0400 |
---|---|---|
committer | Robert Morris <rtm@csail.mit.edu> | 2011-08-12 09:25:39 -0400 |
commit | 2e59046362f532748711b9acaceee1cda969cc50 (patch) | |
tree | 82ab693a2fa6021d445915c169354b6833262d24 /sysfile.c | |
parent | bd71a45046eb13797284216c43353b9b6c92f18c (diff) | |
download | xv6-labs-2e59046362f532748711b9acaceee1cda969cc50.tar.gz xv6-labs-2e59046362f532748711b9acaceee1cda969cc50.tar.bz2 xv6-labs-2e59046362f532748711b9acaceee1cda969cc50.zip |
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.c | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -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; } |