annotate src/impl/fs_impl_private.cbc @ 309:c6cbe4711e02

tweak
author menikon
date Mon, 03 Feb 2020 15:29:54 +0900
parents 4cf83e6ce534
children b40deb55b7db
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
302
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
1 #include "types.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
2 #include "defs.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
3 #include "param.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
4 #include "stat.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
5 #include "mmu.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
6 #include "proc.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
7 #include "spinlock.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
8 #include "buf.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
9 #include "fs.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
10 #include "file.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
11 #interface "fs_impl.h"
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
12
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
13 /*
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
14 fs_impl* createfs_impl2();
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
15 */
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
16
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
17 __code allocinode(struct fs_impl* fs_impl, uint dev, struct superblock* sb, __code next(int iget_val, ...)){ //:skip
302
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
18
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
19 readsb(dev, sb);
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
20 Gearef(cbc_context, fs_impl)->inum = 1;
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
21 goto allocinode_loopcheck(fs_impl, inum, dev, sb, bp, dip, next(iget_val, ...));
302
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
22
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
23 }
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
24
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
25 typedef struct buf buf;
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
26 typedef struct dinode dinode;
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
27
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
28 __code allocinode_loopcheck(struct fs_impl* fs_impl, int inum, uint dev, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(int iget_val, ...)){ //:skip
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
29 if( inum < sb->ninodes){
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
30 goto allocinode_loop(fs_impl, inum, dev, type, sb, bp, dip, next(iget_val, ...));
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
31 }
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
32 /*
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
33 goto cbc_context->panic(...);
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
34 */
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
35 }
302
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
36
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
37 __code allocinode_loop(struct fs_impl* fs_impl, int inum, uint dev, short type, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(int iget_val, ...)){ //:skip
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
38 bp = bread(dev, IBLOCK(inum));
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
39 dip = (struct dinode*) bp->data + inum % IPB;
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
40 if(dip->type = 0){
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
41 goto allocinode_noloop(fs_impl, inum, dev, sb, bp, dip, next(iget_val, ...));
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
42 }
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
43
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
44 brelse(bp);
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
45 inum++;
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
46 goto allocinode_loopcheck(fs_impl, inum, dev, type, sb, bp, dip, next(iget_val, ...));
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
47 }
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
48
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
49 struct {
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
50 struct spinlock lock;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
51 struct inode inode[NINODE];
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
52 } icache;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
53
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
54 static struct inode* iget (uint dev, uint inum)
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
55 {
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
56 struct inode *ip, *empty;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
57
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
58 acquire(&icache.lock);
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
59
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
60 // Is the inode already cached?
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
61 empty = 0;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
62
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
63 for (ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++) {
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
64 if (ip->ref > 0 && ip->dev == dev && ip->inum == inum) {
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
65 ip->ref++;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
66 release(&icache.lock);
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
67 return ip;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
68 }
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
69
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
70 if (empty == 0 && ip->ref == 0) { // Remember empty slot.
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
71 empty = ip;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
72 }
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
73 }
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
74
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
75 // Recycle an inode cache entry.
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
76 if (empty == 0) {
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
77 panic("iget: no inodes");
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
78 }
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
79
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
80 ip = empty;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
81 ip->dev = dev;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
82 ip->inum = inum;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
83 ip->ref = 1;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
84 ip->flags = 0;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
85 release(&icache.lock);
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
86
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
87 return ip;
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
88 }
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
89
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
90 __code allocinode_noloop(struct fs_impl* fs_impl, int inum, uint dev, short type, struct superblock* sb, struct buf* bp, struct dinode* dip, __code next(int iget_val, ...)){ //:skip
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
91
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
92 memset(dip, 0, sizeof(*dip));
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
93 dip->type = type;
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
94 log_write(bp);
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
95 brelse(bp);
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
96
304
c5c4f9e233ad fix and build success
menikon
parents: 303
diff changeset
97 iget_val = iget(dev, inum);
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
98 goto next(iget_val, ...);
302
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
99
bc2f3d24faa9 add fs_impl_private
menikon
parents:
diff changeset
100 }
303
5217253368ad rewrite ialloc
menikon
parents: 302
diff changeset
101
306
menikon
parents: 305
diff changeset
102 __code lockinode1(struct fs_impl* fs_impl, struct inode* ip, struct buf* bp, struct dinode* dip, __code next(...)){ //:skip
menikon
parents: 305
diff changeset
103
menikon
parents: 305
diff changeset
104 if (ip == 0 || ip->ref < 1) {
menikon
parents: 305
diff changeset
105
menikon
parents: 305
diff changeset
106 /*
menikon
parents: 305
diff changeset
107 panic("ilock");
menikon
parents: 305
diff changeset
108 goto panic();
menikon
parents: 305
diff changeset
109 */
menikon
parents: 305
diff changeset
110 }
menikon
parents: 305
diff changeset
111 acquire(&icache.lock);
menikon
parents: 305
diff changeset
112
menikon
parents: 305
diff changeset
113 goto lockinode_sleepcheck(fs_impl, ip, next(...));
menikon
parents: 305
diff changeset
114
menikon
parents: 305
diff changeset
115 }
menikon
parents: 305
diff changeset
116
307
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
117
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
118 __code lockinode2(struct fs_impl* fs_impl, struct inode* ip, struct buf* bp, struct dinode* dip, __code next(...)){ //:skip
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
119
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
120 ip->flags |= I_BUSY;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
121 release(&icache.lock);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
122
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
123 if (!(ip->flags & I_VALID)) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
124 bp = bread(ip->dev, IBLOCK(ip->inum));
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
125
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
126 dip = (struct dinode*) bp->data + ip->inum % IPB;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
127 ip->type = dip->type;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
128 ip->major = dip->major;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
129 ip->minor = dip->minor;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
130 ip->nlink = dip->nlink;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
131 ip->size = dip->size;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
132
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
133 memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
134 brelse(bp);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
135 ip->flags |= I_VALID;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
136
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
137 if (ip->type == 0) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
138 /*
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
139 panic("ilock: no type");
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
140 goto panic();
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
141 */
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
142 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
143 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
144 goto next(...);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
145 }
306
menikon
parents: 305
diff changeset
146 __code lockinode_sleepcheck(struct fs_impl* fs_impl, struct inode* ip, __code next(...)){
menikon
parents: 305
diff changeset
147 if(ip->flags & I_BUSY){
menikon
parents: 305
diff changeset
148 sleep(ip, &icache.lock);
menikon
parents: 305
diff changeset
149 goto lockinode_sleepcheck(fs_impl, ip, next(...));
menikon
parents: 305
diff changeset
150 }
307
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
151 goto lockinode2(fs_impl, ip, bp, dip, next(...));
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
152 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
153
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
154 __code iput_check(struct fs_impl* fs_impl, struct inode* ip, __code next(...)){
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
155 acquire(&icache.lock);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
156 if (ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
157 goto iput_inode_nolink(fs_impl, ip, next(...));
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
158 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
159 ip->ref--;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
160 release(&icache.lock);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
161 goto next(...);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
162
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
163 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
164
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
165 static void bfree (int dev, uint b)
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
166 {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
167 struct buf *bp;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
168 struct superblock sb;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
169 int bi, m;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
170
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
171 readsb(dev, &sb);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
172 bp = bread(dev, BBLOCK(b, sb.ninodes));
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
173 bi = b % BPB;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
174 m = 1 << (bi % 8);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
175
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
176 if ((bp->data[bi / 8] & m) == 0) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
177 panic("freeing free block");
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
178 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
179
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
180 bp->data[bi / 8] &= ~m;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
181 log_write(bp);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
182 brelse(bp);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
183 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
184
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
185
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
186 static void itrunc (struct inode *ip)
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
187 {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
188 int i, j;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
189 struct buf *bp;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
190 uint *a;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
191
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
192 for (i = 0; i < NDIRECT; i++) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
193 if (ip->addrs[i]) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
194 bfree(ip->dev, ip->addrs[i]);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
195 ip->addrs[i] = 0;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
196 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
197 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
198
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
199 if (ip->addrs[NDIRECT]) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
200 bp = bread(ip->dev, ip->addrs[NDIRECT]);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
201 a = (uint*) bp->data;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
202
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
203 for (j = 0; j < NINDIRECT; j++) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
204 if (a[j]) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
205 bfree(ip->dev, a[j]);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
206 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
207 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
208
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
209 brelse(bp);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
210 bfree(ip->dev, ip->addrs[NDIRECT]);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
211 ip->addrs[NDIRECT] = 0;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
212 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
213
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
214 ip->size = 0;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
215 iupdate(ip);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
216 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
217
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
218 __code iput_inode_nolink(struct fs_impl* fs_impl, struct inode* ip, __code next(...)){
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
219
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
220 if (ip->flags & I_BUSY) {
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
221 /*
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
222 panic("iput busy");
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
223 */
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
224 }
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
225
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
226 ip->flags |= I_BUSY;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
227 release(&icache.lock);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
228 itrunc(ip);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
229 ip->type = 0;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
230 iupdate(ip);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
231
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
232 acquire(&icache.lock);
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
233 ip->flags = 0;
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
234 wakeup(ip);
305
a101eb88b1cd ~add lockinode CodeGear
menikon
parents: 304
diff changeset
235 goto next(...);
a101eb88b1cd ~add lockinode CodeGear
menikon
parents: 304
diff changeset
236 }
306
menikon
parents: 305
diff changeset
237
307
4cf83e6ce534 add iput codeGear
menikon
parents: 306
diff changeset
238