Commit graph

104 commits

Author SHA1 Message Date
Frans Kaashoek 8320d61be5 Pick up where i left off in april:
- move log into metadata part of disk, so that marking
that the log's blocks are in use falls out for free
- superblock describes the whole disk (sizes and offets)
- sizes and offsets are computed in one place (mkfs) and
the rest of the code refers to the superblock for these values,
instead of recomputing them.
2015-06-27 12:39:13 -04:00
Frans Kaashoek c24ac5d763 Disentangle block size from the disk's sector size. Set block size to 1024 to show
that they can be different.  Clean up mkfs, simplifying specifying fs parameters,
remove some redundancy between fs and mkfs, and fix disk layout bugs. Call blocks
in the file system blocks instead of sectors.  Passes usertests for different
block sizes.
2015-04-03 08:22:02 -04:00
Robert Morris e2b4583d05 xx 2014-08-28 17:04:47 -04:00
Robert Morris 12eeefc72d comments 2014-08-27 14:14:52 -04:00
Robert Morris 2c56547272 every iput() and namei() must be inside a transaction 2014-08-04 13:06:48 -04:00
Robert Morris 38eee5bca7 more FS comment clarification 2011-10-11 10:11:53 -04:00
Robert Morris a5fbfe418a clarify some FS comments 2011-10-11 06:41:37 -04:00
Frans Kaashoek 1ddfbbb194 Revert "Introduce and use sleeplocks instead of BUSY flags"
My changes have a race with re-used bufs and the code doesn't seem to get shorter
Keep the changes that fixed ip->off race

This reverts commit 3a5fa7ed90.

Conflicts:

	defs.h
	file.c
	file.h
2011-08-29 17:18:40 -04:00
Frans Kaashoek 3a5fa7ed90 Introduce and use sleeplocks instead of BUSY flags
Remove I_BUSY, B_BUSY, and intrans defs and usages
One spinlock per buf to avoid ugly loop in bget
fix race in filewrite (don't update f->off after releasing lock)
2011-08-26 10:08:29 -04:00
Robert Morris 327cc21fba make dirlookup and dirlink more similar 2011-08-19 13:30:57 -04:00
Robert Morris 5053dd6a6d avoid deadlock by calling begin_trans() before locking any inodes 2011-08-15 12:44:20 -04:00
Robert Morris 2e59046362 log write() data
usertest for big write()s
push begin_trans/commit_trans down into syscalls
2011-08-12 09:25:39 -04:00
Frans Kaashoek 13a96baefc Dirt simple logging
Passes usertests and stressfs
Seems to recover correctly in a number of simple cases
2011-07-27 20:35:46 -04:00
Nickolai Zeldovich 96b7da5f03 do not run past the end of the disk!
[ cherry-picked de6075ff0978108daea1d658425bcb37663a98a0 ]

Conflicts:

	fs.c
2011-06-24 05:26:57 -04:00
Austin Clements 745e73cd3d Comment typo 2009-10-24 21:31:01 -04:00
Russ Cox 48755214c9 assorted fixes:
* rename c/cp to cpu/proc
 * rename cpu.context to cpu.scheduler
 * fix some comments
 * formatting for printout
2009-08-30 23:02:08 -07:00
Russ Cox 0aef891495 shuffle and tweak for formatting.
pdf has very good page breaks now.
would be a good copy for fall 2009.
2009-08-08 01:07:30 -07:00
Russ Cox f9a06440ab rearrangements and cleanup for text 2009-07-11 19:26:01 -07:00
rsc 34295f461a group locks into structs they protect.
few naming nits.
2009-05-31 05:12:21 +00:00
rsc ce72cadbe0 fix bug fix 2009-05-31 01:53:08 +00:00
rsc 13ae8808c4 tidy fs.c; bmap callers always expected allocation 2009-05-31 01:44:20 +00:00
rsc f12551b599 inode reuse bug.
Suppose an inode has been used and freed.
It is left marked I_VALID (the bug).
Now ialloc comes along and reuses the
inode.  It writes the new inode type to disk
and returns iget(dev, inum) to get the
cache entry.  Iget sees that the inode is valid
and doesn't bother refreshing from disk.
Now when the caller iupdates, it will write
out a zero type and the file or directory has
disappeared.
2009-05-31 01:34:46 +00:00
rsc ba6cd8a685 drop NADDRS and INDIRECT; too many names 2009-05-31 00:59:37 +00:00
rtm 8eb20827c2 Explain why itrunc() is OK w.r.t. crashes. 2008-10-20 18:05:48 +00:00
kolya e1626709d6 free the indirect block 2008-10-16 15:00:23 +00:00
rtm 2ce40d7088 be clear what the root i-number is 2008-10-08 18:57:13 +00:00
rsc bf2932a686 final nits 2007-08-28 19:39:49 +00:00
rsc 5516be1fed spaces around else for rtm 2007-08-28 18:37:41 +00:00
rsc e4d6a21165 more consistent spacing 2007-08-28 18:32:08 +00:00
rsc d844f0f9d9 Change dev read/write functions
to take inode* instead of minor number.

Unlock console inode during console_read
and console_write.  Otherwise background
processes cannot write to console while the
shell is reading it waiting for input.
2007-08-28 17:49:49 +00:00
rsc 3341e30f6e nit 2007-08-28 04:13:24 +00:00
rsc 8970df0c1b No one is going to find this inode.
There is only one ref to it -- the caller --
and no links to it.
2007-08-28 03:31:11 +00:00
rsc 558ab49f13 delete unnecessary #include lines 2007-08-27 23:26:33 +00:00
rsc 7895178df3 nits 2007-08-27 14:31:50 +00:00
rsc 6c34f97cb8 tell what an inode is 2007-08-27 14:23:48 +00:00
rsc a505fd6651 FS cleanup.
Add utility routines bzero, readsb so that balloc, bfree fit on one page.
Make balloc loop clearer.
2007-08-27 14:20:24 +00:00
rsc 8d2e9a4867 shuffle for formatting 2007-08-24 22:17:54 +00:00
rsc 766ba5cc06 first ever correct use of strncpy 2007-08-24 21:00:02 +00:00
rsc 07090dd705 Remove struct uinode.
Remove type arg to mknod (assume T_DEV).
2007-08-24 20:54:23 +00:00
rsc 4d39b63388 nits 2007-08-24 19:46:19 +00:00
rtm 902b13f5d6 simplify ide queuing
nits in comments
2007-08-24 19:32:36 +00:00
rtm 2036534834 add missing iput() at end of _namei() 2007-08-24 14:56:17 +00:00
rsc f0721f1be4 tweaks 2007-08-22 06:20:10 +00:00
rsc eaea18cb9c PDF at http://am.lcs.mit.edu/~rsc/xv6.pdf
Various changes made while offline.

 + bwrite sector argument is redundant; use b->sector.
 + reformatting of files for nicer PDF page breaks
 + distinguish between locked, unlocked inodes in type signatures
 + change FD_FILE to FD_INODE
 + move userinit (nee proc0init) to proc.c
 + move ROOTDEV to param.h
 + always parenthesize sizeof argument
2007-08-22 06:01:32 +00:00
rsc fbf9103952 remove namelen parameter 2007-08-21 19:58:55 +00:00
rsc f32f3638f4 Various cleanup:
- Got rid of dummy proc[0].  Now proc[0] is init.
 - Added initcode.S to exec /init, so that /init is
   just a regular binary.
 - Moved exec out of sysfile to exec.c
 - Moved code dealing with fs guts (like struct inode)
   from sysfile.c to fs.c.  Code dealing with system call
   arguments stays in sysfile.c
 - Refactored directory routines in fs.c; should be simpler.
 - Changed iget to return *unlocked* inode structure.
   This solves the lookup-then-use race in namei
   without introducing deadlocks.
   It also enabled getting rid of the dummy proc[0].
2007-08-21 19:22:08 +00:00
rsc e2a620da49 checkpoint - simpler namei interface 2007-08-20 19:37:15 +00:00
rsc bcca6c6bde shuffle fs.c in bottom-up order 2007-08-20 18:23:52 +00:00
rsc 7d4aef6cfd various cleanups 2007-08-10 16:52:31 +00:00
rsc b6095304b7 Make cp a magic symbol. 2007-08-10 16:37:27 +00:00