diff options
| author | Tim Shimmin <tes@sgi.com> | 2007-11-23 00:30:42 -0500 |
|---|---|---|
| committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-02-07 02:17:58 -0500 |
| commit | e6a4b37f38dca6e86b2648d172946700ee921e12 (patch) | |
| tree | a094d91f8b864a33735a54c12a792bb084f7c5be | |
| parent | f7b7c3673e6e225de337abe00e14dc048e44782b (diff) | |
[XFS] Remove the BPCSHIFT and NB* based macros from XFS.
The BPCSHIFT based macros, btoc*, ctob*, offtoc* and ctooff are either not
used or don't need to be used. The NDPP, NDPP, NBBY macros don't need to
be used but instead are replaced directly by PAGE_SIZE and PAGE_CACHE_SIZE
where appropriate. Initial patch and motivation from Nicolas Kaiser.
SGI-PV: 971186
SGI-Modid: xfs-linux-melb:xfs-kern:30096a
Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 28 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 9 | ||||
| -rw-r--r-- | fs/xfs/quota/xfs_qm.h | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_bmap.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_itable.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_log.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_vnodeops.c | 9 |
7 files changed, 17 insertions, 47 deletions
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 9bf4f7e965c7..3ca39c4e5d2a 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
| @@ -138,43 +138,17 @@ | |||
| 138 | 138 | ||
| 139 | #define spinlock_destroy(lock) | 139 | #define spinlock_destroy(lock) |
| 140 | 140 | ||
| 141 | #define NBPP PAGE_SIZE | ||
| 142 | #define NDPP (1 << (PAGE_SHIFT - 9)) | ||
| 143 | |||
| 144 | #define NBBY 8 /* number of bits per byte */ | 141 | #define NBBY 8 /* number of bits per byte */ |
| 145 | #define NBPC PAGE_SIZE /* Number of bytes per click */ | ||
| 146 | #define BPCSHIFT PAGE_SHIFT /* LOG2(NBPC) if exact */ | ||
| 147 | 142 | ||
| 148 | /* | 143 | /* |
| 149 | * Size of block device i/o is parameterized here. | 144 | * Size of block device i/o is parameterized here. |
| 150 | * Currently the system supports page-sized i/o. | 145 | * Currently the system supports page-sized i/o. |
| 151 | */ | 146 | */ |
| 152 | #define BLKDEV_IOSHIFT BPCSHIFT | 147 | #define BLKDEV_IOSHIFT PAGE_CACHE_SHIFT |
| 153 | #define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT) | 148 | #define BLKDEV_IOSIZE (1<<BLKDEV_IOSHIFT) |
| 154 | /* number of BB's per block device block */ | 149 | /* number of BB's per block device block */ |
| 155 | #define BLKDEV_BB BTOBB(BLKDEV_IOSIZE) | 150 | #define BLKDEV_BB BTOBB(BLKDEV_IOSIZE) |
| 156 | 151 | ||
| 157 | /* bytes to clicks */ | ||
| 158 | #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) | ||
| 159 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) | ||
| 160 | #define btoc64(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) | ||
| 161 | #define btoct64(x) ((__uint64_t)(x)>>BPCSHIFT) | ||
| 162 | |||
| 163 | /* off_t bytes to clicks */ | ||
| 164 | #define offtoc(x) (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT) | ||
| 165 | #define offtoct(x) ((xfs_off_t)(x)>>BPCSHIFT) | ||
| 166 | |||
| 167 | /* clicks to off_t bytes */ | ||
| 168 | #define ctooff(x) ((xfs_off_t)(x)<<BPCSHIFT) | ||
| 169 | |||
| 170 | /* clicks to bytes */ | ||
| 171 | #define ctob(x) ((__psunsigned_t)(x)<<BPCSHIFT) | ||
| 172 | #define btoct(x) ((__psunsigned_t)(x)>>BPCSHIFT) | ||
| 173 | #define ctob64(x) ((__uint64_t)(x)<<BPCSHIFT) | ||
| 174 | |||
| 175 | /* bytes to clicks */ | ||
| 176 | #define btoc(x) (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT) | ||
| 177 | |||
| 178 | #define ENOATTR ENODATA /* Attribute not found */ | 152 | #define ENOATTR ENODATA /* Attribute not found */ |
| 179 | #define EWRONGFS EINVAL /* Mount with wrong filesystem type */ | 153 | #define EWRONGFS EINVAL /* Mount with wrong filesystem type */ |
| 180 | #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ | 154 | #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 19a1f077dbd6..6c3a846a5267 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
| @@ -243,9 +243,8 @@ xfs_read( | |||
| 243 | 243 | ||
| 244 | if (unlikely(ioflags & IO_ISDIRECT)) { | 244 | if (unlikely(ioflags & IO_ISDIRECT)) { |
| 245 | if (VN_CACHED(vp)) | 245 | if (VN_CACHED(vp)) |
| 246 | ret = xfs_flushinval_pages(ip, | 246 | ret = xfs_flushinval_pages(ip, (*offset & PAGE_CACHE_MASK), |
| 247 | ctooff(offtoct(*offset)), | 247 | -1, FI_REMAPF_LOCKED); |
| 248 | -1, FI_REMAPF_LOCKED); | ||
| 249 | mutex_unlock(&inode->i_mutex); | 248 | mutex_unlock(&inode->i_mutex); |
| 250 | if (ret) { | 249 | if (ret) { |
| 251 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 250 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
| @@ -731,9 +730,9 @@ retry: | |||
| 731 | if (VN_CACHED(vp)) { | 730 | if (VN_CACHED(vp)) { |
| 732 | WARN_ON(need_i_mutex == 0); | 731 | WARN_ON(need_i_mutex == 0); |
| 733 | xfs_inval_cached_trace(xip, pos, -1, | 732 | xfs_inval_cached_trace(xip, pos, -1, |
| 734 | ctooff(offtoct(pos)), -1); | 733 | (pos & PAGE_CACHE_MASK), -1); |
| 735 | error = xfs_flushinval_pages(xip, | 734 | error = xfs_flushinval_pages(xip, |
| 736 | ctooff(offtoct(pos)), | 735 | (pos & PAGE_CACHE_MASK), |
| 737 | -1, FI_REMAPF_LOCKED); | 736 | -1, FI_REMAPF_LOCKED); |
| 738 | if (error) | 737 | if (error) |
| 739 | goto out_unlock_internal; | 738 | goto out_unlock_internal; |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index 023400aa55a3..baf537c1c177 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
| @@ -52,8 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone; | |||
| 52 | /* | 52 | /* |
| 53 | * Dquot hashtable constants/threshold values. | 53 | * Dquot hashtable constants/threshold values. |
| 54 | */ | 54 | */ |
| 55 | #define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t)) | 55 | #define XFS_QM_HASHSIZE_LOW (PAGE_SIZE / sizeof(xfs_dqhash_t)) |
| 56 | #define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t)) | 56 | #define XFS_QM_HASHSIZE_HIGH ((PAGE_SIZE * 4) / sizeof(xfs_dqhash_t)) |
| 57 | 57 | ||
| 58 | /* | 58 | /* |
| 59 | * This defines the unit of allocation of dquots. | 59 | * This defines the unit of allocation of dquots. |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index aca51e7e5c5a..1c0a5a585a82 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
| @@ -2830,11 +2830,11 @@ xfs_bmap_btalloc( | |||
| 2830 | args.prod = align; | 2830 | args.prod = align; |
| 2831 | if ((args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod))) | 2831 | if ((args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod))) |
| 2832 | args.mod = (xfs_extlen_t)(args.prod - args.mod); | 2832 | args.mod = (xfs_extlen_t)(args.prod - args.mod); |
| 2833 | } else if (mp->m_sb.sb_blocksize >= NBPP) { | 2833 | } else if (mp->m_sb.sb_blocksize >= PAGE_CACHE_SIZE) { |
| 2834 | args.prod = 1; | 2834 | args.prod = 1; |
| 2835 | args.mod = 0; | 2835 | args.mod = 0; |
| 2836 | } else { | 2836 | } else { |
| 2837 | args.prod = NBPP >> mp->m_sb.sb_blocklog; | 2837 | args.prod = PAGE_CACHE_SIZE >> mp->m_sb.sb_blocklog; |
| 2838 | if ((args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod)))) | 2838 | if ((args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod)))) |
| 2839 | args.mod = (xfs_extlen_t)(args.prod - args.mod); | 2839 | args.mod = (xfs_extlen_t)(args.prod - args.mod); |
| 2840 | } | 2840 | } |
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index d9ca3c0eb8cc..a451baaeede8 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
| @@ -399,7 +399,7 @@ xfs_bulkstat( | |||
| 399 | (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog); | 399 | (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog); |
| 400 | nimask = ~(nicluster - 1); | 400 | nimask = ~(nicluster - 1); |
| 401 | nbcluster = nicluster >> mp->m_sb.sb_inopblog; | 401 | nbcluster = nicluster >> mp->m_sb.sb_inopblog; |
| 402 | irbuf = kmem_zalloc_greedy(&irbsize, NBPC, NBPC * 4, | 402 | irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4, |
| 403 | KM_SLEEP | KM_MAYFAIL | KM_LARGE); | 403 | KM_SLEEP | KM_MAYFAIL | KM_LARGE); |
| 404 | nirbuf = irbsize / sizeof(*irbuf); | 404 | nirbuf = irbsize / sizeof(*irbuf); |
| 405 | 405 | ||
| @@ -830,7 +830,7 @@ xfs_inumbers( | |||
| 830 | agino = XFS_INO_TO_AGINO(mp, ino); | 830 | agino = XFS_INO_TO_AGINO(mp, ino); |
| 831 | left = *count; | 831 | left = *count; |
| 832 | *count = 0; | 832 | *count = 0; |
| 833 | bcount = MIN(left, (int)(NBPP / sizeof(*buffer))); | 833 | bcount = MIN(left, (int)(PAGE_SIZE / sizeof(*buffer))); |
| 834 | buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP); | 834 | buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP); |
| 835 | error = bufidx = 0; | 835 | error = bufidx = 0; |
| 836 | cur = NULL; | 836 | cur = NULL; |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 7ed15bdc32bf..4c86a26330a0 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
| @@ -1552,7 +1552,7 @@ xlog_dealloc_log(xlog_t *log) | |||
| 1552 | tic = log->l_unmount_free; | 1552 | tic = log->l_unmount_free; |
| 1553 | while (tic) { | 1553 | while (tic) { |
| 1554 | next_tic = tic->t_next; | 1554 | next_tic = tic->t_next; |
| 1555 | kmem_free(tic, NBPP); | 1555 | kmem_free(tic, PAGE_SIZE); |
| 1556 | tic = next_tic; | 1556 | tic = next_tic; |
| 1557 | } | 1557 | } |
| 1558 | } | 1558 | } |
| @@ -3161,13 +3161,13 @@ xlog_state_ticket_alloc(xlog_t *log) | |||
| 3161 | xlog_ticket_t *t_list; | 3161 | xlog_ticket_t *t_list; |
| 3162 | xlog_ticket_t *next; | 3162 | xlog_ticket_t *next; |
| 3163 | xfs_caddr_t buf; | 3163 | xfs_caddr_t buf; |
| 3164 | uint i = (NBPP / sizeof(xlog_ticket_t)) - 2; | 3164 | uint i = (PAGE_SIZE / sizeof(xlog_ticket_t)) - 2; |
| 3165 | 3165 | ||
| 3166 | /* | 3166 | /* |
| 3167 | * The kmem_zalloc may sleep, so we shouldn't be holding the | 3167 | * The kmem_zalloc may sleep, so we shouldn't be holding the |
| 3168 | * global lock. XXXmiken: may want to use zone allocator. | 3168 | * global lock. XXXmiken: may want to use zone allocator. |
| 3169 | */ | 3169 | */ |
| 3170 | buf = (xfs_caddr_t) kmem_zalloc(NBPP, KM_SLEEP); | 3170 | buf = (xfs_caddr_t) kmem_zalloc(PAGE_SIZE, KM_SLEEP); |
| 3171 | 3171 | ||
| 3172 | spin_lock(&log->l_icloglock); | 3172 | spin_lock(&log->l_icloglock); |
| 3173 | 3173 | ||
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 5322d9fb5321..7f380e885a6f 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
| @@ -4164,15 +4164,12 @@ xfs_free_file_space( | |||
| 4164 | vn_iowait(ip); /* wait for the completion of any pending DIOs */ | 4164 | vn_iowait(ip); /* wait for the completion of any pending DIOs */ |
| 4165 | } | 4165 | } |
| 4166 | 4166 | ||
| 4167 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, NBPP); | 4167 | rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); |
| 4168 | ioffset = offset & ~(rounding - 1); | 4168 | ioffset = offset & ~(rounding - 1); |
| 4169 | 4169 | ||
| 4170 | if (VN_CACHED(vp) != 0) { | 4170 | if (VN_CACHED(vp) != 0) { |
| 4171 | xfs_inval_cached_trace(ip, ioffset, -1, | 4171 | xfs_inval_cached_trace(ip, ioffset, -1, ioffset, -1); |
| 4172 | ctooff(offtoct(ioffset)), -1); | 4172 | error = xfs_flushinval_pages(ip, ioffset, -1, FI_REMAPF_LOCKED); |
| 4173 | error = xfs_flushinval_pages(ip, | ||
| 4174 | ctooff(offtoct(ioffset)), | ||
| 4175 | -1, FI_REMAPF_LOCKED); | ||
| 4176 | if (error) | 4173 | if (error) |
| 4177 | goto out_unlock_iolock; | 4174 | goto out_unlock_iolock; |
| 4178 | } | 4175 | } |
