Linux Kernel
3.7.1
|
#include <linux/linkage.h>
#include <linux/wait.h>
#include <linux/kdev_t.h>
#include <linux/dcache.h>
#include <linux/path.h>
#include <linux/stat.h>
#include <linux/cache.h>
#include <linux/list.h>
#include <linux/radix-tree.h>
#include <linux/rbtree.h>
#include <linux/init.h>
#include <linux/pid.h>
#include <linux/bug.h>
#include <linux/mutex.h>
#include <linux/capability.h>
#include <linux/semaphore.h>
#include <linux/fiemap.h>
#include <linux/rculist_bl.h>
#include <linux/atomic.h>
#include <linux/shrinker.h>
#include <linux/migrate_mode.h>
#include <linux/uidgid.h>
#include <linux/lockdep.h>
#include <linux/percpu-rwsem.h>
#include <linux/blk_types.h>
#include <asm/byteorder.h>
#include <uapi/linux/fs.h>
#include <linux/quota.h>
#include <linux/nfs_fs_i.h>
#include <linux/fcntl.h>
#include <linux/err.h>
Go to the source code of this file.
Data Structures | |
struct | iattr |
struct | iov_iter |
struct | read_descriptor_t |
struct | address_space_operations |
struct | address_space |
struct | block_device |
struct | inode |
struct | fown_struct |
struct | file_ra_state |
struct | file |
struct | file_handle |
struct | file_lock_operations |
struct | lock_manager_operations |
struct | lock_manager |
struct | file_lock |
struct | fasync_struct |
struct | sb_writers |
struct | super_block |
struct | fiemap_extent_info |
struct | file_operations |
struct | inode_operations |
struct | super_operations |
struct | file_system_type |
struct | filename |
struct | tree_descr |
struct | simple_transaction_argresp |
Macros | |
#define | MAY_EXEC 0x00000001 |
#define | MAY_WRITE 0x00000002 |
#define | MAY_READ 0x00000004 |
#define | MAY_APPEND 0x00000008 |
#define | MAY_ACCESS 0x00000010 |
#define | MAY_OPEN 0x00000020 |
#define | MAY_CHDIR 0x00000040 |
#define | MAY_NOT_BLOCK 0x00000080 |
#define | FMODE_READ ((__force fmode_t)0x1) |
#define | FMODE_WRITE ((__force fmode_t)0x2) |
#define | FMODE_LSEEK ((__force fmode_t)0x4) |
#define | FMODE_PREAD ((__force fmode_t)0x8) |
#define | FMODE_PWRITE ((__force fmode_t)0x10) |
#define | FMODE_EXEC ((__force fmode_t)0x20) |
#define | FMODE_NDELAY ((__force fmode_t)0x40) |
#define | FMODE_EXCL ((__force fmode_t)0x80) |
#define | FMODE_WRITE_IOCTL ((__force fmode_t)0x100) |
#define | FMODE_32BITHASH ((__force fmode_t)0x200) |
#define | FMODE_64BITHASH ((__force fmode_t)0x400) |
#define | FMODE_NOCMTIME ((__force fmode_t)0x800) |
#define | FMODE_RANDOM ((__force fmode_t)0x1000) |
#define | FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) |
#define | FMODE_PATH ((__force fmode_t)0x4000) |
#define | FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
#define | CHECK_IOVEC_ONLY -1 |
#define | RW_MASK REQ_WRITE |
#define | RWA_MASK REQ_RAHEAD |
#define | READ 0 |
#define | WRITE RW_MASK |
#define | READA RWA_MASK |
#define | KERNEL_READ (READ|REQ_KERNEL) |
#define | KERNEL_WRITE (WRITE|REQ_KERNEL) |
#define | READ_SYNC (READ | REQ_SYNC) |
#define | WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) |
#define | WRITE_ODIRECT (WRITE | REQ_SYNC) |
#define | WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) |
#define | WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) |
#define | WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) |
#define | ATTR_MODE (1 << 0) |
#define | ATTR_UID (1 << 1) |
#define | ATTR_GID (1 << 2) |
#define | ATTR_SIZE (1 << 3) |
#define | ATTR_ATIME (1 << 4) |
#define | ATTR_MTIME (1 << 5) |
#define | ATTR_CTIME (1 << 6) |
#define | ATTR_ATIME_SET (1 << 7) |
#define | ATTR_MTIME_SET (1 << 8) |
#define | ATTR_FORCE (1 << 9) /* Not a change, but a change it */ |
#define | ATTR_ATTR_FLAG (1 << 10) |
#define | ATTR_KILL_SUID (1 << 11) |
#define | ATTR_KILL_SGID (1 << 12) |
#define | ATTR_FILE (1 << 13) |
#define | ATTR_KILL_PRIV (1 << 14) |
#define | ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */ |
#define | ATTR_TIMES_SET (1 << 16) |
#define | AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ |
#define | AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ |
#define | AOP_FLAG_NOFS |
#define | PAGECACHE_TAG_DIRTY 0 |
#define | PAGECACHE_TAG_WRITEBACK 1 |
#define | PAGECACHE_TAG_TOWRITE 2 |
#define | i_size_ordered_init(inode) do { } while (0) |
#define | ACL_NOT_CACHED ((void *)(-1)) |
#define | IOP_FASTPERM 0x0001 |
#define | IOP_LOOKUP 0x0002 |
#define | IOP_NOFOLLOW 0x0004 |
#define | FILE_MNT_WRITE_TAKEN 1 |
#define | FILE_MNT_WRITE_RELEASED 2 |
#define | f_dentry f_path.dentry |
#define | f_vfsmnt f_path.mnt |
#define | fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
#define | file_count(x) atomic_long_read(&(x)->f_count) |
#define | MAX_NON_LFS ((1UL<<31) - 1) |
#define | FL_POSIX 1 |
#define | FL_FLOCK 2 |
#define | FL_ACCESS 8 /* not trying to lock, just looking */ |
#define | FL_EXISTS 16 /* when unlocking, test for existence */ |
#define | FL_LEASE 32 /* lease held on this file */ |
#define | FL_CLOSE 64 /* unlock on close */ |
#define | FL_SLEEP 128 /* A blocking lock */ |
#define | FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */ |
#define | FL_UNLOCK_PENDING 512 /* Lease is being broken */ |
#define | FILE_LOCK_DEFERRED 1 |
#define | INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1))) |
#define | OFFSET_MAX INT_LIMIT(loff_t) |
#define | OFFT_OFFSET_MAX INT_LIMIT(off_t) |
#define | FASYNC_MAGIC 0x4601 |
#define | MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ |
#define | MNT_DETACH 0x00000002 /* Just detach from the tree */ |
#define | MNT_EXPIRE 0x00000004 /* Mark for expiry */ |
#define | UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ |
#define | UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ |
#define | SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1) |
#define | DT_UNKNOWN 0 |
#define | DT_FIFO 1 |
#define | DT_CHR 2 |
#define | DT_DIR 4 |
#define | DT_BLK 6 |
#define | DT_REG 8 |
#define | DT_LNK 10 |
#define | DT_SOCK 12 |
#define | DT_WHT 14 |
#define | HAVE_COMPAT_IOCTL 1 |
#define | HAVE_UNLOCKED_IOCTL 1 |
#define | S_SYNC 1 /* Writes are synced at once */ |
#define | S_NOATIME 2 /* Do not update access times */ |
#define | S_APPEND 4 /* Append-only file */ |
#define | S_IMMUTABLE 8 /* Immutable file */ |
#define | S_DEAD 16 /* removed, but still open directory */ |
#define | S_NOQUOTA 32 /* Inode is not counted to quota */ |
#define | S_DIRSYNC 64 /* Directory modifications are synchronous */ |
#define | S_NOCMTIME 128 /* Do not update file c/mtime */ |
#define | S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
#define | S_PRIVATE 512 /* Inode is fs-internal */ |
#define | S_IMA 1024 /* Inode has an associated IMA struct */ |
#define | S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */ |
#define | S_NOSEC 4096 /* no suid or xattr security attributes */ |
#define | __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg)) |
#define | IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) |
#define | IS_SYNC(inode) |
#define | IS_DIRSYNC(inode) |
#define | IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) |
#define | IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) |
#define | IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION) |
#define | IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) |
#define | IS_APPEND(inode) ((inode)->i_flags & S_APPEND) |
#define | IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) |
#define | IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) |
#define | IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) |
#define | IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
#define | IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) |
#define | IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) |
#define | IS_IMA(inode) ((inode)->i_flags & S_IMA) |
#define | IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) |
#define | IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) |
#define | I_DIRTY_SYNC (1 << 0) |
#define | I_DIRTY_DATASYNC (1 << 1) |
#define | I_DIRTY_PAGES (1 << 2) |
#define | __I_NEW 3 |
#define | I_NEW (1 << __I_NEW) |
#define | I_WILL_FREE (1 << 4) |
#define | I_FREEING (1 << 5) |
#define | I_CLEAR (1 << 6) |
#define | __I_SYNC 7 |
#define | I_SYNC (1 << __I_SYNC) |
#define | I_REFERENCED (1 << 8) |
#define | __I_DIO_WAKEUP 9 |
#define | I_DIO_WAKEUP (1 << I_DIO_WAKEUP) |
#define | I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
#define | FS_REQUIRES_DEV 1 |
#define | FS_BINARY_MOUNTDATA 2 |
#define | FS_HAS_SUBTYPE 4 |
#define | FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ |
#define | FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ |
#define | fops_get(fops) (((fops) && try_module_get((fops)->owner) ? (fops) : NULL)) |
#define | fops_put(fops) do { if (fops) module_put((fops)->owner); } while(0) |
#define | kern_mount(type) kern_mount_data(type, NULL) |
#define | MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) |
#define | FLOCK_VERIFY_READ 1 |
#define | FLOCK_VERIFY_WRITE 2 |
#define | __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) |
#define | __putname(name) kmem_cache_free(names_cachep, (void *)(name)) |
#define | putname(name) final_putname(name) |
#define | CHRDEV_MAJOR_HASH_SIZE 255 |
#define | BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
#define | BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */ |
#define | BLKDEV_MAJOR_HASH_SIZE 0 |
#define | special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) |
#define | buffer_migrate_page NULL |
#define | SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp)) |
#define | DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) |
#define | __FMODE_EXEC ((__force int) FMODE_EXEC) |
#define | __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY) |
#define | ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) |
#define | OPEN_FMODE(flag) |
Typedefs | |
typedef int( | get_block_t )(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) |
typedef void( | dio_iodone_t )(struct kiocb *iocb, loff_t offset, ssize_t bytes, void *private, int ret, bool is_async) |
typedef int(* | read_actor_t )(read_descriptor_t *, struct page *, unsigned long, unsigned long) |
typedef struct files_struct * | fl_owner_t |
typedef int(* | filldir_t )(void *, const char *, int, loff_t, u64, unsigned) |
Enumerations | |
enum | positive_aop_returns { AOP_WRITEPAGE_ACTIVATE = 0x80000, AOP_TRUNCATED_PAGE = 0x80001 } |
enum | inode_i_mutex_lock_class { I_MUTEX_NORMAL, I_MUTEX_PARENT, I_MUTEX_CHILD, I_MUTEX_XATTR, I_MUTEX_QUOTA } |
enum | { SB_UNFROZEN = 0, SB_FREEZE_WRITE = 1, SB_FREEZE_PAGEFAULT = 2, SB_FREEZE_FS = 3, SB_FREEZE_COMPLETE = 4 } |
enum | file_time_flags { S_ATIME = 1, S_MTIME = 2, S_CTIME = 4, S_VERSION = 8 } |
enum | { FILE_CREATED = 1, FILE_OPENED = 2 } |
#define __FMODE_EXEC ((__force int) FMODE_EXEC) |
#define __FMODE_NONOTIFY ((__force int) FMODE_NONOTIFY) |
#define __getname | ( | ) | kmem_cache_alloc(names_cachep, GFP_KERNEL) |
#define __putname | ( | name | ) | kmem_cache_free(names_cachep, (void *)(name)) |
#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ |
#define AOP_FLAG_NOFS |
#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ |
#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ |
#define DEFINE_SIMPLE_ATTRIBUTE | ( | __fops, | |
__get, | |||
__set, | |||
__fmt | |||
) |
#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */ |
#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
#define IS_AUTOMOUNT | ( | inode | ) | ((inode)->i_flags & S_AUTOMOUNT) |
#define IS_DIRSYNC | ( | inode | ) |
#define IS_IMMUTABLE | ( | inode | ) | ((inode)->i_flags & S_IMMUTABLE) |
#define IS_NOATIME | ( | inode | ) | __IS_FLG(inode, MS_RDONLY|MS_NOATIME) |
#define IS_NOCMTIME | ( | inode | ) | ((inode)->i_flags & S_NOCMTIME) |
#define IS_SWAPFILE | ( | inode | ) | ((inode)->i_flags & S_SWAPFILE) |
#define IS_SYNC | ( | inode | ) |
#define KERNEL_READ (READ|REQ_KERNEL) |
#define KERNEL_WRITE (WRITE|REQ_KERNEL) |
#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) |
#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ |
#define OPEN_FMODE | ( | flag | ) |
#define putname | ( | name | ) | final_putname(name) |
#define RWA_MASK REQ_RAHEAD |
#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */ |
#define S_DIRSYNC 64 /* Directory modifications are synchronous */ |
#define S_NOSEC 4096 /* no suid or xattr security attributes */ |
#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
#define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1) |
#define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct simple_transaction_argresp)) |
#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ |
#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ |
#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) |
#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) |
#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) |
typedef struct files_struct* fl_owner_t |
anonymous enum |
enum file_time_flags |
enum positive_aop_returns |
enum positive_aop_returns - aop return codes with specific semantics
: Informs the caller that page writeback has completed, that the page is still locked, and should be considered active. The VM uses this hint to return the page to the active list – it won't be a candidate for writeback again in the near future. Other callers must be careful to unlock the page if they get this return. Returned by writepage();
: The AOP method that was handed a locked page has unlocked it and the page might have been truncated. The caller should back up to acquiring a new page and trying again. The aop will be taking reasonable precautions not to livelock. If the caller held a page reference, it should drop it before retrying. Returned by readpage().
address_space_operation functions return these large constants to indicate special semantics to the caller. These are much larger than the bytes in a page to allow for functions that return the number of bytes operated on in a given page.
struct address_space __attribute__ | ( | (aligned(sizeof(long))) | ) |
int __filemap_fdatawrite_range | ( | struct address_space * | mapping, |
loff_t | start, | ||
loff_t | end, | ||
int | sync_mode | ||
) |
__filemap_fdatawrite_range - start writeback on mapping dirty pages in range : address space structure to write : offset in bytes where the range starts : offset in bytes where the range ends (inclusive) : enable synchronous operation
Start writeback against all of a mapping's dirty pages that lie within the byte offsets <start, end> inclusive.
If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as opposed to a regular memory cleansing writeback. The difference between these two operations is that if a dirty page/buffer is encountered, it must be waited upon, and not just skipped over.
int __generic_block_fiemap | ( | struct inode * | inode, |
struct fiemap_extent_info * | fieinfo, | ||
loff_t | start, | ||
loff_t | len, | ||
get_block_t * | get_block | ||
) |
ssize_t __generic_file_aio_write | ( | struct kiocb * | iocb, |
const struct iovec * | iov, | ||
unsigned long | nr_segs, | ||
loff_t * | ppos | ||
) |
__generic_file_aio_write - write data to a file : IO state structure (file, offset, etc.) : vector with data to write : number of segments in the vector : position where to write
This function does all the work needed for actually writing data to a file. It does all basic checks, removes SUID from the file, updates modification times and calls proper subroutines depending on whether we do direct IO or a standard buffered write.
It expects i_mutex to be grabbed unless we work on a block device or similar object which does not need locking at all.
This function does not take care of syncing data in case of O_SYNC write. A caller has to handle it. This is mainly due to the fact that we want to avoid syncing under i_mutex.
__mark_inode_dirty - internal function : inode to mark : what kind of dirty (i.e. I_DIRTY_SYNC) Mark an inode as dirty. Callers should use mark_inode_dirty or mark_inode_dirty_sync.
Put the inode on the super block's dirty list.
CAREFUL! We mark it dirty unconditionally, but move it onto the dirty list only if it is hashed or if it refers to a blockdev. If it was not hashed, it will never be added to the dirty list even if it is later hashed, as it will have been marked dirty already.
In short, make sure you hash any inodes before you start marking them dirty.
Note that for blockdevs, inode->dirtied_when represents the dirtying time of the block-special inode (/dev/hda1) itself. And the ->dirtied_when field of the kernel-internal blockdev inode represents the dirtying time of the blockdev's pages. This is why for I_DIRTY_PAGES we always use page->mapping->host, so the page-dirtying time is recorded in the internal blockdev inode.
Definition at line 1143 of file fs-writeback.c.
int __register_chrdev | ( | unsigned int | major, |
unsigned int | baseminor, | ||
unsigned int | count, | ||
const char * | name, | ||
const struct file_operations * | fops | ||
) |
Definition at line 264 of file char_dev.c.
int __sb_start_write | ( | struct super_block * | sb, |
int | level, | ||
bool | wait | ||
) |
void __unregister_chrdev | ( | unsigned int | major, |
unsigned int | baseminor, | ||
unsigned int | count, | ||
const char * | name | ||
) |
Definition at line 331 of file char_dev.c.
void address_space_init_once | ( | struct address_space * | mapping | ) |
Definition at line 232 of file char_dev.c.
ssize_t blkdev_aio_write | ( | struct kiocb * | iocb, |
const struct iovec * | iov, | ||
unsigned long | nr_segs, | ||
loff_t | pos | ||
) |
Definition at line 1524 of file block_dev.c.
Definition at line 356 of file block_dev.c.
clear_nlink - directly zero an inode's link count : inode
This is a low-level filesystem helper to replace any direct filesystem manipulation of i_nlink. See drop_nlink() for why we care about i_nlink hitting zero.
|
read |
Definition at line 154 of file fs_struct.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.
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 164 of file read_write.c.
Definition at line 2194 of file namespace.c.
long do_splice_direct | ( | struct file * | in, |
loff_t * | ppos, | ||
struct file * | out, | ||
size_t | len, | ||
unsigned int | flags | ||
) |
do_splice_direct - splices data directly between two files : file to splice from : input file offset : file to splice to : number of bytes to splice : splice modifier flags
Description: For use by do_sendfile(). splice can easily emulate sendfile, but doing it in the application would incur an extra system call (splice in + splice out, as compared to just sendfile()). So this helper can splice directly through a process-private pipe.
Definition at line 331 of file read_write.c.
Definition at line 387 of file read_write.c.
Definition at line 1379 of file namespace.c.
drop_nlink - directly drop an inode's link count : inode
This is a low-level filesystem helper to replace any direct filesystem manipulation of i_nlink. In cases where we are attempting to track writes to the filesystem, a decrement to zero means an imminent write when the file is truncated and actually unlinked on the filesystem.
void drop_super | ( | struct super_block * | sb | ) |
|
read |
void fasync_free | ( | struct fasync_struct * | ) |
|
read |
int fasync_remove_entry | ( | struct file * | , |
struct fasync_struct ** | |||
) |
int fiemap_check_flags | ( | struct fiemap_extent_info * | fieinfo, |
u32 | fs_flags | ||
) |
fiemap_check_flags - check validity of requested flags for fiemap : Fiemap context passed into ->fiemap : Set of fiemap flags that the file system understands
Called from file system ->fiemap callback. This will compute the intersection of valid fiemap flags and those that the fs supports. That value is then compared against the user supplied flags. In case of bad user flags, the invalid values will be written into the fieinfo structure, and -EBADR is returned, which tells ioctl_fiemap() to return those values to userspace. For this reason, a return code of -EBADR should be preserved.
Returns 0 on success, -EBADR on bad flags.
void file_ra_state_init | ( | struct file_ra_state * | ra, |
struct address_space * | mapping | ||
) |
Definition at line 28 of file readahead.c.
int filemap_fdatawait | ( | struct address_space * | mapping | ) |
int filemap_fdatawait_range | ( | struct address_space * | mapping, |
loff_t | start_byte, | ||
loff_t | end_byte | ||
) |
int filemap_fdatawrite | ( | struct address_space * | ) |
int filemap_fdatawrite_range | ( | struct address_space * | mapping, |
loff_t | start, | ||
loff_t | end | ||
) |
int filemap_flush | ( | struct address_space * | mapping | ) |
filemap_flush - mostly a non-blocking flush : target address_space
This is a mostly non-blocking flush. Not suitable for data-integrity purposes - I/O may not be started against all dirty pages.
int filemap_write_and_wait | ( | struct address_space * | mapping | ) |
int filemap_write_and_wait_range | ( | struct address_space * | mapping, |
loff_t | lstart, | ||
loff_t | lend | ||
) |
filemap_write_and_wait_range - write out & wait on a file range : the address_space for the pages : offset in bytes where the range starts : offset in bytes where the range ends (inclusive)
Write out and wait upon file offsets lstart->lend, inclusive.
Note that `lend' is inclusive (describes the last byte to be written) so that this function can be used to write to the very end-of-file (end = -1).
Definition at line 467 of file file_table.c.
filp_open - open file and return file pointer
: path to open : open flags as per the open(2) second argument : mode for the new file if O_CREAT is set, else ignored
This is the helper to open a file from kernelspace if you really have to. But in generally you should not do this, so please move along, nothing to see here..
int finish_open | ( | struct file * | file, |
struct dentry * | dentry, | ||
int(*)(struct inode *, struct file *) | open, | ||
int * | opened | ||
) |
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.
int generic_block_fiemap | ( | struct inode * | inode, |
struct fiemap_extent_info * | fieinfo, | ||
u64 | start, | ||
u64 | len, | ||
get_block_t * | get_block | ||
) |
ssize_t generic_file_aio_write | ( | struct kiocb * | iocb, |
const struct iovec * | iov, | ||
unsigned long | nr_segs, | ||
loff_t | pos | ||
) |
generic_file_aio_write - write data to a file : IO state structure : vector with data to write : number of segments in the vector : position in file where to write
This is a wrapper around __generic_file_aio_write() to be used by most filesystems. It takes care of syncing the file in case of O_SYNC file and acquires i_mutex as needed.
Definition at line 131 of file read_write.c.
loff_t generic_file_llseek_size | ( | struct file * | file, |
loff_t | offset, | ||
int | origin, | ||
loff_t | maxsize, | ||
loff_t | eof | ||
) |
Definition at line 70 of file read_write.c.
int generic_file_mmap | ( | struct file * | , |
struct vm_area_struct * | |||
) |
int generic_file_readonly_mmap | ( | struct file * | , |
struct vm_area_struct * | |||
) |
ssize_t generic_file_splice_read | ( | struct file * | in, |
loff_t * | ppos, | ||
struct pipe_inode_info * | pipe, | ||
size_t | len, | ||
unsigned int | flags | ||
) |
generic_file_splice_read - splice data from file to a pipe : file to splice from : position in : pipe to splice to : number of bytes to splice : splice modifier flags
Description: Will read pages from given file and fill them into a pipe. Can be used as long as the address_space operations for the source implements a readpage() hook.
ssize_t generic_file_splice_write | ( | struct pipe_inode_info * | pipe, |
struct file * | out, | ||
loff_t * | ppos, | ||
size_t | len, | ||
unsigned int | flags | ||
) |
generic_permission - check for access rights on a Posix-like filesystem : inode to check access rights for : right to check for (MAY_READ, MAY_WRITE, MAY_EXEC, ...)
Used to check for read/write/execute permissions on a file. We use "fsuid" for this, letting us set arbitrary permissions for filesystem access without changing the "normal" uids which are used for other things.
generic_permission is rcu-walk aware. It returns -ECHILD in case an rcu-walk request cannot be satisfied (eg. requires blocking or too much complexity). It would then be called again in ref-walk mode.
Definition at line 947 of file namespace.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.
ssize_t generic_splice_sendpage | ( | struct pipe_inode_info * | pipe, |
struct file * | out, | ||
loff_t * | ppos, | ||
size_t | len, | ||
unsigned int | flags | ||
) |
generic_splice_sendpage - splice data from a pipe to a socket : pipe to splice from : socket to write to : position in : number of bytes to splice : splice modifier flags
Description: Will send bytes from the pipe to a network socket. No data copying is involved.
|
read |
void get_filesystem | ( | struct file_system_type * | fs | ) |
Definition at line 36 of file filesystems.c.
Definition at line 203 of file filesystems.c.
|
read |
Definition at line 269 of file filesystems.c.
Definition at line 72 of file file_table.c.
|
read |
|
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.
|
read |
Definition at line 45 of file block_dev.c.
|
read |
iget5_locked - obtain an inode from a mounted file system : super block of file system : hash value (usually inode number) to get
: callback used for comparisons between inodes : callback used to initialize a new struct inode : opaque data pointer to pass to
and
Search for the inode specified by and in the inode cache, and if present it is return it with an increased reference count. This is a generalized version of iget_locked() for file systems where the inode number is not sufficient for unique identification of an inode.
If the inode is not in cache, allocate a new inode and return it locked, hashed, and with the I_NEW flag set. The file system gets to fill it in before unlocking it via unlock_new_inode().
Note both
iget_failed - Mark an under-construction inode as dead and release it : The inode to discard
Mark an under-construction inode as dead and release it.
Definition at line 354 of file bad_inode.c.
|
read |
iget_locked - obtain an inode from a mounted file system : super block of file system : inode number to get
Search for the inode specified by in the inode cache and if present return it with an increased reference count. This is for file systems where the inode number is sufficient for unique identification of an inode.
If the inode is not in cache, allocate a new inode and return it locked, hashed, and with the I_NEW flag set. The file system gets to fill it in before unlocking it via unlock_new_inode().
|
read |
|
read |
ilookup5 - search for an inode in the inode cache : super block of file system to search : hash value (usually inode number) to search for
Search for the inode specified by and in the inode cache, and if the inode is in the cache, return the inode with an incremented reference count. Waits on I_NEW before returning the inode. returned with an incremented reference count.
This is a generalized version of ilookup() for file systems where the inode number is not sufficient for unique identification of an inode.
Note:
|
read |
ilookup5_nowait - search for an inode in the inode cache : super block of file system to search : hash value (usually inode number) to search for
Search for the inode specified by and in the inode cache. If the inode is in the cache, the inode is returned with an incremented reference count.
Note: I_NEW is not waited upon so you have to be very careful what you do with the returned inode. You probably should be using ilookup5() instead.
Note2:
inode_change_ok - check if attribute changes to an inode are allowed : inode to check : attributes to change
Check if we are allowed to change the attributes contained in in the given inode. This includes the normal unix access permission checks, as well as checks for rlimits and others.
Should be called as the first thing in ->setattr implementations, possibly after taking additional locks.
inode_dio_wait - wait for outstanding DIO requests to finish : inode to wait for
Waits for all pending direct I/O requests to finish so that we can proceed with a truncate or equivalent operation.
Must be called under a lock that serializes taking new references to i_dio_count, usually by inode->i_mutex.
int inode_init_always | ( | struct super_block * | sb, |
struct inode * | inode | ||
) |
inode_newsize_ok - may this inode be truncated to a given size : the inode to be truncated : the new size to assign to the inode : 0 on success, -ve errno on failure
inode_newsize_ok must be called with i_mutex held.
inode_newsize_ok will check filesystem limits and ulimits to check that the new inode size is within limits. inode_newsize_ok will also send SIGXFSZ when necessary. Caller must not proceed with inode size change if failure is returned. must be a file (not directory), with appropriate permissions to allow truncate (inode_newsize_ok does NOT check these conditions).
inode_permission - Check for access rights to a given inode : Inode to check permission on : Right to check for (MAY_READ, MAY_WRITE, MAY_EXEC)
Check for read/write/execute permissions on an inode. We use fs[ug]id for this, letting us set arbitrary permissions for filesystem access without changing the "normal" UIDs which are used for other things.
When checking for MAY_APPEND, MAY_WRITE must also be set in .
int invalidate_inode_pages2 | ( | struct address_space * | mapping | ) |
invalidate_inode_pages2 - remove all pages from an address_space : the address_space
Any pages which are found to be mapped into pagetables are unmapped prior to invalidation.
Returns -EBUSY if any pages could not be invalidated.
Definition at line 514 of file truncate.c.
int invalidate_inode_pages2_range | ( | struct address_space * | mapping, |
pgoff_t | start, | ||
pgoff_t | end | ||
) |
invalidate_inode_pages2_range - remove range of pages from an address_space : the address_space : the page offset 'from' which to invalidate : the page offset 'to' which to invalidate (inclusive)
Any pages which are found to be mapped into pagetables are unmapped prior to invalidation.
Returns -EBUSY if any pages could not be invalidated.
Definition at line 434 of file truncate.c.
unsigned long invalidate_mapping_pages | ( | struct address_space * | mapping, |
pgoff_t | start, | ||
pgoff_t | end | ||
) |
invalidate_mapping_pages - Invalidate all the unlocked pages of one inode : the address_space which holds the pages to invalidate : the offset 'from' which to invalidate : the offset 'to' which to invalidate (inclusive)
This function only removes the unlocked pages, if you want to remove all the pages of one inode, you must call truncate_inode_pages.
invalidate_mapping_pages() will not block on IO activity. It will not invalidate pages which are dirty, locked, under writeback or mapped into pagetables.
Definition at line 328 of file truncate.c.
is_bad_inode - is an inode errored : inode to test
Returns true if the inode in question has been marked as bad.
Definition at line 341 of file bad_inode.c.
is_subdir - is new dentry a subdirectory of old_dentry : new dentry : old dentry
Returns 1 if new_dentry is a subdirectory of the parent (at any depth). Returns 0 otherwise. Caller must ensure that "new_dentry" is pinned before calling is_subdir()
Definition at line 1390 of file namespace.c.
void iterate_supers_type | ( | struct file_system_type * | type, |
void(*)(struct super_block *, void *) | f, | ||
void * | arg | ||
) |
ino_t iunique | ( | struct super_block * | sb, |
ino_t | max_reserved | ||
) |
iunique - get a unique inode number : superblock : highest reserved inode number
Obtain an inode number that is unique on the system for a given superblock. This is used by file systems that have no natural permanent inode numbering system. An inode number is returned that is higher than the reserved limit but unique.
BUGS: With a large number of inodes live on the file system this function currently becomes quite slow.
|
read |
Definition at line 2653 of file namespace.c.
Definition at line 2668 of file namespace.c.
void kill_anon_super | ( | struct super_block * | sb | ) |
void kill_block_super | ( | struct super_block * | sb | ) |
void kill_litter_super | ( | struct super_block * | sb | ) |
void lock_super | ( | struct super_block * | ) |
void locks_end_grace | ( | struct lock_manager * | lm | ) |
locks_end_grace : who this grace period is for
Call this function to state that the given lock manager is ready to resume regular locking. The grace period will not end until all lock managers that called locks_start_grace() also call locks_end_grace(). Note that callers count on it being safe to call this more than once, and the second call should be a no-op.
void locks_start_grace | ( | struct net * | net, |
struct lock_manager * | lm | ||
) |
locks_start_grace : who this grace period is for
A grace period is a period during which locks should not be given out. Currently grace periods are only enforced by the two lock managers (lockd and nfsd), using the locks_in_grace() function to check when they are in a grace period.
This function is called to start a grace period.
make_bad_inode - mark an inode bad due to an I/O error : Inode to mark bad
When an inode cannot be read due to a media or remote network failure this function makes the inode "bad" and causes I/O operations on it to fail from this point on.
Definition at line 316 of file bad_inode.c.
int mapping_tagged | ( | struct address_space * | mapping, |
int | tag | ||
) |
Definition at line 2273 of file page-writeback.c.
may_umount - check if a mount point is busy : root of mount
This is called to check if a mount point has any open files, pwds, chroots or sub mounts. If the mount has sub mounts this will return busy regardless of whether the sub mounts are busy.
Doesn't take quota and stuff into account. IOW, in some cases it will give false negatives. The main reason why it's here is that we need a non-destructive way to look for easily umountable filesystems.
Definition at line 1077 of file namespace.c.
may_umount_tree - check if a mount tree is busy : root of mount tree
This is called to check if a tree of mounts has any open files, pwds, chroots or sub mounts that are busy.
Definition at line 1040 of file namespace.c.
|
read |
|
read |
Definition at line 2376 of file namespace.c.
|
read |
new_inode - obtain an inode : superblock
Allocates a new inode for given superblock. The default gfp_mask for allocations related to inode->i_mapping is GFP_HIGHUSER_MOVABLE. If HIGHMEM pages are unsuitable or it is known that pages allocated for the page cache are not reclaimable or migratable, mapping_set_gfp_mask() must be called with suitable flags on the newly created inode's mapping
|
read |
Definition at line 158 of file read_write.c.
Definition at line 152 of file read_write.c.
Definition at line 2680 of file namespace.c.
int proc_nr_dentry | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
int proc_nr_files | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
Definition at line 89 of file file_table.c.
int proc_nr_inodes | ( | struct ctl_table * | table, |
int | write, | ||
void __user * | buffer, | ||
size_t * | lenp, | ||
loff_t * | ppos | ||
) |
void prune_dcache_sb | ( | struct super_block * | sb, |
int | count | ||
) |
prune_dcache_sb - shrink the dcache : superblock : number of entries to try to free
Attempt to shrink the superblock dcache LRU by entries. This is done when we need more memory an called from the superblock shrinker function.
This function may fail to free any resources if all the dentries are in use.
void prune_icache_sb | ( | struct super_block * | sb, |
int | nr_to_scan | ||
) |
void put_filesystem | ( | struct file_system_type * | fs | ) |
Definition at line 41 of file filesystems.c.
Definition at line 196 of file char_dev.c.
int register_filesystem | ( | struct file_system_type * | fs | ) |
register_filesystem - register a new filesystem : the file system structure
Adds the file system passed to the list of file systems the kernel is aware of for mount and other syscalls. Returns 0 on success, or a negative errno code on an error.
The &struct file_system_type that is passed is linked into the kernel structures and must not be freed until the file system has been unregistered.
Definition at line 69 of file filesystems.c.
void replace_mount_options | ( | struct super_block * | sb, |
char * | options | ||
) |
Definition at line 984 of file namespace.c.
ssize_t rw_copy_check_uvector | ( | int | type, |
const struct iovec __user * | uvector, | ||
unsigned long | nr_segs, | ||
unsigned long | fast_segs, | ||
struct iovec * | fast_pointer, | ||
struct iovec ** | ret_pointer | ||
) |
Definition at line 619 of file read_write.c.
Definition at line 287 of file read_write.c.
void save_mount_options | ( | struct super_block * | sb, |
char * | options | ||
) |
Definition at line 977 of file namespace.c.
int sb_min_blocksize | ( | struct super_block * | , |
int | |||
) |
Definition at line 139 of file block_dev.c.
int sb_set_blocksize | ( | struct super_block * | , |
int | |||
) |
Definition at line 126 of file block_dev.c.
void send_sigio | ( | struct fown_struct * | fown, |
int | fd, | ||
int | band | ||
) |
int send_sigurg | ( | struct fown_struct * | fown | ) |
int set_blocksize | ( | struct block_device * | , |
int | |||
) |
Definition at line 104 of file block_dev.c.
setattr_copy - copy simple metadata updates into the generic inode : the inode to be updated : the new attributes
setattr_copy must be called with i_mutex held.
setattr_copy updates the inode's metadata with that specified in attr. Noticeably missing is inode size update, which is more complex as it requires pagecache updates.
The inode is not marked as dirty after this operation. The rationale is that for "simple" filesystems, the struct inode is the inode storage. The caller is free to mark the inode dirty afterwards if needed.
|
read |
int simple_fill_super | ( | struct super_block * | , |
unsigned | long, | ||
struct tree_descr * | |||
) |
ssize_t simple_read_from_buffer | ( | void __user * | to, |
size_t | count, | ||
loff_t * | ppos, | ||
const void * | from, | ||
size_t | available | ||
) |
simple_read_from_buffer - copy data from the buffer to user space : the user space buffer to read to : the maximum number of bytes to read : the current position in the buffer : the buffer to read from : the size of the buffer
The simple_read_from_buffer() function reads up to bytes from the buffer at offset into the user space address starting at .
On success, the number of bytes read is returned and the offset is advanced by this number, or negative value is returned on error.
simple_setattr - setattr for simple filesystem : dentry : iattr structure
Returns 0 on success, -error on failure.
simple_setattr is a simple ->setattr implementation without a proper implementation of size changes.
It can either be used for in-memory filesystems or special files on simple regular filesystems. Anything that needs to change on-disk or wire state on size changes needs its own setattr method.
ssize_t simple_write_to_buffer | ( | void * | to, |
size_t | available, | ||
loff_t * | ppos, | ||
const void __user * | from, | ||
size_t | count | ||
) |
simple_write_to_buffer - copy data from user space to the buffer : the buffer to write to : the size of the buffer : the current position in the buffer : the user space buffer to read from : the maximum number of bytes to read
The simple_write_to_buffer() function reads up to bytes from the user space address starting at into the buffer at offset .
On success, the number of bytes written is returned and the offset is advanced by this number, or negative value is returned on error.
int sync_filesystem | ( | struct super_block * | ) |
int sync_inode | ( | struct inode * | inode, |
struct writeback_control * | wbc | ||
) |
sync_inode - write an inode and its pages to disk. : the inode to sync : controls the writeback mode
sync_inode() will write an inode and its pages to disk. It will also correctly update the inode on its superblock's dirty inode lists and will update inode->i_state.
The caller must have a ref on the inode.
Definition at line 1447 of file fs-writeback.c.
sync_inode_metadata - write an inode to disk : the inode to sync : wait for I/O to complete.
Write an inode to disk and adjust its dirty state after completion.
Note: only writes the actual inode, no associated data or other metadata.
Definition at line 1462 of file fs-writeback.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().
void unlock_super | ( | struct super_block * | ) |
unregister_chrdev_region() - return a range of device numbers : the first in the range of numbers to unregister : the number of device numbers to unregister
This function will unregister a range of device numbers, starting with . The caller should normally be the one who allocated those numbers in the first place...
Definition at line 307 of file char_dev.c.
int unregister_filesystem | ( | struct file_system_type * | fs | ) |
unregister_filesystem - unregister a file system : filesystem to unregister
Remove a file system that was previously successfully registered with the kernel. An error is returned if the file system is not found. Zero is returned on a success.
Once this function has returned the &struct file_system_type structure may be freed or reused.
Definition at line 101 of file filesystems.c.
Definition at line 219 of file read_write.c.
Definition at line 357 of file read_write.c.
Definition at line 747 of file read_write.c.
Definition at line 413 of file read_write.c.
Definition at line 760 of file read_write.c.
write_inode_now - write an inode to disk : inode to write to disk : whether the write should be synchronous or not
This function commits an inode to disk immediately if it is dirty. This is primarily needed by knfsd.
The caller must either have a ref on the inode or must have set I_WILL_FREE.
Definition at line 1418 of file fs-writeback.c.
struct address_space_operations* a_ops |
struct address_space* assoc_mapping |
struct file_operations bad_sock_fops |
struct file_operations def_blk_fops |
Definition at line 1587 of file block_dev.c.
struct file_operations def_chr_fops |
Definition at line 445 of file char_dev.c.
struct file_operations def_fifo_fops |
struct address_space_operations empty_aops |
struct files_stat_struct files_stat |
Definition at line 35 of file file_table.c.
Definition at line 41 of file namespace.c.
struct file_operations generic_ro_fops |
Definition at line 23 of file read_write.c.
struct inodes_stat_t inodes_stat |
struct kmem_cache* names_cachep |
struct inode_operations page_symlink_inode_operations |
struct radix_tree_root page_tree |
spinlock_t private_lock |
struct file_operations rdwr_pipefifo_fops |
struct file_operations read_pipefifo_fops |
spinlock_t sb_lock |
struct inode_operations simple_dir_inode_operations |
struct file_operations simple_dir_operations |
int sysctl_nr_open |
int sysctl_protected_hardlinks |
int sysctl_protected_symlinks |
spinlock_t tree_lock |
struct file_operations write_pipefifo_fops |