diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-23 17:07:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-22 23:31:31 -0500 |
commit | 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch) | |
tree | 8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /fs/gfs2/file.c | |
parent | 57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff) |
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r-- | fs/gfs2/file.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 991ab2d484dd..44543df9f400 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -157,7 +157,7 @@ static const u32 gfs2_to_fsflags[32] = { | |||
157 | 157 | ||
158 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | 158 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) |
159 | { | 159 | { |
160 | struct inode *inode = filp->f_path.dentry->d_inode; | 160 | struct inode *inode = file_inode(filp); |
161 | struct gfs2_inode *ip = GFS2_I(inode); | 161 | struct gfs2_inode *ip = GFS2_I(inode); |
162 | struct gfs2_holder gh; | 162 | struct gfs2_holder gh; |
163 | int error; | 163 | int error; |
@@ -217,7 +217,7 @@ void gfs2_set_inode_flags(struct inode *inode) | |||
217 | */ | 217 | */ |
218 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) | 218 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) |
219 | { | 219 | { |
220 | struct inode *inode = filp->f_path.dentry->d_inode; | 220 | struct inode *inode = file_inode(filp); |
221 | struct gfs2_inode *ip = GFS2_I(inode); | 221 | struct gfs2_inode *ip = GFS2_I(inode); |
222 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 222 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
223 | struct buffer_head *bh; | 223 | struct buffer_head *bh; |
@@ -293,7 +293,7 @@ out_drop_write: | |||
293 | 293 | ||
294 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | 294 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
295 | { | 295 | { |
296 | struct inode *inode = filp->f_path.dentry->d_inode; | 296 | struct inode *inode = file_inode(filp); |
297 | u32 fsflags, gfsflags; | 297 | u32 fsflags, gfsflags; |
298 | 298 | ||
299 | if (get_user(fsflags, ptr)) | 299 | if (get_user(fsflags, ptr)) |
@@ -336,7 +336,7 @@ static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
336 | 336 | ||
337 | static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size) | 337 | static void gfs2_size_hint(struct file *filep, loff_t offset, size_t size) |
338 | { | 338 | { |
339 | struct inode *inode = filep->f_dentry->d_inode; | 339 | struct inode *inode = file_inode(filep); |
340 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 340 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
341 | struct gfs2_inode *ip = GFS2_I(inode); | 341 | struct gfs2_inode *ip = GFS2_I(inode); |
342 | size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift; | 342 | size_t blks = (size + sdp->sd_sb.sb_bsize - 1) >> sdp->sd_sb.sb_bsize_shift; |
@@ -386,7 +386,7 @@ static int gfs2_allocate_page_backing(struct page *page) | |||
386 | static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | 386 | static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
387 | { | 387 | { |
388 | struct page *page = vmf->page; | 388 | struct page *page = vmf->page; |
389 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 389 | struct inode *inode = file_inode(vma->vm_file); |
390 | struct gfs2_inode *ip = GFS2_I(inode); | 390 | struct gfs2_inode *ip = GFS2_I(inode); |
391 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 391 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
392 | unsigned long last_index; | 392 | unsigned long last_index; |
@@ -673,8 +673,7 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
673 | { | 673 | { |
674 | struct file *file = iocb->ki_filp; | 674 | struct file *file = iocb->ki_filp; |
675 | size_t writesize = iov_length(iov, nr_segs); | 675 | size_t writesize = iov_length(iov, nr_segs); |
676 | struct dentry *dentry = file->f_dentry; | 676 | struct gfs2_inode *ip = GFS2_I(file_inode(file)); |
677 | struct gfs2_inode *ip = GFS2_I(dentry->d_inode); | ||
678 | int ret; | 677 | int ret; |
679 | 678 | ||
680 | ret = gfs2_rs_alloc(ip); | 679 | ret = gfs2_rs_alloc(ip); |
@@ -772,7 +771,7 @@ static void calc_max_reserv(struct gfs2_inode *ip, loff_t max, loff_t *len, | |||
772 | static long gfs2_fallocate(struct file *file, int mode, loff_t offset, | 771 | static long gfs2_fallocate(struct file *file, int mode, loff_t offset, |
773 | loff_t len) | 772 | loff_t len) |
774 | { | 773 | { |
775 | struct inode *inode = file->f_path.dentry->d_inode; | 774 | struct inode *inode = file_inode(file); |
776 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 775 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
777 | struct gfs2_inode *ip = GFS2_I(inode); | 776 | struct gfs2_inode *ip = GFS2_I(inode); |
778 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; | 777 | unsigned int data_blocks = 0, ind_blocks = 0, rblocks; |
@@ -938,7 +937,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
938 | { | 937 | { |
939 | struct gfs2_file *fp = file->private_data; | 938 | struct gfs2_file *fp = file->private_data; |
940 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; | 939 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
941 | struct gfs2_inode *ip = GFS2_I(file->f_path.dentry->d_inode); | 940 | struct gfs2_inode *ip = GFS2_I(file_inode(file)); |
942 | struct gfs2_glock *gl; | 941 | struct gfs2_glock *gl; |
943 | unsigned int state; | 942 | unsigned int state; |
944 | int flags; | 943 | int flags; |