Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6a4b37f authored by Tim Shimmin's avatar Tim Shimmin Committed by Lachlan McIlroy
Browse files

[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: default avatarTim Shimmin <tes@sgi.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent f7b7c367
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -138,43 +138,17 @@

#define spinlock_destroy(lock)

#define NBPP		PAGE_SIZE
#define NDPP		(1 << (PAGE_SHIFT - 9))

#define NBBY		8		/* number of bits per byte */
#define	NBPC		PAGE_SIZE	/* Number of bytes per click */
#define	BPCSHIFT	PAGE_SHIFT	/* LOG2(NBPC) if exact */

/*
 * Size of block device i/o is parameterized here.
 * Currently the system supports page-sized i/o.
 */
#define	BLKDEV_IOSHIFT		BPCSHIFT
#define	BLKDEV_IOSHIFT		PAGE_CACHE_SHIFT
#define	BLKDEV_IOSIZE		(1<<BLKDEV_IOSHIFT)
/* number of BB's per block device block */
#define	BLKDEV_BB		BTOBB(BLKDEV_IOSIZE)

/* bytes to clicks */
#define	btoc(x)		(((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)
#define	btoct(x)	((__psunsigned_t)(x)>>BPCSHIFT)
#define	btoc64(x)	(((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
#define	btoct64(x)	((__uint64_t)(x)>>BPCSHIFT)

/* off_t bytes to clicks */
#define offtoc(x)       (((__uint64_t)(x)+(NBPC-1))>>BPCSHIFT)
#define offtoct(x)      ((xfs_off_t)(x)>>BPCSHIFT)

/* clicks to off_t bytes */
#define	ctooff(x)	((xfs_off_t)(x)<<BPCSHIFT)

/* clicks to bytes */
#define	ctob(x)		((__psunsigned_t)(x)<<BPCSHIFT)
#define btoct(x)        ((__psunsigned_t)(x)>>BPCSHIFT)
#define	ctob64(x)	((__uint64_t)(x)<<BPCSHIFT)

/* bytes to clicks */
#define btoc(x)         (((__psunsigned_t)(x)+(NBPC-1))>>BPCSHIFT)

#define ENOATTR		ENODATA		/* Attribute not found */
#define EWRONGFS	EINVAL		/* Mount with wrong filesystem type */
#define EFSCORRUPTED	EUCLEAN		/* Filesystem is corrupted */
+4 −5
Original line number Diff line number Diff line
@@ -243,8 +243,7 @@ xfs_read(

	if (unlikely(ioflags & IO_ISDIRECT)) {
		if (VN_CACHED(vp))
			ret = xfs_flushinval_pages(ip,
					ctooff(offtoct(*offset)),
			ret = xfs_flushinval_pages(ip, (*offset & PAGE_CACHE_MASK),
						    -1, FI_REMAPF_LOCKED);
		mutex_unlock(&inode->i_mutex);
		if (ret) {
@@ -731,9 +730,9 @@ xfs_write(
		if (VN_CACHED(vp)) {
			WARN_ON(need_i_mutex == 0);
			xfs_inval_cached_trace(xip, pos, -1,
					ctooff(offtoct(pos)), -1);
					(pos & PAGE_CACHE_MASK), -1);
			error = xfs_flushinval_pages(xip,
					ctooff(offtoct(pos)),
					(pos & PAGE_CACHE_MASK),
					-1, FI_REMAPF_LOCKED);
			if (error)
				goto out_unlock_internal;
+2 −2
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone;
/*
 * Dquot hashtable constants/threshold values.
 */
#define XFS_QM_HASHSIZE_LOW		(NBPP / sizeof(xfs_dqhash_t))
#define XFS_QM_HASHSIZE_HIGH		((NBPP * 4) / sizeof(xfs_dqhash_t))
#define XFS_QM_HASHSIZE_LOW		(PAGE_SIZE / sizeof(xfs_dqhash_t))
#define XFS_QM_HASHSIZE_HIGH		((PAGE_SIZE * 4) / sizeof(xfs_dqhash_t))

/*
 * This defines the unit of allocation of dquots.
+2 −2
Original line number Diff line number Diff line
@@ -2830,11 +2830,11 @@ xfs_bmap_btalloc(
		args.prod = align;
		if ((args.mod = (xfs_extlen_t)do_mod(ap->off, args.prod)))
			args.mod = (xfs_extlen_t)(args.prod - args.mod);
	} else if (mp->m_sb.sb_blocksize >= NBPP) {
	} else if (mp->m_sb.sb_blocksize >= PAGE_CACHE_SIZE) {
		args.prod = 1;
		args.mod = 0;
	} else {
		args.prod = NBPP >> mp->m_sb.sb_blocklog;
		args.prod = PAGE_CACHE_SIZE >> mp->m_sb.sb_blocklog;
		if ((args.mod = (xfs_extlen_t)(do_mod(ap->off, args.prod))))
			args.mod = (xfs_extlen_t)(args.prod - args.mod);
	}
+2 −2
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ xfs_bulkstat(
		(XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog);
	nimask = ~(nicluster - 1);
	nbcluster = nicluster >> mp->m_sb.sb_inopblog;
	irbuf = kmem_zalloc_greedy(&irbsize, NBPC, NBPC * 4,
	irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4,
				   KM_SLEEP | KM_MAYFAIL | KM_LARGE);
	nirbuf = irbsize / sizeof(*irbuf);

@@ -830,7 +830,7 @@ xfs_inumbers(
	agino = XFS_INO_TO_AGINO(mp, ino);
	left = *count;
	*count = 0;
	bcount = MIN(left, (int)(NBPP / sizeof(*buffer)));
	bcount = MIN(left, (int)(PAGE_SIZE / sizeof(*buffer)));
	buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP);
	error = bufidx = 0;
	cur = NULL;
Loading