]> Devi Nivas Git - cs3210-lab1.git/commitdiff
Avoid rereading the superblock in bfree
authorDan Cross <cross@gajendra.net>
Wed, 20 Mar 2019 17:28:13 +0000 (17:28 +0000)
committerFrans Kaashoek <kaashoek@mit.edu>
Mon, 19 Aug 2019 23:25:43 +0000 (19:25 -0400)
The superblock is read when the first process returns to
userspace (via the call to `iinit` from the first invocation of
`forkret`, when `first` is still set to 1) and cached in a
global; it is treated as immutable from that point on.  There is
no reason to re-read it in bfree.

Removing this call seems to have simply been missed in 8320d61b
when this general area was last touched.  Remove it now to avoid
potential confusion.

Signed-off-by: Dan Cross <cross@gajendra.net>
fs.c

diff --git a/fs.c b/fs.c
index feb59fea732ff6b7270c6a52488d5e92b5363e5b..f77275f8fb0b2fbbc136b15343635fa959cb8632 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -84,7 +84,6 @@ bfree(int dev, uint b)
   struct buf *bp;
   int bi, m;
 
-  readsb(dev, &sb);
   bp = bread(dev, BBLOCK(b, sb));
   bi = b % BPB;
   m = 1 << (bi % 8);