SlideShare uma empresa Scribd logo
1 de 25
LINUX FILE SYSTEM


           V.N.Murali
      CSE-597A Presentation
          03/29/2001,
    ACKNOWLEDGEMENT:
a)LINUX KERNEL INTERNALS
       BECK,BOHM et al
    b)THE LINUX KERNEL
       DAVID GOSLING.
Virtual File System Switch

   Supplies applications with the system calls for file system
    management.
   Specific focus on ext2fs and procfs of LINUX.
   Different types of files are possible:regular
    files,directories,device files,fifo’s,pipes,symbolic
    links,sockets.
   Meta data information kept separately.”inodes” are used
    for describing files.
Virtual File System Switch
Structure of Inode
Unix File System
                    FEATURES OF UNIX FILE SYSTEMS

   Boot Block : Will it always be present?

   SuperBlock:Information for managing file systems

   InodeBlocks:inode structures for the file system.

   DataBlocks:blocks for files,directories..etc

   Mounting,Unmounting file systems
Representation of File systems
   Management structures for file systems is similar to logical structure of
    UNIX file system.
   VFS responsible for calling file-system specific implementations. How
    does VFS know which filesystems are configured?
   Void register_filesystem(struct file_system_type *);
   Configured at boot-time and possibly loaded as modules as well.
   struct file_system_type {
     –   Const char *name;
     –   Int fs_flags;
     –   Struct super_block *(*read_super)(struct super_block*,void *,int);
     –   #ifdef VERSION > 2.4
     –   Struct module *owner;
     –   Struct vfsmount *kern_mnt;
     –   #endif
     –   Struct file_system_type *next;
     –   };
Mounting
   Any file system in UNIX must be mounted before it can be
    accessed,either through mount() or mount_root().
   What is mount_root() ?
   Representation of a mounted file system : struct
    super_block.Limited to NR_SUPER.
   It is initialized by the function “read_super” in the VFS.It
    interrogates floppy disks,CD-ROM for a change of
    media,tests if superblock is present and if so returns it.else
    it calls the fs-specific function to create a superblock.
   File system specific Read_super() reads its data from the
    block device using the LINUX cache
    functions,bread,brw_page.Processes may be put to sleep
    when reading/writing or mounting file systems.
Superblock
   struct super_block {
     –   kdev_t s_dev;/* device */
     –   unsigned long s_blocksize;/* block size */
     –   unsigned char s_blocksize_bits;/* ld(block size) */
     –   unsigned char s_lock;/* superblock lock */
     –   unsigned char s_rd_only;
     –   Unsigned char s_dirt;
     –   Struct file_system_type *s_type;
     –   Struct super_operations *s_op;
     –   Unsigned long s_flags;
     –   Unsigned long s_magic;
     –   Unsigned long s_time;
     –   Struct inode *s_covered;/* mount point */
     –   Struct inode *s_mounted; /* root inode */
     –   Struct wait_queue *s_wait;/* s_lock wait queue */
     –   Union {
              Struct minix_sb_info minix_sb;
              Struct ext2_sb_info ext2_sb;
              ….
              Void *generic_sb;
              }u;
Locking/Unlocking superblock
   Lock_super(struct super_block *sb)
   {
    – If(sb->s_lock) __wait_on_super(sb);
    – Sb->s_lock=1;
    – }



    – unlock_super(struct super_block *sb)
    – {
    – sb->s_lock=0;
    – wake_up(&sb->s_wait);
    – }
    – The read_super( ) function in the file system specific
       implementation should also make the root inode available using
       the function iget( );
Superblock operations
   s_op points to a vector of functions for accessing the file system.
   struct super_operations {
   void (*read_inode)(struct inode *);
   Int (*notify_change)(struct inode *,struct iattr *);
   Void (*write_inode)(struct inode *);
   Void (*put_inode)(struct inode *);
   Void (*put_super)(struct super_block *);
   Void (*write_super)(struct super_block *);
   Void (*statfs)(struct super_block *,struct statfs *);
   Void (*remount_fs)(struct super_block *,int *,char *);
   };
   These functions serve to translate the specific representation of the
    superblock and inode on data media to their general form in memory and
    vice-versa.Does every file system have a superblock and inode?
   Elaborating a little more…
   Write_super(sb) : saves info on super block.Used in synchronising the
    device.dirty bit is set in buffer.
   Put_super(sb) : Called when unmounting file systems.Releases
    super_block and buffers used.restores consistency if
    necessary.super_block structure can be reused.
   Statfs(sb,statfsbuf) : fills the statfs structure with file system
    information.
   Remount_fs(sb,flags,options) : new attributes for file system and
    restoring consistency.
   Read_inode(inode) : fills in the inode structure.Marks different file
    types by using different inode_operations struct.for example
   If(S_ISREG(inode->I_mode)
   Inode->I_op=&ext2_file_inode_operations;
   Else if(S_ISDIR(inode->I_mode)
   Inode->I_op=&ext2_dir_inode_operations;
   Else if(S_ISLNK(inode->I-mode)
   Inode->I_op=&ext2_symlink_inode_operations;
   …….Similiarly for character devices,block devices,fifos,etc
   Notify_change(inode,attr) : changes made to inode are
    acknowledged by this function.It is of interest only in NFS/
    Coda etc.Why?Each file on such a system has a local and a
    remote inode.The remote file system is informed of the
    change using iattr.
   Write_inode(inode) : saves inode structure.
   Put_inode(inode) : if inode is no longer required.Called
    when deleting file and release its blocks.
INODE
   Struct inode {
   Kdev_t I_dev;
   Unsigned long I_ino;
   Umode_t I_mode;
   Nlink_t I_nlinkl;
   Uid,gid etc….
   Dev_t I_rdev; /* only if device special file */
   Offset,times of modification,access,creation etc
   Struct semaphore *I_sem;
   Struct inode_operations *I_op;
   Struct super_block *I_sb;
   Struct wait_queue (I_wait;
   Struct file_lock *I_flock;
   Struct vm_area_struct *I_mmap;
   Struct inode *I_next,*I_prev;
   Struct inode *I_hash_next,*I_hash_prev;
   Struct inode *I_boundto;
INODE…contd
   Struct inode *I_mount;
   Struct socket *I_socket;
   Reference_counter,flags,lock,bits that denote if this is a pipe,socket.
   Union {
   Struct pipe_node_info pipe_i;
   Struct minix_inode_info minix_i;
   ….
   Void *generic_ip;
   }u;
   };
   Inodes are managed as doubly linked lists as well as a hash table.starts with
    first_inode(/ inode).iget() function can be used to get the inode specified by
    the superblock.It uses hints to resolve cross mounted file systems as
    well.Any access to inode increments a usage counter.Analogous function
    iput( ).
Inode Operations
   Struct inode_operations {
   Struct file_operations *default_file_ops;
   Int (*create)(struct inode *,const char *,int,int,struct inode **);
   Int (*lookup)(struct inode *,const char *,int,struct inode **);
   Int (*link)(struct inode *,struct inode *,const char *,int);
   Int (*unlink)(struct inode *,const char *,int);
   Int (*symlink)(struct inode *,const char *,int);
   Int (*mkdir)(struct inode *,const char *,int);
   Similiarly we have
    rmdir,mknod,rename,readlink,follow_link,bmap,truncate,perm
    ission,smap.
   NOTE :All these functions are directly called from the
    implementation of the corresponding system call.
File System Calls.
   Create(),lookup(),link(),unlink(),symlink(),mkdir(),rmdir(),
   mknod(),rename(),readlink(),follow_link()
   Bmap() : used for mmap’ing files .This function is called by the function
    generic_mmap() to map a block of data from file to an address in the user
    space.
   Smap():allows swap files to be created on a UMSDOS file system.
   To allow for shared accesses to files,UNIX introduced an extra structure.
   Struct file {
   Mode_t f_mode;
   Loff_t f_pos;
   Unsigned short f_flags;
   Unsigned short f_count;
   Off_t f_reada;/* readahead flag */
   Struct file *f_next,*f_prev;
   Struct inode *f_inode;
   Struct file_operations *f_op;
   Void *private_data;
   };
File Operations .
   General interface to work on files,Has functions to
    open,close,read,write etc.Why are these isolated from
    inode_operations?These operations also need to modify struct
    file.Hence.
   Struct file_operations {
   Struct module *owner;
   Int (*lseek)(…)
   Read,write,readdir,select,ioctl,mmap,open,release,fsync,fasyn
    c,check_media_change,revalidate..
   These are also used by sockets/drivers etc..The inode
    operations only use the representation of the socket/device .
   If any of these functions are not implemented ,it tries to call
    default file operations function,failing which an error is
    returned.Certain functions only make sense for drivers,like
    release,open
Opening Files
   Open : most complicated system call. Authorization to open
    the file is checked,an empty file structure is allocated and
    entered in file decsriptor table of process and open_namei() is
    used to retreive the inode for the file.Performs a lot of tests.
   Name ends in a /.What should be done?
   If O_CREAT is set,What function should this call?
   What about symbolic links,directories?
   Permission is checked with the inode permission list also.
   What about character devices and block devices ?

   Directory cache originated in ext2fs.Directory names are
    cached.It is a 2-level cache with LRU at both levels.Hash key
    is formed by the dev number and the inode number and the
    name.Exports dcache_add,dcache_lookup functions
PROC FILE SYSTEM
   Every process has a directory in /proc/pid which contains files relevant
    to the process.
   VFS function read_super( ) is called by do_mount( ) and in turn calls
    proc_read_super( ) for the proc file system.
   Struct super_block *proc_read_super(struct super_block *s,void *data,
    int silent)
   {
   Lock_super(s);
   Sets some fields in s.
   S->s_op=&proc_sops;
   Unlock_super(s);
   If(!(s->s_mounted=iget(s,PROC_ROOT_INO))) {
   S->s_dev=0;/* free the super block */
   Return NULL;
   }
   Parse_options(data,&s->s_mounted->I_uid,s->s_mounted->I_gid);
   Return s;
   }
PROC FILE SYSTEM…contd
   Some of the invariable entries in the root dircetory entry are
   . , .. ,
    loadavg,uptime,meminfo,kmsg,version,pci,cpuinfo,self,iopo
    rts,profile.
EXT2 File System
 Originally used MINIX file system.Serious limitations like partition
  size,file name size etc.Proposed ext file system which was even
  worse.Led to excessive fragmentation.Remy Card et’al propose ext2fs
  which is the LINUX file system.
 Influenced by BSD FFS.Every partition is divided into a number of block
  groups,corresponding to the cylinder groups of FFS,with each block
  group holding a copy of superblock,inode and data blocks.
STRUCTURE OF E2FS
   What is the basic idea of block groups ?
   The physical superblock contains information on the number
    of inodes,blocks per block groups,time of last mount,last
    write to sb,mount counter,maximum mount
    operations.Padded to a size of 1k bytes.
   Block group descriptors:Information on block groups.Each
    block group is described by a 32 byte desc.Contains block
    numbers in the inode bitmap,block bitmap and inode
    table,number of free inodes,number of free blocks,number of
    directories in this block group.
   Number of directories is made use by allocator to spread files
    evenly.
   Block size=1024bytes => 8192 blocks per block group.
   Inode size=128 Bytes.
Directories in e2fs
   Directories are singly linked lists.
   Struct ext2_dir_entry {
   Unsigned long inode;
   Unsigned short rec_len;
   Unsigned short name_len;
   Char name[EXT2_NAME_LEN];
   };
   What happens on a delete?
Block allocation in e2fs
   Attempts to prevent fragmentation as much as possible.
   Target-oriented allocation.
      Always look for space in the area of target blocks.If this block
    is free use that,otherwise look for a block within 32 blocks from
    this.If not found then try to allocate from the same block
    group.else go to other block groups.
   Pre-allocation:
     If a free block is found then upto 8 of the following blocks are
    reserved if they are free.When a file is closed,the remaining
    blocks that are reserved are released.Also called clustering of
    data blocks.

   How is target block determined?Let n=logical block #,l=logical
    block# of the last block allocated.Then l+1 is a possible target
    block

Mais conteúdo relacionado

Mais procurados

Kernel init
Kernel initKernel init
Kernel initgowell
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernelAdrian Huang
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentalsBimal Jain
 
FUSE Developing Fillesystems in userspace
FUSE Developing Fillesystems in userspaceFUSE Developing Fillesystems in userspace
FUSE Developing Fillesystems in userspaceelliando dias
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linuxLiran Ben Haim
 
Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems senthilamul
 
Linux Kernel Startup Code In Embedded Linux
Linux    Kernel    Startup  Code In  Embedded  LinuxLinux    Kernel    Startup  Code In  Embedded  Linux
Linux Kernel Startup Code In Embedded LinuxEmanuele Bonanni
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot managerAcácio Oliveira
 
บทที่ 3 โครงสร้างของระบบปฏิบัติการ
บทที่ 3 โครงสร้างของระบบปฏิบัติการบทที่ 3 โครงสร้างของระบบปฏิบัติการ
บทที่ 3 โครงสร้างของระบบปฏิบัติการChamp Phinning
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityAndrew Case
 
FUSE and beyond: bridging filesystems slides by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems slides by Emmanuel DreyfusFUSE and beyond: bridging filesystems slides by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems slides by Emmanuel Dreyfuseurobsdcon
 

Mais procurados (20)

Kernel init
Kernel initKernel init
Kernel init
 
Python Fuse
Python FusePython Fuse
Python Fuse
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
Vfs
VfsVfs
Vfs
 
Unix 3 en
Unix 3 enUnix 3 en
Unix 3 en
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
FUSE Developing Fillesystems in userspace
FUSE Developing Fillesystems in userspaceFUSE Developing Fillesystems in userspace
FUSE Developing Fillesystems in userspace
 
PythonFuse (PyCon4)
PythonFuse (PyCon4)PythonFuse (PyCon4)
PythonFuse (PyCon4)
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linux
 
Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems
 
Linux Kernel Startup Code In Embedded Linux
Linux    Kernel    Startup  Code In  Embedded  LinuxLinux    Kernel    Startup  Code In  Embedded  Linux
Linux Kernel Startup Code In Embedded Linux
 
why we need ext4
why we need ext4why we need ext4
why we need ext4
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
101 2.2 install boot manager
101 2.2 install boot manager101 2.2 install boot manager
101 2.2 install boot manager
 
บทที่ 3 โครงสร้างของระบบปฏิบัติการ
บทที่ 3 โครงสร้างของระบบปฏิบัติการบทที่ 3 โครงสร้างของระบบปฏิบัติการ
บทที่ 3 โครงสร้างของระบบปฏิบัติการ
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
FUSE and beyond: bridging filesystems slides by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems slides by Emmanuel DreyfusFUSE and beyond: bridging filesystems slides by Emmanuel Dreyfus
FUSE and beyond: bridging filesystems slides by Emmanuel Dreyfus
 
Linux IO
Linux IOLinux IO
Linux IO
 
Ext filesystem4
Ext filesystem4Ext filesystem4
Ext filesystem4
 

Destaque

Inode explanation
Inode explanationInode explanation
Inode explanationashishkb
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System ImplementationWayne Jones Jnr
 
File management ppt
File management pptFile management ppt
File management pptmarotti
 
File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1Amir Payberah
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File ManagementDamian T. Gordon
 

Destaque (6)

Inode explanation
Inode explanationInode explanation
Inode explanation
 
How inodes Work
How inodes WorkHow inodes Work
How inodes Work
 
Chapter 11 - File System Implementation
Chapter 11 - File System ImplementationChapter 11 - File System Implementation
Chapter 11 - File System Implementation
 
File management ppt
File management pptFile management ppt
File management ppt
 
File System Implementation - Part1
File System Implementation - Part1File System Implementation - Part1
File System Implementation - Part1
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File Management
 

Semelhante a Linux

The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsDivye Kapoor
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxTushar B Kute
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelDivye Kapoor
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsShu-Yu Fu
 
Confraria Security & IT - Lisbon Set 29, 2011
Confraria Security & IT - Lisbon Set 29, 2011Confraria Security & IT - Lisbon Set 29, 2011
Confraria Security & IT - Lisbon Set 29, 2011ricardomcm
 
Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011ricardomcm
 
Char Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesChar Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesYourHelper1
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device driversAlexandre Moreno
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005James Morris
 
Unit 3
Unit  3Unit  3
Unit 3siddr
 
Unix.system.calls
Unix.system.callsUnix.system.calls
Unix.system.callsGRajendra
 
Fuse- Filesystem in User space
Fuse- Filesystem in User space Fuse- Filesystem in User space
Fuse- Filesystem in User space Danny Tseng
 
Writing Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxWriting Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxRajKumar Rampelli
 
Root file system
Root file systemRoot file system
Root file systemBindu U
 
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security FrameworkLecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security FrameworkMohammed Farrag
 
linux file sysytem& input and output
linux file sysytem& input and outputlinux file sysytem& input and output
linux file sysytem& input and outputMythiliA5
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and DriversKernel TLV
 

Semelhante a Linux (20)

The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Part 03 File System Implementation in Linux
Part 03 File System Implementation in LinuxPart 03 File System Implementation in Linux
Part 03 File System Implementation in Linux
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
 
Confraria Security & IT - Lisbon Set 29, 2011
Confraria Security & IT - Lisbon Set 29, 2011Confraria Security & IT - Lisbon Set 29, 2011
Confraria Security & IT - Lisbon Set 29, 2011
 
Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011
 
Char Drivers And Debugging Techniques
Char Drivers And Debugging TechniquesChar Drivers And Debugging Techniques
Char Drivers And Debugging Techniques
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
 
SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005SELinux Kernel Internals and Architecture - FOSS.IN/2005
SELinux Kernel Internals and Architecture - FOSS.IN/2005
 
Unit 3
Unit  3Unit  3
Unit 3
 
Unix.system.calls
Unix.system.callsUnix.system.calls
Unix.system.calls
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Fuse- Filesystem in User space
Fuse- Filesystem in User space Fuse- Filesystem in User space
Fuse- Filesystem in User space
 
1 04 rao
1 04 rao1 04 rao
1 04 rao
 
Writing Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxWriting Character driver (loadable module) in linux
Writing Character driver (loadable module) in linux
 
Root file system
Root file systemRoot file system
Root file system
 
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security FrameworkLecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework
Lecture 4 FreeBSD Security + FreeBSD Jails + MAC Security Framework
 
linux file sysytem& input and output
linux file sysytem& input and outputlinux file sysytem& input and output
linux file sysytem& input and output
 
FreeBSD and Drivers
FreeBSD and DriversFreeBSD and Drivers
FreeBSD and Drivers
 
Linux security
Linux securityLinux security
Linux security
 

Mais de keydak11

Sociedad del conocimiento
Sociedad del conocimientoSociedad del conocimiento
Sociedad del conocimientokeydak11
 
Aulas virtuales
Aulas virtualesAulas virtuales
Aulas virtualeskeydak11
 
La investigación científica
La investigación científicaLa investigación científica
La investigación científicakeydak11
 
Disco duro virtual
Disco duro virtualDisco duro virtual
Disco duro virtualkeydak11
 
Fuente de alimentación
Fuente de alimentaciónFuente de alimentación
Fuente de alimentaciónkeydak11
 
Componentes de una pc
Componentes de una pcComponentes de una pc
Componentes de una pckeydak11
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan  tipos de topologias de redTrabajo del profesor cesar farfan  tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redkeydak11
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redTrabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redkeydak11
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redTrabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redkeydak11
 

Mais de keydak11 (9)

Sociedad del conocimiento
Sociedad del conocimientoSociedad del conocimiento
Sociedad del conocimiento
 
Aulas virtuales
Aulas virtualesAulas virtuales
Aulas virtuales
 
La investigación científica
La investigación científicaLa investigación científica
La investigación científica
 
Disco duro virtual
Disco duro virtualDisco duro virtual
Disco duro virtual
 
Fuente de alimentación
Fuente de alimentaciónFuente de alimentación
Fuente de alimentación
 
Componentes de una pc
Componentes de una pcComponentes de una pc
Componentes de una pc
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan  tipos de topologias de redTrabajo del profesor cesar farfan  tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de red
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redTrabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de red
 
Trabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de redTrabajo del profesor cesar farfan tipos de topologias de red
Trabajo del profesor cesar farfan tipos de topologias de red
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Linux

  • 1. LINUX FILE SYSTEM V.N.Murali CSE-597A Presentation 03/29/2001, ACKNOWLEDGEMENT: a)LINUX KERNEL INTERNALS BECK,BOHM et al b)THE LINUX KERNEL DAVID GOSLING.
  • 2. Virtual File System Switch  Supplies applications with the system calls for file system management.  Specific focus on ext2fs and procfs of LINUX.  Different types of files are possible:regular files,directories,device files,fifo’s,pipes,symbolic links,sockets.  Meta data information kept separately.”inodes” are used for describing files.
  • 6. FEATURES OF UNIX FILE SYSTEMS  Boot Block : Will it always be present?  SuperBlock:Information for managing file systems  InodeBlocks:inode structures for the file system.  DataBlocks:blocks for files,directories..etc  Mounting,Unmounting file systems
  • 7. Representation of File systems  Management structures for file systems is similar to logical structure of UNIX file system.  VFS responsible for calling file-system specific implementations. How does VFS know which filesystems are configured?  Void register_filesystem(struct file_system_type *);  Configured at boot-time and possibly loaded as modules as well.  struct file_system_type { – Const char *name; – Int fs_flags; – Struct super_block *(*read_super)(struct super_block*,void *,int); – #ifdef VERSION > 2.4 – Struct module *owner; – Struct vfsmount *kern_mnt; – #endif – Struct file_system_type *next; – };
  • 8. Mounting  Any file system in UNIX must be mounted before it can be accessed,either through mount() or mount_root().  What is mount_root() ?  Representation of a mounted file system : struct super_block.Limited to NR_SUPER.  It is initialized by the function “read_super” in the VFS.It interrogates floppy disks,CD-ROM for a change of media,tests if superblock is present and if so returns it.else it calls the fs-specific function to create a superblock.  File system specific Read_super() reads its data from the block device using the LINUX cache functions,bread,brw_page.Processes may be put to sleep when reading/writing or mounting file systems.
  • 9. Superblock  struct super_block { – kdev_t s_dev;/* device */ – unsigned long s_blocksize;/* block size */ – unsigned char s_blocksize_bits;/* ld(block size) */ – unsigned char s_lock;/* superblock lock */ – unsigned char s_rd_only; – Unsigned char s_dirt; – Struct file_system_type *s_type; – Struct super_operations *s_op; – Unsigned long s_flags; – Unsigned long s_magic; – Unsigned long s_time; – Struct inode *s_covered;/* mount point */ – Struct inode *s_mounted; /* root inode */ – Struct wait_queue *s_wait;/* s_lock wait queue */ – Union {  Struct minix_sb_info minix_sb;  Struct ext2_sb_info ext2_sb;  ….  Void *generic_sb;  }u;
  • 10. Locking/Unlocking superblock  Lock_super(struct super_block *sb)  { – If(sb->s_lock) __wait_on_super(sb); – Sb->s_lock=1; – } – unlock_super(struct super_block *sb) – { – sb->s_lock=0; – wake_up(&sb->s_wait); – } – The read_super( ) function in the file system specific implementation should also make the root inode available using the function iget( );
  • 11. Superblock operations  s_op points to a vector of functions for accessing the file system.  struct super_operations {  void (*read_inode)(struct inode *);  Int (*notify_change)(struct inode *,struct iattr *);  Void (*write_inode)(struct inode *);  Void (*put_inode)(struct inode *);  Void (*put_super)(struct super_block *);  Void (*write_super)(struct super_block *);  Void (*statfs)(struct super_block *,struct statfs *);  Void (*remount_fs)(struct super_block *,int *,char *);  };  These functions serve to translate the specific representation of the superblock and inode on data media to their general form in memory and vice-versa.Does every file system have a superblock and inode?  Elaborating a little more…
  • 12. Write_super(sb) : saves info on super block.Used in synchronising the device.dirty bit is set in buffer.  Put_super(sb) : Called when unmounting file systems.Releases super_block and buffers used.restores consistency if necessary.super_block structure can be reused.  Statfs(sb,statfsbuf) : fills the statfs structure with file system information.  Remount_fs(sb,flags,options) : new attributes for file system and restoring consistency.  Read_inode(inode) : fills in the inode structure.Marks different file types by using different inode_operations struct.for example  If(S_ISREG(inode->I_mode)  Inode->I_op=&ext2_file_inode_operations;  Else if(S_ISDIR(inode->I_mode)  Inode->I_op=&ext2_dir_inode_operations;  Else if(S_ISLNK(inode->I-mode)  Inode->I_op=&ext2_symlink_inode_operations;  …….Similiarly for character devices,block devices,fifos,etc
  • 13. Notify_change(inode,attr) : changes made to inode are acknowledged by this function.It is of interest only in NFS/ Coda etc.Why?Each file on such a system has a local and a remote inode.The remote file system is informed of the change using iattr.  Write_inode(inode) : saves inode structure.  Put_inode(inode) : if inode is no longer required.Called when deleting file and release its blocks.
  • 14. INODE  Struct inode {  Kdev_t I_dev;  Unsigned long I_ino;  Umode_t I_mode;  Nlink_t I_nlinkl;  Uid,gid etc….  Dev_t I_rdev; /* only if device special file */  Offset,times of modification,access,creation etc  Struct semaphore *I_sem;  Struct inode_operations *I_op;  Struct super_block *I_sb;  Struct wait_queue (I_wait;  Struct file_lock *I_flock;  Struct vm_area_struct *I_mmap;  Struct inode *I_next,*I_prev;  Struct inode *I_hash_next,*I_hash_prev;  Struct inode *I_boundto;
  • 15. INODE…contd  Struct inode *I_mount;  Struct socket *I_socket;  Reference_counter,flags,lock,bits that denote if this is a pipe,socket.  Union {  Struct pipe_node_info pipe_i;  Struct minix_inode_info minix_i;  ….  Void *generic_ip;  }u;  };  Inodes are managed as doubly linked lists as well as a hash table.starts with first_inode(/ inode).iget() function can be used to get the inode specified by the superblock.It uses hints to resolve cross mounted file systems as well.Any access to inode increments a usage counter.Analogous function iput( ).
  • 16. Inode Operations  Struct inode_operations {  Struct file_operations *default_file_ops;  Int (*create)(struct inode *,const char *,int,int,struct inode **);  Int (*lookup)(struct inode *,const char *,int,struct inode **);  Int (*link)(struct inode *,struct inode *,const char *,int);  Int (*unlink)(struct inode *,const char *,int);  Int (*symlink)(struct inode *,const char *,int);  Int (*mkdir)(struct inode *,const char *,int);  Similiarly we have rmdir,mknod,rename,readlink,follow_link,bmap,truncate,perm ission,smap.  NOTE :All these functions are directly called from the implementation of the corresponding system call.
  • 17. File System Calls.  Create(),lookup(),link(),unlink(),symlink(),mkdir(),rmdir(),  mknod(),rename(),readlink(),follow_link()  Bmap() : used for mmap’ing files .This function is called by the function generic_mmap() to map a block of data from file to an address in the user space.  Smap():allows swap files to be created on a UMSDOS file system.  To allow for shared accesses to files,UNIX introduced an extra structure.  Struct file {  Mode_t f_mode;  Loff_t f_pos;  Unsigned short f_flags;  Unsigned short f_count;  Off_t f_reada;/* readahead flag */  Struct file *f_next,*f_prev;  Struct inode *f_inode;  Struct file_operations *f_op;  Void *private_data;  };
  • 18. File Operations .  General interface to work on files,Has functions to open,close,read,write etc.Why are these isolated from inode_operations?These operations also need to modify struct file.Hence.  Struct file_operations {  Struct module *owner;  Int (*lseek)(…)  Read,write,readdir,select,ioctl,mmap,open,release,fsync,fasyn c,check_media_change,revalidate..  These are also used by sockets/drivers etc..The inode operations only use the representation of the socket/device .  If any of these functions are not implemented ,it tries to call default file operations function,failing which an error is returned.Certain functions only make sense for drivers,like release,open
  • 19. Opening Files  Open : most complicated system call. Authorization to open the file is checked,an empty file structure is allocated and entered in file decsriptor table of process and open_namei() is used to retreive the inode for the file.Performs a lot of tests.  Name ends in a /.What should be done?  If O_CREAT is set,What function should this call?  What about symbolic links,directories?  Permission is checked with the inode permission list also.  What about character devices and block devices ?  Directory cache originated in ext2fs.Directory names are cached.It is a 2-level cache with LRU at both levels.Hash key is formed by the dev number and the inode number and the name.Exports dcache_add,dcache_lookup functions
  • 20. PROC FILE SYSTEM  Every process has a directory in /proc/pid which contains files relevant to the process.  VFS function read_super( ) is called by do_mount( ) and in turn calls proc_read_super( ) for the proc file system.  Struct super_block *proc_read_super(struct super_block *s,void *data, int silent)  {  Lock_super(s);  Sets some fields in s.  S->s_op=&proc_sops;  Unlock_super(s);  If(!(s->s_mounted=iget(s,PROC_ROOT_INO))) {  S->s_dev=0;/* free the super block */  Return NULL;  }  Parse_options(data,&s->s_mounted->I_uid,s->s_mounted->I_gid);  Return s;  }
  • 21. PROC FILE SYSTEM…contd  Some of the invariable entries in the root dircetory entry are  . , .. , loadavg,uptime,meminfo,kmsg,version,pci,cpuinfo,self,iopo rts,profile.
  • 22. EXT2 File System  Originally used MINIX file system.Serious limitations like partition size,file name size etc.Proposed ext file system which was even worse.Led to excessive fragmentation.Remy Card et’al propose ext2fs which is the LINUX file system.  Influenced by BSD FFS.Every partition is divided into a number of block groups,corresponding to the cylinder groups of FFS,with each block group holding a copy of superblock,inode and data blocks.
  • 23. STRUCTURE OF E2FS  What is the basic idea of block groups ?  The physical superblock contains information on the number of inodes,blocks per block groups,time of last mount,last write to sb,mount counter,maximum mount operations.Padded to a size of 1k bytes.  Block group descriptors:Information on block groups.Each block group is described by a 32 byte desc.Contains block numbers in the inode bitmap,block bitmap and inode table,number of free inodes,number of free blocks,number of directories in this block group.  Number of directories is made use by allocator to spread files evenly.  Block size=1024bytes => 8192 blocks per block group.  Inode size=128 Bytes.
  • 24. Directories in e2fs  Directories are singly linked lists.  Struct ext2_dir_entry {  Unsigned long inode;  Unsigned short rec_len;  Unsigned short name_len;  Char name[EXT2_NAME_LEN];  };  What happens on a delete?
  • 25. Block allocation in e2fs  Attempts to prevent fragmentation as much as possible.  Target-oriented allocation.  Always look for space in the area of target blocks.If this block is free use that,otherwise look for a block within 32 blocks from this.If not found then try to allocate from the same block group.else go to other block groups.  Pre-allocation:  If a free block is found then upto 8 of the following blocks are reserved if they are free.When a file is closed,the remaining blocks that are reserved are released.Also called clustering of data blocks.  How is target block determined?Let n=logical block #,l=logical block# of the last block allocated.Then l+1 is a possible target block

Notas do Editor

  1. Functions are made known to the VFS via the function “register_filesystem”
  2. Sets up the first file system.called by system call setup() after all file systems have been registered.setup() is called after init is created.Why is a system call required here?User mode process.
  3. Some of the operations listed in the superblock may be NULL in which case no action will take place.
  4. Inode operations create.
  5. Keep data blocks close to inode,file inodes close to directory inode.
  6. Don’t push/move the buffers around.Just change the value of the previous entry’s reclen to include this entry as well.Zero the inode number also.It can be reclaimed easily as well.
  7. Don’t push/move the buffers around.Just change the value of the previous entry’s reclen to include this entry as well.Zero the inode number also.It can be reclaimed easily as well.