code:struct filsys - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

5550 /*

5551  * Definition of the unix super block.

5552  * The root super block is allocated and

5553  * read in iinit/alloc.c. Subsequently

5554  * a super block is allocated and read

5555  * with each mount (smount/sys3.c) and

5556  * released with umount (sumount/sys3.c).

5557  * A disk block is ripped of for storage.

5558  * See alloc.c for general alloc/free

5559  * routines for free list and I list.

5560  */

5561 struct filsys

5562 {

5563     int s_isize; /* size in blocks of I list */

5564     int s_fsize; /* size in blocks of entire volume */
  • 磁盘总盘块数
5565     int s_nfree; /* number of in core free blocks

5566                     (between 0 and 100) */

5567     int s_free[100]; /* in core free blocks */

  • s_free: 磁盘文件系统空闲块管理数组
  • s_nfree: s_free有效元素的个数
5568     int s_ninode; /* number of in core I nodes (0-100) */

5569     int s_inode[100];/* in core free I nodes */

  • s_inode: 磁盘文件系统INODE块管理数组
  • s_ninode: s_inode有效元素的个数
5570     char s_flock; /* lock during free list manipulation */
  • 空闲块队列 s_free 的操作锁
5571     char s_ilock; /* lock during I list manipulation */
  • Inode队列 s_inode 的操作锁
5572     char s_fmod; /* super block modified flag */

5573     char s_ronly; /* mounted read-only flag */

  • 只读标志
5574     int s_time[2]; /* current date of last update */
  • 最后一次操作时间
5575     int pad[50];

5576 };

5577 /* ------------------------- */

5578

5579

5580

5581

5582

5583

5584

5585

5586

5587

5588

5589

5590

5591

5592

5593

5594

5595

5596

5597

5598

5599

Ref

Caller

⚠️ **GitHub.com Fallback** ⚠️