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.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2c28271ab9d4..43db02e9c9fa 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -675,9 +675,11 @@ static inline loff_t i_size_read(const struct inode *inode)
675static inline void i_size_write(struct inode *inode, loff_t i_size) 675static inline void i_size_write(struct inode *inode, loff_t i_size)
676{ 676{
677#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 677#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
678 preempt_disable();
678 write_seqcount_begin(&inode->i_size_seqcount); 679 write_seqcount_begin(&inode->i_size_seqcount);
679 inode->i_size = i_size; 680 inode->i_size = i_size;
680 write_seqcount_end(&inode->i_size_seqcount); 681 write_seqcount_end(&inode->i_size_seqcount);
682 preempt_enable();
681#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT) 683#elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
682 preempt_disable(); 684 preempt_disable();
683 inode->i_size = i_size; 685 inode->i_size = i_size;
@@ -2080,7 +2082,6 @@ extern int sync_filesystem(struct super_block *);
2080extern const struct file_operations def_blk_fops; 2082extern const struct file_operations def_blk_fops;
2081extern const struct file_operations def_chr_fops; 2083extern const struct file_operations def_chr_fops;
2082extern const struct file_operations bad_sock_fops; 2084extern const struct file_operations bad_sock_fops;
2083extern const struct file_operations def_fifo_fops;
2084#ifdef CONFIG_BLOCK 2085#ifdef CONFIG_BLOCK
2085extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 2086extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
2086extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); 2087extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long);
@@ -2090,7 +2091,7 @@ extern struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
2090 void *holder); 2091 void *holder);
2091extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, 2092extern struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode,
2092 void *holder); 2093 void *holder);
2093extern int blkdev_put(struct block_device *bdev, fmode_t mode); 2094extern void blkdev_put(struct block_device *bdev, fmode_t mode);
2094#ifdef CONFIG_SYSFS 2095#ifdef CONFIG_SYSFS
2095extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk); 2096extern int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk);
2096extern void bd_unlink_disk_holder(struct block_device *bdev, 2097extern void bd_unlink_disk_holder(struct block_device *bdev,
@@ -2152,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
2152extern void make_bad_inode(struct inode *); 2153extern void make_bad_inode(struct inode *);
2153extern int is_bad_inode(struct inode *); 2154extern int is_bad_inode(struct inode *);
2154 2155
2155extern const struct file_operations read_pipefifo_fops;
2156extern const struct file_operations write_pipefifo_fops;
2157extern const struct file_operations rdwr_pipefifo_fops;
2158
2159#ifdef CONFIG_BLOCK 2156#ifdef CONFIG_BLOCK
2160/* 2157/*
2161 * return READ, READA, or WRITE 2158 * return READ, READA, or WRITE
@@ -2223,6 +2220,27 @@ static inline struct inode *file_inode(struct file *f)
2223 return f->f_inode; 2220 return f->f_inode;
2224} 2221}
2225 2222
2223static inline void file_start_write(struct file *file)
2224{
2225 if (!S_ISREG(file_inode(file)->i_mode))
2226 return;
2227 __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
2228}
2229
2230static inline bool file_start_write_trylock(struct file *file)
2231{
2232 if (!S_ISREG(file_inode(file)->i_mode))
2233 return true;
2234 return __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, false);
2235}
2236
2237static inline void file_end_write(struct file *file)
2238{
2239 if (!S_ISREG(file_inode(file)->i_mode))
2240 return;
2241 __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE);
2242}
2243
2226/* 2244/*
2227 * get_write_access() gets write permission for a file. 2245 * get_write_access() gets write permission for a file.
2228 * put_write_access() releases this write permission. 2246 * put_write_access() releases this write permission.