Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
super.c File Reference
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/acct.h>
#include <linux/blkdev.h>
#include <linux/mount.h>
#include <linux/security.h>
#include <linux/writeback.h>
#include <linux/idr.h>
#include <linux/mutex.h>
#include <linux/backing-dev.h>
#include <linux/rculist_bl.h>
#include <linux/cleancache.h>
#include <linux/fsnotify.h>
#include <linux/lockdep.h>
#include "internal.h"

Go to the source code of this file.

Functions

 LIST_HEAD (super_blocks)
 
 DEFINE_SPINLOCK (sb_lock)
 
void deactivate_locked_super (struct super_block *s)
 
 EXPORT_SYMBOL (deactivate_locked_super)
 
void deactivate_super (struct super_block *s)
 
 EXPORT_SYMBOL (deactivate_super)
 
bool grab_super_passive (struct super_block *sb)
 
void generic_shutdown_super (struct super_block *sb)
 
 EXPORT_SYMBOL (generic_shutdown_super)
 
struct super_blocksget (struct file_system_type *type, int(*test)(struct super_block *, void *), int(*set)(struct super_block *, void *), int flags, void *data)
 
 EXPORT_SYMBOL (sget)
 
void drop_super (struct super_block *sb)
 
 EXPORT_SYMBOL (drop_super)
 
void iterate_supers (void(*f)(struct super_block *, void *), void *arg)
 
void iterate_supers_type (struct file_system_type *type, void(*f)(struct super_block *, void *), void *arg)
 
 EXPORT_SYMBOL (iterate_supers_type)
 
struct super_blockget_super (struct block_device *bdev)
 
 EXPORT_SYMBOL (get_super)
 
struct super_blockget_super_thawed (struct block_device *bdev)
 
 EXPORT_SYMBOL (get_super_thawed)
 
struct super_blockget_active_super (struct block_device *bdev)
 
struct super_blockuser_get_super (dev_t dev)
 
int do_remount_sb (struct super_block *sb, int flags, void *data, int force)
 
void emergency_remount (void)
 
int get_anon_bdev (dev_t *p)
 
 EXPORT_SYMBOL (get_anon_bdev)
 
void free_anon_bdev (dev_t dev)
 
 EXPORT_SYMBOL (free_anon_bdev)
 
int set_anon_super (struct super_block *s, void *data)
 
 EXPORT_SYMBOL (set_anon_super)
 
void kill_anon_super (struct super_block *sb)
 
 EXPORT_SYMBOL (kill_anon_super)
 
void kill_litter_super (struct super_block *sb)
 
 EXPORT_SYMBOL (kill_litter_super)
 
struct dentrymount_ns (struct file_system_type *fs_type, int flags, void *data, int(*fill_super)(struct super_block *, void *, int))
 
 EXPORT_SYMBOL (mount_ns)
 
struct dentrymount_nodev (struct file_system_type *fs_type, int flags, void *data, int(*fill_super)(struct super_block *, void *, int))
 
 EXPORT_SYMBOL (mount_nodev)
 
struct dentrymount_single (struct file_system_type *fs_type, int flags, void *data, int(*fill_super)(struct super_block *, void *, int))
 
 EXPORT_SYMBOL (mount_single)
 
struct dentrymount_fs (struct file_system_type *type, int flags, const char *name, void *data)
 
void __sb_end_write (struct super_block *sb, int level)
 
 EXPORT_SYMBOL (__sb_end_write)
 
int __sb_start_write (struct super_block *sb, int level, bool wait)
 
 EXPORT_SYMBOL (__sb_start_write)
 
int freeze_super (struct super_block *sb)
 
 EXPORT_SYMBOL (freeze_super)
 
int thaw_super (struct super_block *sb)
 
 EXPORT_SYMBOL (thaw_super)
 

Function Documentation

void __sb_end_write ( struct super_block sb,
int  level 
)

Definition at line 1151 of file super.c.

int __sb_start_write ( struct super_block sb,
int  level,
bool  wait 
)

Definition at line 1195 of file super.c.

void deactivate_locked_super ( struct super_block s)

deactivate_locked_super - drop an active reference to superblock : superblock to deactivate

Drops an active reference to superblock, converting it into a temprory one if there is no other active references left. In that case we tell fs driver to shut it down and drop the temporary reference we had just acquired.

Caller holds exclusive lock on superblock; that lock is released.

Definition at line 294 of file super.c.

void deactivate_super ( struct super_block s)

deactivate_super - drop an active reference to superblock : superblock to deactivate

Variant of deactivate_locked_super(), except that superblock is not locked by caller. If we are going to drop the final active reference, lock will be acquired prior to that.

Definition at line 320 of file super.c.

DEFINE_SPINLOCK ( sb_lock  )
int do_remount_sb ( struct super_block sb,
int  flags,
void data,
int  force 
)

do_remount_sb - asks filesystem to change mount options. : superblock in question : numeric part of options : the rest of options : whether or not to force the change

Alters the mount options of a mounted file system.

Definition at line 711 of file super.c.

void drop_super ( struct super_block sb)

Definition at line 502 of file super.c.

void emergency_remount ( void  )

Definition at line 806 of file super.c.

EXPORT_SYMBOL ( deactivate_locked_super  )
EXPORT_SYMBOL ( deactivate_super  )
EXPORT_SYMBOL ( generic_shutdown_super  )
EXPORT_SYMBOL ( sget  )
EXPORT_SYMBOL ( drop_super  )
EXPORT_SYMBOL ( iterate_supers_type  )
EXPORT_SYMBOL ( get_super  )
EXPORT_SYMBOL ( get_super_thawed  )
EXPORT_SYMBOL ( get_anon_bdev  )
EXPORT_SYMBOL ( free_anon_bdev  )
EXPORT_SYMBOL ( set_anon_super  )
EXPORT_SYMBOL ( kill_anon_super  )
EXPORT_SYMBOL ( kill_litter_super  )
EXPORT_SYMBOL ( mount_ns  )
EXPORT_SYMBOL ( mount_nodev  )
EXPORT_SYMBOL ( mount_single  )
EXPORT_SYMBOL ( __sb_end_write  )
EXPORT_SYMBOL ( __sb_start_write  )
EXPORT_SYMBOL ( freeze_super  )
EXPORT_SYMBOL ( thaw_super  )
void free_anon_bdev ( dev_t  dev)

Definition at line 858 of file super.c.

int freeze_super ( struct super_block sb)

freeze_super - lock the filesystem and force it into a consistent state : the super to lock

Syncs the super to make sure the filesystem is consistent and calls the fs's freeze_fs. Subsequent calls to this without first thawing the fs will return -EBUSY.

During this function, sb->s_writers.frozen goes through these values:

SB_UNFROZEN: File system is normal, all writes progress as usual.

SB_FREEZE_WRITE: The file system is in the process of being frozen. New writes should be blocked, though page faults are still allowed. We wait for all writes to complete and then proceed to the next stage.

SB_FREEZE_PAGEFAULT: Freezing continues. Now also page faults are blocked but internal fs threads can still modify the filesystem (although they should not dirty new pages or inodes), writeback can run etc. After waiting for all running page faults we sync the filesystem which will clean all dirty pages and inodes (no new dirty pages or inodes can be created when sync is running).

SB_FREEZE_FS: The file system is frozen. Now all internal sources of fs modification are blocked (e.g. XFS preallocation truncation on inode reclaim). This is usually implemented by blocking new transactions for filesystems that have them and need this additional guard. After all internal writers are finished we call ->freeze_fs() to finish filesystem freezing. Then we transition to SB_FREEZE_COMPLETE state. This state is mostly auxiliary for filesystems to verify they do not modify frozen fs.

sb->s_writers.frozen is protected by sb->s_umount.

Definition at line 1294 of file super.c.

void generic_shutdown_super ( struct super_block sb)

generic_shutdown_super - common helper for ->kill_sb() : superblock to kill

generic_shutdown_super() does all fs-independent work on superblock shutdown. Typical ->kill_sb() should pick all fs-specific objects that need destruction out of superblock, call generic_shutdown_super() and release aforementioned objects. Note: dentries and inodes are taken care of and do not need specific handling.

Upon calling this function, the filesystem may no longer alter or rearrange the set of dentries belonging to this super_block, nor may it change the attachments of dentries to inodes.

Definition at line 404 of file super.c.

struct super_block* get_active_super ( struct block_device bdev)
read

get_active_super - get an active reference to the superblock of a device : device to get the superblock for

Scans the superblock list and finds the superblock of the file system mounted on the device given. Returns the superblock with an active reference or NULL if none was found.

Definition at line 652 of file super.c.

int get_anon_bdev ( dev_t p)

Definition at line 826 of file super.c.

struct super_block* get_super ( struct block_device bdev)
read

get_super - get the superblock of a device : device to get the superblock for

Scans the superblock list and finds the superblock of the file system mounted on the device given. NULL is returned if no match is found.

Definition at line 589 of file super.c.

struct super_block* get_super_thawed ( struct block_device bdev)
read

get_super_thawed - get thawed superblock of a device : device to get the superblock for

Scans the superblock list and finds the superblock of the file system mounted on the device. The superblock is returned once it is thawed (or immediately if it was not frozen). NULL is returned if no match is found.

Definition at line 630 of file super.c.

bool grab_super_passive ( struct super_block sb)

Definition at line 369 of file super.c.

void iterate_supers ( void(*)(struct super_block *, void *)  f,
void arg 
)

iterate_supers - call function for all active superblocks : function to call

  • : argument to pass to it

Scans the superblock list and calls given function, passing it locked superblock and given argument.

Definition at line 518 of file super.c.

void iterate_supers_type ( struct file_system_type type,
void(*)(struct super_block *, void *)  f,
void arg 
)

iterate_supers_type - call function for superblocks of given type : fs type : function to call

  • : argument to pass to it

Scans the superblock list and calls given function, passing it locked superblock and given argument.

Definition at line 553 of file super.c.

void kill_anon_super ( struct super_block sb)

Definition at line 879 of file super.c.

void kill_litter_super ( struct super_block sb)

Definition at line 888 of file super.c.

LIST_HEAD ( super_blocks  )
struct dentry* mount_fs ( struct file_system_type type,
int  flags,
const char name,
void data 
)
read

Definition at line 1094 of file super.c.

struct dentry* mount_nodev ( struct file_system_type fs_type,
int  flags,
void data,
int(*)(struct super_block *, void *, int fill_super 
)
read

Definition at line 1044 of file super.c.

struct dentry* mount_ns ( struct file_system_type fs_type,
int  flags,
void data,
int(*)(struct super_block *, void *, int fill_super 
)
read

Definition at line 908 of file super.c.

struct dentry* mount_single ( struct file_system_type fs_type,
int  flags,
void data,
int(*)(struct super_block *, void *, int fill_super 
)
read

Definition at line 1069 of file super.c.

int set_anon_super ( struct super_block s,
void data 
)

Definition at line 869 of file super.c.

struct super_block* sget ( struct file_system_type type,
int(*)(struct super_block *, void *)  test,
int(*)(struct super_block *, void *)  set,
int  flags,
void data 
)
read

sget - find or create a superblock : filesystem type superblock should belong to

Test:
: comparison callback : setup callback : mount flags : argument to each of them

Definition at line 443 of file super.c.

int thaw_super ( struct super_block sb)

thaw_super – unlock filesystem : the super to thaw

Unlocks the filesystem and marks it writeable again after freeze_super().

Definition at line 1369 of file super.c.

struct super_block* user_get_super ( dev_t  dev)
read

Definition at line 675 of file super.c.