diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-02-27 17:23:27 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-02-27 17:23:27 -0500 |
commit | 5c676f6d359b0404d53f542f02e1359583cb2895 (patch) | |
tree | 8741011990ec0a3d0d41fee9f0d7abf6a16834cc /fs/gfs2/ops_file.c | |
parent | f3b270a47882b958e9e3c5bd86894e3a7072899a (diff) |
[GFS2] Macros removal in gfs2.h
As suggested by Pekka Enberg <penberg@cs.helsinki.fi>.
The DIV_RU macro is renamed DIV_ROUND_UP and and moved to kernel.h
The other macros are gone from gfs2.h as (although not requested
by Pekka Enberg) are a number of included header file which are now
included individually. The inode number comparison function is
now an inline function.
The DT2IF and IF2DT may be addressed in a future patch.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index e6ae2551b0cb..d30c6db46241 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -19,10 +19,13 @@ | |||
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/gfs2_ioctl.h> | 20 | #include <linux/gfs2_ioctl.h> |
21 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
22 | #include <linux/gfs2_ondisk.h> | ||
22 | #include <asm/semaphore.h> | 23 | #include <asm/semaphore.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
25 | #include "gfs2.h" | 26 | #include "gfs2.h" |
27 | #include "lm_interface.h" | ||
28 | #include "incore.h" | ||
26 | #include "bmap.h" | 29 | #include "bmap.h" |
27 | #include "dir.h" | 30 | #include "dir.h" |
28 | #include "glock.h" | 31 | #include "glock.h" |
@@ -36,6 +39,7 @@ | |||
36 | #include "quota.h" | 39 | #include "quota.h" |
37 | #include "rgrp.h" | 40 | #include "rgrp.h" |
38 | #include "trans.h" | 41 | #include "trans.h" |
42 | #include "util.h" | ||
39 | 43 | ||
40 | /* "bad" is for NFS support */ | 44 | /* "bad" is for NFS support */ |
41 | struct filldir_bad_entry { | 45 | struct filldir_bad_entry { |
@@ -125,7 +129,7 @@ int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state, | |||
125 | 129 | ||
126 | static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) | 130 | static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) |
127 | { | 131 | { |
128 | struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); | 132 | struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip; |
129 | struct gfs2_holder i_gh; | 133 | struct gfs2_holder i_gh; |
130 | loff_t error; | 134 | loff_t error; |
131 | 135 | ||
@@ -172,7 +176,7 @@ static ssize_t __gfs2_file_aio_read(struct kiocb *iocb, | |||
172 | unsigned long nr_segs, loff_t *ppos) | 176 | unsigned long nr_segs, loff_t *ppos) |
173 | { | 177 | { |
174 | struct file *filp = iocb->ki_filp; | 178 | struct file *filp = iocb->ki_filp; |
175 | struct gfs2_inode *ip = get_v2ip(filp->f_mapping->host); | 179 | struct gfs2_inode *ip = filp->f_mapping->host->u.generic_ip; |
176 | struct gfs2_holder gh; | 180 | struct gfs2_holder gh; |
177 | ssize_t retval; | 181 | ssize_t retval; |
178 | unsigned long seg; | 182 | unsigned long seg; |
@@ -354,7 +358,7 @@ static int filldir_reg_func(void *opaque, const char *name, unsigned int length, | |||
354 | 358 | ||
355 | static int readdir_reg(struct file *file, void *dirent, filldir_t filldir) | 359 | static int readdir_reg(struct file *file, void *dirent, filldir_t filldir) |
356 | { | 360 | { |
357 | struct gfs2_inode *dip = get_v2ip(file->f_mapping->host); | 361 | struct gfs2_inode *dip = file->f_mapping->host->u.generic_ip; |
358 | struct filldir_reg fdr; | 362 | struct filldir_reg fdr; |
359 | struct gfs2_holder d_gh; | 363 | struct gfs2_holder d_gh; |
360 | uint64_t offset = file->f_pos; | 364 | uint64_t offset = file->f_pos; |
@@ -443,7 +447,7 @@ static int filldir_bad_func(void *opaque, const char *name, unsigned int length, | |||
443 | 447 | ||
444 | static int readdir_bad(struct file *file, void *dirent, filldir_t filldir) | 448 | static int readdir_bad(struct file *file, void *dirent, filldir_t filldir) |
445 | { | 449 | { |
446 | struct gfs2_inode *dip = get_v2ip(file->f_mapping->host); | 450 | struct gfs2_inode *dip = file->f_mapping->host->u.generic_ip; |
447 | struct gfs2_sbd *sdp = dip->i_sbd; | 451 | struct gfs2_sbd *sdp = dip->i_sbd; |
448 | struct filldir_reg fdr; | 452 | struct filldir_reg fdr; |
449 | unsigned int entries, size; | 453 | unsigned int entries, size; |
@@ -608,7 +612,7 @@ out: | |||
608 | static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 612 | static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, |
609 | unsigned long arg) | 613 | unsigned long arg) |
610 | { | 614 | { |
611 | struct gfs2_inode *ip = get_v2ip(inode); | 615 | struct gfs2_inode *ip = inode->u.generic_ip; |
612 | 616 | ||
613 | switch (cmd) { | 617 | switch (cmd) { |
614 | case GFS2_IOCTL_SETFLAGS: | 618 | case GFS2_IOCTL_SETFLAGS: |
@@ -630,7 +634,7 @@ static int gfs2_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
630 | 634 | ||
631 | static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) | 635 | static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) |
632 | { | 636 | { |
633 | struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); | 637 | struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip; |
634 | struct gfs2_holder i_gh; | 638 | struct gfs2_holder i_gh; |
635 | int error; | 639 | int error; |
636 | 640 | ||
@@ -665,7 +669,7 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) | |||
665 | 669 | ||
666 | static int gfs2_open(struct inode *inode, struct file *file) | 670 | static int gfs2_open(struct inode *inode, struct file *file) |
667 | { | 671 | { |
668 | struct gfs2_inode *ip = get_v2ip(inode); | 672 | struct gfs2_inode *ip = inode->u.generic_ip; |
669 | struct gfs2_holder i_gh; | 673 | struct gfs2_holder i_gh; |
670 | struct gfs2_file *fp; | 674 | struct gfs2_file *fp; |
671 | int error; | 675 | int error; |
@@ -679,8 +683,8 @@ static int gfs2_open(struct inode *inode, struct file *file) | |||
679 | fp->f_inode = ip; | 683 | fp->f_inode = ip; |
680 | fp->f_vfile = file; | 684 | fp->f_vfile = file; |
681 | 685 | ||
682 | gfs2_assert_warn(ip->i_sbd, !get_v2fp(file)); | 686 | gfs2_assert_warn(ip->i_sbd, !file->private_data); |
683 | set_v2fp(file, fp); | 687 | file->private_data = fp; |
684 | 688 | ||
685 | if (S_ISREG(ip->i_di.di_mode)) { | 689 | if (S_ISREG(ip->i_di.di_mode)) { |
686 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, | 690 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, |
@@ -708,7 +712,7 @@ static int gfs2_open(struct inode *inode, struct file *file) | |||
708 | gfs2_glock_dq_uninit(&i_gh); | 712 | gfs2_glock_dq_uninit(&i_gh); |
709 | 713 | ||
710 | fail: | 714 | fail: |
711 | set_v2fp(file, NULL); | 715 | file->private_data = NULL; |
712 | kfree(fp); | 716 | kfree(fp); |
713 | 717 | ||
714 | return error; | 718 | return error; |
@@ -724,11 +728,11 @@ static int gfs2_open(struct inode *inode, struct file *file) | |||
724 | 728 | ||
725 | static int gfs2_close(struct inode *inode, struct file *file) | 729 | static int gfs2_close(struct inode *inode, struct file *file) |
726 | { | 730 | { |
727 | struct gfs2_sbd *sdp = get_v2sdp(inode->i_sb); | 731 | struct gfs2_sbd *sdp = inode->i_sb->s_fs_info; |
728 | struct gfs2_file *fp; | 732 | struct gfs2_file *fp; |
729 | 733 | ||
730 | fp = get_v2fp(file); | 734 | fp = file->private_data; |
731 | set_v2fp(file, NULL); | 735 | file->private_data = NULL; |
732 | 736 | ||
733 | if (gfs2_assert_warn(sdp, fp)) | 737 | if (gfs2_assert_warn(sdp, fp)) |
734 | return -EIO; | 738 | return -EIO; |
@@ -748,7 +752,7 @@ static int gfs2_close(struct inode *inode, struct file *file) | |||
748 | 752 | ||
749 | static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | 753 | static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) |
750 | { | 754 | { |
751 | struct gfs2_inode *ip = get_v2ip(dentry->d_inode); | 755 | struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; |
752 | 756 | ||
753 | gfs2_log_flush_glock(ip->i_gl); | 757 | gfs2_log_flush_glock(ip->i_gl); |
754 | 758 | ||
@@ -766,7 +770,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
766 | 770 | ||
767 | static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) | 771 | static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) |
768 | { | 772 | { |
769 | struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); | 773 | struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip; |
770 | struct gfs2_sbd *sdp = ip->i_sbd; | 774 | struct gfs2_sbd *sdp = ip->i_sbd; |
771 | struct lm_lockname name = | 775 | struct lm_lockname name = |
772 | { .ln_number = ip->i_num.no_addr, | 776 | { .ln_number = ip->i_num.no_addr, |
@@ -824,7 +828,7 @@ static ssize_t gfs2_sendfile(struct file *in_file, loff_t *offset, size_t count, | |||
824 | 828 | ||
825 | static int do_flock(struct file *file, int cmd, struct file_lock *fl) | 829 | static int do_flock(struct file *file, int cmd, struct file_lock *fl) |
826 | { | 830 | { |
827 | struct gfs2_file *fp = get_v2fp(file); | 831 | struct gfs2_file *fp = file->private_data; |
828 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; | 832 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
829 | struct gfs2_inode *ip = fp->f_inode; | 833 | struct gfs2_inode *ip = fp->f_inode; |
830 | struct gfs2_glock *gl; | 834 | struct gfs2_glock *gl; |
@@ -874,7 +878,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
874 | 878 | ||
875 | static void do_unflock(struct file *file, struct file_lock *fl) | 879 | static void do_unflock(struct file *file, struct file_lock *fl) |
876 | { | 880 | { |
877 | struct gfs2_file *fp = get_v2fp(file); | 881 | struct gfs2_file *fp = file->private_data; |
878 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; | 882 | struct gfs2_holder *fl_gh = &fp->f_fl_gh; |
879 | 883 | ||
880 | mutex_lock(&fp->f_fl_mutex); | 884 | mutex_lock(&fp->f_fl_mutex); |
@@ -895,7 +899,7 @@ static void do_unflock(struct file *file, struct file_lock *fl) | |||
895 | 899 | ||
896 | static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) | 900 | static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) |
897 | { | 901 | { |
898 | struct gfs2_inode *ip = get_v2ip(file->f_mapping->host); | 902 | struct gfs2_inode *ip = file->f_mapping->host->u.generic_ip; |
899 | struct gfs2_sbd *sdp = ip->i_sbd; | 903 | struct gfs2_sbd *sdp = ip->i_sbd; |
900 | 904 | ||
901 | if (!(fl->fl_flags & FL_FLOCK)) | 905 | if (!(fl->fl_flags & FL_FLOCK)) |