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.h48
1 files changed, 40 insertions, 8 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b336cb9ca9a0..3428393942a6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -954,6 +954,7 @@ extern spinlock_t files_lock;
954#define file_list_unlock() spin_unlock(&files_lock); 954#define file_list_unlock() spin_unlock(&files_lock);
955 955
956#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)
957#define file_count(x) atomic_long_read(&(x)->f_count) 958#define file_count(x) atomic_long_read(&(x)->f_count)
958 959
959#ifdef CONFIG_DEBUG_WRITECOUNT 960#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1497,7 +1498,7 @@ struct file_operations {
1497 int (*open) (struct inode *, struct file *); 1498 int (*open) (struct inode *, struct file *);
1498 int (*flush) (struct file *, fl_owner_t id); 1499 int (*flush) (struct file *, fl_owner_t id);
1499 int (*release) (struct inode *, struct file *); 1500 int (*release) (struct inode *, struct file *);
1500 int (*fsync) (struct file *, struct dentry *, int datasync); 1501 int (*fsync) (struct file *, int datasync);
1501 int (*aio_fsync) (struct kiocb *, int datasync); 1502 int (*aio_fsync) (struct kiocb *, int datasync);
1502 int (*fasync) (int, struct file *, int); 1503 int (*fasync) (int, struct file *, int);
1503 int (*lock) (struct file *, int, struct file_lock *); 1504 int (*lock) (struct file *, int, struct file_lock *);
@@ -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
@@ -2335,13 +2364,15 @@ extern int dcache_dir_open(struct inode *, struct file *);
2335extern int dcache_dir_close(struct inode *, struct file *); 2364extern int dcache_dir_close(struct inode *, struct file *);
2336extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2365extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2337extern 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 *);
2338extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2368extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2339extern int simple_statfs(struct dentry *, struct kstatfs *); 2369extern int simple_statfs(struct dentry *, struct kstatfs *);
2340extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2370extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2341extern int simple_unlink(struct inode *, struct dentry *); 2371extern int simple_unlink(struct inode *, struct dentry *);
2342extern int simple_rmdir(struct inode *, struct dentry *); 2372extern int simple_rmdir(struct inode *, struct dentry *);
2343extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2373extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2344extern int simple_sync_file(struct file *, struct dentry *, int); 2374extern int simple_setsize(struct inode *, loff_t);
2375extern int noop_fsync(struct file *, int);
2345extern int simple_empty(struct dentry *); 2376extern int simple_empty(struct dentry *);
2346extern int simple_readpage(struct file *file, struct page *page); 2377extern int simple_readpage(struct file *file, struct page *page);
2347extern int simple_write_begin(struct file *file, struct address_space *mapping, 2378extern int simple_write_begin(struct file *file, struct address_space *mapping,
@@ -2366,7 +2397,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2366extern 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,
2367 const void __user *from, size_t count); 2398 const void __user *from, size_t count);
2368 2399
2369extern int simple_fsync(struct file *, struct dentry *, int); 2400extern int generic_file_fsync(struct file *, int);
2370 2401
2371#ifdef CONFIG_MIGRATION 2402#ifdef CONFIG_MIGRATION
2372extern int buffer_migrate_page(struct address_space *, 2403extern int buffer_migrate_page(struct address_space *,
@@ -2377,7 +2408,8 @@ extern int buffer_migrate_page(struct address_space *,
2377 2408
2378extern int inode_change_ok(const struct inode *, struct iattr *); 2409extern int inode_change_ok(const struct inode *, struct iattr *);
2379extern int inode_newsize_ok(const struct inode *, loff_t offset); 2410extern int inode_newsize_ok(const struct inode *, loff_t offset);
2380extern 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);
2381 2413
2382extern void file_update_time(struct file *file); 2414extern void file_update_time(struct file *file);
2383 2415