aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h69
1 files changed, 51 insertions, 18 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4079ef99900f..3428393942a6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -651,6 +651,7 @@ struct block_device {
651 int bd_openers; 651 int bd_openers;
652 struct mutex bd_mutex; /* open/close mutex */ 652 struct mutex bd_mutex; /* open/close mutex */
653 struct list_head bd_inodes; 653 struct list_head bd_inodes;
654 void * bd_claiming;
654 void * bd_holder; 655 void * bd_holder;
655 int bd_holders; 656 int bd_holders;
656#ifdef CONFIG_SYSFS 657#ifdef CONFIG_SYSFS
@@ -953,6 +954,7 @@ extern spinlock_t files_lock;
953#define file_list_unlock() spin_unlock(&files_lock); 954#define file_list_unlock() spin_unlock(&files_lock);
954 955
955#define get_file(x) atomic_long_inc(&(x)->f_count) 956#define get_file(x) atomic_long_inc(&(x)->f_count)
957#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
956#define file_count(x) atomic_long_read(&(x)->f_count) 958#define file_count(x) atomic_long_read(&(x)->f_count)
957 959
958#ifdef CONFIG_DEBUG_WRITECOUNT 960#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1314,8 +1316,6 @@ extern int send_sigurg(struct fown_struct *fown);
1314extern struct list_head super_blocks; 1316extern struct list_head super_blocks;
1315extern spinlock_t sb_lock; 1317extern spinlock_t sb_lock;
1316 1318
1317#define sb_entry(list) list_entry((list), struct super_block, s_list)
1318#define S_BIAS (1<<30)
1319struct super_block { 1319struct super_block {
1320 struct list_head s_list; /* Keep this first */ 1320 struct list_head s_list; /* Keep this first */
1321 dev_t s_dev; /* search index; _not_ kdev_t */ 1321 dev_t s_dev; /* search index; _not_ kdev_t */
@@ -1334,12 +1334,11 @@ struct super_block {
1334 struct rw_semaphore s_umount; 1334 struct rw_semaphore s_umount;
1335 struct mutex s_lock; 1335 struct mutex s_lock;
1336 int s_count; 1336 int s_count;
1337 int s_need_sync;
1338 atomic_t s_active; 1337 atomic_t s_active;
1339#ifdef CONFIG_SECURITY 1338#ifdef CONFIG_SECURITY
1340 void *s_security; 1339 void *s_security;
1341#endif 1340#endif
1342 struct xattr_handler **s_xattr; 1341 const struct xattr_handler **s_xattr;
1343 1342
1344 struct list_head s_inodes; /* all inodes */ 1343 struct list_head s_inodes; /* all inodes */
1345 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1344 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
@@ -1431,7 +1430,8 @@ extern void dentry_unhash(struct dentry *dentry);
1431 * VFS file helper functions. 1430 * VFS file helper functions.
1432 */ 1431 */
1433extern int file_permission(struct file *, int); 1432extern int file_permission(struct file *, int);
1434 1433extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1434 mode_t mode);
1435/* 1435/*
1436 * VFS FS_IOC_FIEMAP helper definitions. 1436 * VFS FS_IOC_FIEMAP helper definitions.
1437 */ 1437 */
@@ -1498,7 +1498,7 @@ struct file_operations {
1498 int (*open) (struct inode *, struct file *); 1498 int (*open) (struct inode *, struct file *);
1499 int (*flush) (struct file *, fl_owner_t id); 1499 int (*flush) (struct file *, fl_owner_t id);
1500 int (*release) (struct inode *, struct file *); 1500 int (*release) (struct inode *, struct file *);
1501 int (*fsync) (struct file *, struct dentry *, int datasync); 1501 int (*fsync) (struct file *, int datasync);
1502 int (*aio_fsync) (struct kiocb *, int datasync); 1502 int (*aio_fsync) (struct kiocb *, int datasync);
1503 int (*fasync) (int, struct file *, int); 1503 int (*fasync) (int, struct file *, int);
1504 int (*lock) (struct file *, int, struct file_lock *); 1504 int (*lock) (struct file *, int, struct file_lock *);
@@ -1744,6 +1744,7 @@ struct file_system_type {
1744 1744
1745 struct lock_class_key s_lock_key; 1745 struct lock_class_key s_lock_key;
1746 struct lock_class_key s_umount_key; 1746 struct lock_class_key s_umount_key;
1747 struct lock_class_key s_vfs_rename_key;
1747 1748
1748 struct lock_class_key i_lock_key; 1749 struct lock_class_key i_lock_key;
1749 struct lock_class_key i_mutex_key; 1750 struct lock_class_key i_mutex_key;
@@ -1781,8 +1782,6 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1781 const struct super_operations *ops, unsigned long, 1782 const struct super_operations *ops, unsigned long,
1782 struct vfsmount *mnt); 1783 struct vfsmount *mnt);
1783extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1784extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1784int __put_super_and_need_restart(struct super_block *sb);
1785void put_super(struct super_block *sb);
1786 1785
1787/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1786/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1788#define fops_get(fops) \ 1787#define fops_get(fops) \
@@ -1802,6 +1801,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1802extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1801extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1803 struct vfsmount *); 1802 struct vfsmount *);
1804extern int vfs_statfs(struct dentry *, struct kstatfs *); 1803extern int vfs_statfs(struct dentry *, struct kstatfs *);
1804extern int freeze_super(struct super_block *super);
1805extern int thaw_super(struct super_block *super);
1805 1806
1806extern int current_umask(void); 1807extern int current_umask(void);
1807 1808
@@ -2087,9 +2088,9 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2087extern int filemap_fdatawrite_range(struct address_space *mapping, 2088extern int filemap_fdatawrite_range(struct address_space *mapping,
2088 loff_t start, loff_t end); 2089 loff_t start, loff_t end);
2089 2090
2090extern int vfs_fsync_range(struct file *file, struct dentry *dentry, 2091extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2091 loff_t start, loff_t end, int datasync); 2092 int datasync);
2092extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2093extern int vfs_fsync(struct file *file, int datasync);
2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2094extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2094extern void sync_supers(void); 2095extern void sync_supers(void);
2095extern void emergency_sync(void); 2096extern void emergency_sync(void);
@@ -2212,7 +2213,7 @@ extern int generic_segment_checks(const struct iovec *iov,
2212/* fs/block_dev.c */ 2213/* fs/block_dev.c */
2213extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2214extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2214 unsigned long nr_segs, loff_t pos); 2215 unsigned long nr_segs, loff_t pos);
2215extern int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync); 2216extern int blkdev_fsync(struct file *filp, int datasync);
2216 2217
2217/* fs/splice.c */ 2218/* fs/splice.c */
2218extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2219extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2228,6 +2229,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2228 2229
2229extern void 2230extern void
2230file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2231file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2232extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
2231extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2233extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2232extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2234extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2233extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, 2235extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
@@ -2250,10 +2252,19 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2250#endif 2252#endif
2251 2253
2252#ifdef CONFIG_BLOCK 2254#ifdef CONFIG_BLOCK
2255struct bio;
2256typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2257 loff_t file_offset);
2258void dio_end_io(struct bio *bio, int error);
2259
2260ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2261 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2262 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2263 dio_submit_t submit_io, int lock_type);
2253ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2264ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2254 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2265 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2255 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 2266 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2256 int lock_type); 2267 dio_submit_t submit_io, int lock_type);
2257 2268
2258enum { 2269enum {
2259 /* need locking between buffered and direct access */ 2270 /* need locking between buffered and direct access */
@@ -2263,13 +2274,31 @@ enum {
2263 DIO_SKIP_HOLES = 0x02, 2274 DIO_SKIP_HOLES = 0x02,
2264}; 2275};
2265 2276
2277static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb,
2278 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2279 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2280 dio_iodone_t end_io)
2281{
2282 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2283 nr_segs, get_block, end_io, NULL,
2284 DIO_LOCKING | DIO_SKIP_HOLES);
2285}
2286
2287static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2288 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2289 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2290 dio_iodone_t end_io)
2291{
2292 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2293 nr_segs, get_block, end_io, NULL, 0);
2294}
2266static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2295static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2267 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2296 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2268 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2297 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2269 dio_iodone_t end_io) 2298 dio_iodone_t end_io)
2270{ 2299{
2271 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2300 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2272 nr_segs, get_block, end_io, 2301 nr_segs, get_block, end_io, NULL,
2273 DIO_LOCKING | DIO_SKIP_HOLES); 2302 DIO_LOCKING | DIO_SKIP_HOLES);
2274} 2303}
2275 2304
@@ -2279,7 +2308,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2279 dio_iodone_t end_io) 2308 dio_iodone_t end_io)
2280{ 2309{
2281 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2310 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2282 nr_segs, get_block, end_io, 0); 2311 nr_segs, get_block, end_io, NULL, 0);
2283} 2312}
2284#endif 2313#endif
2285 2314
@@ -2329,18 +2358,21 @@ extern struct super_block *get_super(struct block_device *);
2329extern struct super_block *get_active_super(struct block_device *bdev); 2358extern struct super_block *get_active_super(struct block_device *bdev);
2330extern struct super_block *user_get_super(dev_t); 2359extern struct super_block *user_get_super(dev_t);
2331extern void drop_super(struct super_block *sb); 2360extern void drop_super(struct super_block *sb);
2361extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2332 2362
2333extern int dcache_dir_open(struct inode *, struct file *); 2363extern int dcache_dir_open(struct inode *, struct file *);
2334extern int dcache_dir_close(struct inode *, struct file *); 2364extern int dcache_dir_close(struct inode *, struct file *);
2335extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2365extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2336extern int dcache_readdir(struct file *, void *, filldir_t); 2366extern int dcache_readdir(struct file *, void *, filldir_t);
2367extern int simple_setattr(struct dentry *, struct iattr *);
2337extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2368extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2338extern int simple_statfs(struct dentry *, struct kstatfs *); 2369extern int simple_statfs(struct dentry *, struct kstatfs *);
2339extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2370extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2340extern int simple_unlink(struct inode *, struct dentry *); 2371extern int simple_unlink(struct inode *, struct dentry *);
2341extern int simple_rmdir(struct inode *, struct dentry *); 2372extern int simple_rmdir(struct inode *, struct dentry *);
2342extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2373extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2343extern int simple_sync_file(struct file *, struct dentry *, int); 2374extern int simple_setsize(struct inode *, loff_t);
2375extern int noop_fsync(struct file *, int);
2344extern int simple_empty(struct dentry *); 2376extern int simple_empty(struct dentry *);
2345extern int simple_readpage(struct file *file, struct page *page); 2377extern int simple_readpage(struct file *file, struct page *page);
2346extern int simple_write_begin(struct file *file, struct address_space *mapping, 2378extern int simple_write_begin(struct file *file, struct address_space *mapping,
@@ -2365,7 +2397,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2365extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, 2397extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2366 const void __user *from, size_t count); 2398 const void __user *from, size_t count);
2367 2399
2368extern int simple_fsync(struct file *, struct dentry *, int); 2400extern int generic_file_fsync(struct file *, int);
2369 2401
2370#ifdef CONFIG_MIGRATION 2402#ifdef CONFIG_MIGRATION
2371extern int buffer_migrate_page(struct address_space *, 2403extern int buffer_migrate_page(struct address_space *,
@@ -2376,7 +2408,8 @@ extern int buffer_migrate_page(struct address_space *,
2376 2408
2377extern int inode_change_ok(const struct inode *, struct iattr *); 2409extern int inode_change_ok(const struct inode *, struct iattr *);
2378extern int inode_newsize_ok(const struct inode *, loff_t offset); 2410extern int inode_newsize_ok(const struct inode *, loff_t offset);
2379extern int __must_check inode_setattr(struct inode *, struct iattr *); 2411extern int __must_check inode_setattr(struct inode *, const struct iattr *);
2412extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2380 2413
2381extern void file_update_time(struct file *file); 2414extern void file_update_time(struct file *file);
2382 2415