Commit 200463d7 authored by Nathan Scott's avatar Nathan Scott Committed by Stephen Lord

[XFS] Separate the big filesystems macro out into separate big inums and...

[XFS] Separate the big filesystems macro out into separate big inums and blknos macros; fix the check for too-large filesystems in the process.

SGI Modid: 2.5.x-xfs:slinx:158361a
parent 9a2ad89b
......@@ -66,8 +66,12 @@
# define XFS_REALTIME_STRING
#endif
#if XFS_BIG_FILESYSTEMS
# define XFS_BIGFS_STRING "big filesystems, "
#if XFS_BIG_BLKNOS
# if XFS_BIG_INUMS
# define XFS_BIGFS_STRING "large block/inode numbers, "
# else
# define XFS_BIGFS_STRING "large block numbers, "
# endif
#else
# define XFS_BIGFS_STRING
#endif
......
......@@ -32,8 +32,8 @@
#ifndef __XFS_ARCH_H__
#define __XFS_ARCH_H__
#ifndef XFS_BIG_FILESYSTEMS
#error XFS_BIG_FILESYSTEMS must be defined true or false
#ifndef XFS_BIG_INUMS
# error XFS_BIG_INUMS must be defined true or false
#endif
#ifdef __KERNEL__
......@@ -239,7 +239,7 @@
(INT_GET_UNALIGNED_32_BE(pointer)) \
)
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
#define DIRINO_GET_ARCH(pointer,arch) \
( ((arch) == ARCH_NOCONVERT) \
? \
......
/*
* Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -1899,7 +1899,7 @@ __xfs_bmbt_get_all(
ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
s->br_startoff = ((xfs_fileoff_t)l0 &
XFS_MASK64LO(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
s->br_startblock = (((xfs_fsblock_t)l0 & XFS_MASK64LO(9)) << 43) |
(((xfs_fsblock_t)l1) >> 21);
#else
......@@ -1915,7 +1915,7 @@ __xfs_bmbt_get_all(
#else /* !DEBUG */
s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
#endif /* DEBUG */
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
s->br_blockcount = (xfs_filblks_t)(l1 & XFS_MASK64LO(21));
/* This is xfs_extent_state() in-line */
if (ext_flag) {
......@@ -1976,7 +1976,7 @@ xfs_fsblock_t
xfs_bmbt_get_startblock(
xfs_bmbt_rec_t *r)
{
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
return (((xfs_fsblock_t)r->l0 & XFS_MASK64LO(9)) << 43) |
(((xfs_fsblock_t)r->l1) >> 21);
#else
......@@ -1990,7 +1990,7 @@ xfs_bmbt_get_startblock(
#else /* !DEBUG */
return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
#endif /* DEBUG */
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
/*
......@@ -2047,7 +2047,7 @@ xfs_fsblock_t
xfs_bmbt_disk_get_startblock(
xfs_bmbt_rec_t *r)
{
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
return (((xfs_fsblock_t)INT_GET(r->l0, ARCH_CONVERT) & XFS_MASK64LO(9)) << 43) |
(((xfs_fsblock_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21);
#else
......@@ -2061,7 +2061,7 @@ xfs_bmbt_disk_get_startblock(
#else /* !DEBUG */
return (xfs_fsblock_t)(((xfs_dfsbno_t)INT_GET(r->l1, ARCH_CONVERT)) >> 21);
#endif /* DEBUG */
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
/*
......@@ -2472,17 +2472,15 @@ xfs_bmbt_set_all(
extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0);
#endif /* XFS_BIG_FILESYSTEMS */
#if XFS_BIG_FILESYSTEMS
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
((xfs_bmbt_rec_base_t)s->br_startblock >> 43);
r->l1 = ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
#else /* !XFS_BIG_FILESYSTEMS */
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(s->br_startblock)) {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
......@@ -2498,7 +2496,7 @@ xfs_bmbt_set_all(
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
/*
......@@ -2518,17 +2516,15 @@ xfs_bmbt_set_allf(
extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
#endif /* XFS_BIG_FILESYSTEMS */
#if XFS_BIG_FILESYSTEMS
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
((xfs_bmbt_rec_base_t)b >> 43);
r->l1 = ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
#else /* !XFS_BIG_FILESYSTEMS */
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(b)) {
r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
......@@ -2544,7 +2540,7 @@ xfs_bmbt_set_allf(
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
#if ARCH_CONVERT != ARCH_NOCONVERT
......@@ -2563,17 +2559,15 @@ xfs_bmbt_disk_set_all(
extent_flag = (s->br_state == XFS_EXT_NORM) ? 0 : 1;
ASSERT((s->br_startoff & XFS_MASK64HI(9)) == 0);
ASSERT((s->br_blockcount & XFS_MASK64HI(43)) == 0);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
ASSERT((s->br_startblock & XFS_MASK64HI(12)) == 0);
#endif /* XFS_BIG_FILESYSTEMS */
#if XFS_BIG_FILESYSTEMS
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
((xfs_bmbt_rec_base_t)s->br_startblock >> 43));
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)s->br_startblock << 21) |
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_FILESYSTEMS */
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(s->br_startblock)) {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)s->br_startoff << 9) |
......@@ -2589,7 +2583,7 @@ xfs_bmbt_disk_set_all(
((xfs_bmbt_rec_base_t)s->br_blockcount &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
/*
......@@ -2609,17 +2603,15 @@ xfs_bmbt_disk_set_allf(
extent_flag = (v == XFS_EXT_NORM) ? 0 : 1;
ASSERT((o & XFS_MASK64HI(64-BMBT_STARTOFF_BITLEN)) == 0);
ASSERT((c & XFS_MASK64HI(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
ASSERT((b & XFS_MASK64HI(64-BMBT_STARTBLOCK_BITLEN)) == 0);
#endif /* XFS_BIG_FILESYSTEMS */
#if XFS_BIG_FILESYSTEMS
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
((xfs_bmbt_rec_base_t)b >> 43));
INT_SET(r->l1, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)b << 21) |
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
#else /* !XFS_BIG_FILESYSTEMS */
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(b)) {
INT_SET(r->l0, ARCH_CONVERT, ((xfs_bmbt_rec_base_t)extent_flag << 63) |
((xfs_bmbt_rec_base_t)o << 9) |
......@@ -2635,7 +2627,7 @@ xfs_bmbt_disk_set_allf(
((xfs_bmbt_rec_base_t)c &
(xfs_bmbt_rec_base_t)XFS_MASK64LO(21)));
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
#endif
......@@ -2660,15 +2652,13 @@ xfs_bmbt_set_startblock(
xfs_bmbt_rec_t *r,
xfs_fsblock_t v)
{
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
ASSERT((v & XFS_MASK64HI(12)) == 0);
#endif /* XFS_BIG_FILESYSTEMS */
#if XFS_BIG_FILESYSTEMS
r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)XFS_MASK64HI(55)) |
(xfs_bmbt_rec_base_t)(v >> 43);
r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21)) |
(xfs_bmbt_rec_base_t)(v << 21);
#else /* !XFS_BIG_FILESYSTEMS */
#else /* !XFS_BIG_BLKNOS */
if (ISNULLSTARTBLOCK(v)) {
r->l0 |= (xfs_bmbt_rec_base_t)XFS_MASK64LO(9);
r->l1 = (xfs_bmbt_rec_base_t)XFS_MASK64HI(11) |
......@@ -2679,7 +2669,7 @@ xfs_bmbt_set_startblock(
r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
(r->l1 & (xfs_bmbt_rec_base_t)XFS_MASK64LO(21));
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_BLKNOS */
}
/*
......
......@@ -108,7 +108,7 @@ typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t, xfs_bmdr_rec_t;
* Values and macros for delayed-allocation startblock fields.
*/
#define STARTBLOCKVALBITS 17
#define STARTBLOCKMASKBITS (15 + XFS_BIG_FILESYSTEMS * 20)
#define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20)
#define DSTARTBLOCKMASKBITS (15 + 20)
#define STARTBLOCKMASK \
(((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
......
/*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -530,10 +530,9 @@ xfs_dir2_block_getdents(
p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
ptr - (char *)block);
#if XFS_BIG_FILESYSTEMS
p.ino = INT_GET(dep->inumber, ARCH_CONVERT) + mp->m_inoadd;
#else
p.ino = INT_GET(dep->inumber, ARCH_CONVERT);
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = (char *)dep->name;
......
/*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -1118,10 +1118,9 @@ xfs_dir2_leaf_getdents(
p.cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length);
#if XFS_BIG_FILESYSTEMS
p.ino = INT_GET(dep->inumber, ARCH_CONVERT) + mp->m_inoadd;
#else
p.ino = INT_GET(dep->inumber, ARCH_CONVERT);
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = (char *)dep->name;
......
/*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -79,10 +79,10 @@ static void xfs_dir2_sf_check(xfs_da_args_t *args);
#else
#define xfs_dir2_sf_check(args)
#endif /* DEBUG */
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
static void xfs_dir2_sf_toino4(xfs_da_args_t *args);
static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_INUMS */
/*
* Given a block directory (dp/block), calculate its size as a shortform (sf)
......@@ -136,7 +136,7 @@ xfs_dir2_block_sfsize(
isdotdot =
dep->namelen == 2 &&
dep->name[0] == '.' && dep->name[1] == '.';
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (!isdot)
i8count += INT_GET(dep->inumber, ARCH_CONVERT) > XFS_DIR2_MAX_SHORT_INUM;
#endif
......@@ -324,7 +324,8 @@ xfs_dir2_sf_addname(
*/
add_entsize = XFS_DIR2_SF_ENTSIZE_BYNAME(sfp, args->namelen);
incr_isize = add_entsize;
#if XFS_BIG_FILESYSTEMS
objchange = 0;
#if XFS_BIG_INUMS
/*
* Do we have to change to 8 byte inodes?
*/
......@@ -340,10 +341,7 @@ xfs_dir2_sf_addname(
((uint)sizeof(xfs_dir2_ino8_t) -
(uint)sizeof(xfs_dir2_ino4_t));
objchange = 1;
} else
objchange = 0;
#else
objchange = 0;
}
#endif
old_isize = (int)dp->i_d.di_size;
new_isize = old_isize + incr_isize;
......@@ -383,7 +381,7 @@ xfs_dir2_sf_addname(
*/
else {
ASSERT(pick == 2);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (objchange)
xfs_dir2_sf_toino8(args);
#endif
......@@ -437,7 +435,7 @@ xfs_dir2_sf_addname_easy(
* Update the header and inode.
*/
sfp->hdr.count++;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (args->inumber > XFS_DIR2_MAX_SHORT_INUM)
sfp->hdr.i8count++;
#endif
......@@ -526,7 +524,7 @@ xfs_dir2_sf_addname_hard(
XFS_DIR2_SF_PUT_INUMBER_ARCH(sfp, &args->inumber,
XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT);
sfp->hdr.count++;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
sfp->hdr.i8count++;
#endif
......@@ -603,7 +601,7 @@ xfs_dir2_sf_addname_pick(
/*
* If changing the inode number size, do it the hard way.
*/
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (objchange) {
return 2;
}
......@@ -657,9 +655,7 @@ xfs_dir2_sf_check(
XFS_DIR2_DATA_ENTSIZE(sfep->namelen);
}
ASSERT(i8count == sfp->hdr.i8count);
#if !XFS_BIG_FILESYSTEMS
ASSERT(i8count == 0);
#endif
ASSERT(XFS_BIG_INUMS || i8count == 0);
ASSERT((char *)sfep - (char *)sfp == dp->i_d.di_size);
ASSERT(offset +
(sfp->hdr.count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) +
......@@ -779,10 +775,9 @@ xfs_dir2_sf_getdents(
XFS_DIR2_DATA_DOT_OFFSET)) {
p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, 0,
XFS_DIR2_DATA_DOTDOT_OFFSET);
#if XFS_BIG_FILESYSTEMS
p.ino = dp->i_ino + mp->m_inoadd;
#else
p.ino = dp->i_ino;
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = ".";
p.namelen = 1;
......@@ -805,11 +800,10 @@ xfs_dir2_sf_getdents(
XFS_DIR2_DATA_DOTDOT_OFFSET)) {
p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
XFS_DIR2_DATA_FIRST_OFFSET);
#if XFS_BIG_FILESYSTEMS
p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT) +
mp->m_inoadd;
#else
p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT);
p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent,
ARCH_CONVERT);
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = "..";
p.namelen = 2;
......@@ -843,13 +837,10 @@ xfs_dir2_sf_getdents(
XFS_DIR2_SF_GET_OFFSET_ARCH(sfep, ARCH_CONVERT) +
XFS_DIR2_DATA_ENTSIZE(p.namelen));
#if XFS_BIG_FILESYSTEMS
p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp,
XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT) +
mp->m_inoadd;
#else
p.ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp,
XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT);
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = (char *)sfep->name;
......@@ -1014,7 +1005,7 @@ xfs_dir2_sf_removename(
*/
xfs_idata_realloc(dp, newsize - oldsize, XFS_DATA_FORK);
sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
/*
* Are we changing inode number size?
*/
......@@ -1039,10 +1030,10 @@ xfs_dir2_sf_replace(
{
xfs_inode_t *dp; /* incore directory inode */
int i; /* entry index */
#if XFS_BIG_FILESYSTEMS || defined(DEBUG)
#if XFS_BIG_INUMS || defined(DEBUG)
xfs_ino_t ino=0; /* entry old inode number */
#endif
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
int i8elevated; /* sf_toino8 set i8count=1 */
#endif
xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */
......@@ -1063,7 +1054,7 @@ xfs_dir2_sf_replace(
ASSERT(dp->i_df.if_u1.if_data != NULL);
sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
/*
* New inode number is large, and need to convert to 8-byte inodes.
*/
......@@ -1101,7 +1092,7 @@ xfs_dir2_sf_replace(
*/
if (args->namelen == 2 &&
args->name[0] == '.' && args->name[1] == '.') {
#if XFS_BIG_FILESYSTEMS || defined(DEBUG)
#if XFS_BIG_INUMS || defined(DEBUG)
ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp, &sfp->hdr.parent, ARCH_CONVERT);
ASSERT(args->inumber != ino);
#endif
......@@ -1117,7 +1108,7 @@ xfs_dir2_sf_replace(
if (sfep->namelen == args->namelen &&
sfep->name[0] == args->name[0] &&
memcmp(args->name, sfep->name, args->namelen) == 0) {
#if XFS_BIG_FILESYSTEMS || defined(DEBUG)
#if XFS_BIG_INUMS || defined(DEBUG)
ino = XFS_DIR2_SF_GET_INUMBER_ARCH(sfp,
XFS_DIR2_SF_INUMBERP(sfep), ARCH_CONVERT);
ASSERT(args->inumber != ino);
......@@ -1132,14 +1123,14 @@ xfs_dir2_sf_replace(
*/
if (i == sfp->hdr.count) {
ASSERT(args->oknoent);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (i8elevated)
xfs_dir2_sf_toino4(args);
#endif
return XFS_ERROR(ENOENT);
}
}
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
/*
* See if the old number was large, the new number is small.
*/
......@@ -1172,7 +1163,7 @@ xfs_dir2_sf_replace(
return 0;
}
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
/*
* Convert from 8-byte inode numbers to 4-byte inode numbers.
* The last 8-byte inode number is gone, but the count is still 1.
......@@ -1325,4 +1316,4 @@ xfs_dir2_sf_toino8(
dp->i_d.di_size = newsize;
xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
}
#endif /* XFS_BIG_FILESYSTEMS */
#endif /* XFS_BIG_INUMS */
/*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -561,10 +561,9 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp,
if (sbp->seqno == 0 || sbp == sbuf)
lastresid = uio->uio_resid;
XFS_PUT_COOKIE(p.cook, mp, 0, sbp[1].seqno, sbp[1].hash);
#if XFS_BIG_FILESYSTEMS
p.ino = sbp->ino + mp->m_inoadd;
#else
p.ino = sbp->ino;
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = sbp->name;
p.namelen = sbp->namelen;
......@@ -2142,10 +2141,9 @@ xfs_dir_leaf_getdents_int(
* then restore the UIO to the first entry in the current
* run of equal-hashval entries (probably one 1 entry long).
*/
#if XFS_BIG_FILESYSTEMS
p.ino = XFS_GET_DIR_INO_ARCH(mp, namest->inumber, ARCH_CONVERT) + mp->m_inoadd;
#else
p.ino = XFS_GET_DIR_INO_ARCH(mp, namest->inumber, ARCH_CONVERT);
#if XFS_BIG_INUMS
p.ino += mp->m_inoadd;
#endif
p.name = (char *)namest->name;
p.namelen = entry->namelen;
......
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -47,7 +47,7 @@ typedef __uint32_t xfs_agino_t; /* within allocation grp inode number */
* Used in some places where having 64-bits in the 32-bit kernels
* costs too much.
*/
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
typedef xfs_ino_t xfs_intino_t;
#else
typedef __uint32_t xfs_intino_t;
......@@ -162,7 +162,7 @@ xfs_agino_t xfs_offbno_to_agino(struct xfs_mount *mp, xfs_agblock_t b, int o);
((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
#endif
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))
#else
......
......@@ -222,15 +222,21 @@ xfs_mount_validate_sb(
return XFS_ERROR(EWRONGFS);
}
if (unlikely(sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
cmn_err(CE_WARN, "XFS: filesystem is marked as having an external log; specify logdev on the\nmount command line.");
if (unlikely(
sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
cmn_err(CE_WARN,
"XFS: filesystem is marked as having an external log; "
"specify logdev on the\nmount command line.");
XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(1)",
XFS_ERRLEVEL_HIGH, mp, sbp);
return XFS_ERROR(EFSCORRUPTED);
}
if (unlikely(sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
cmn_err(CE_WARN, "XFS: filesystem is marked as having an internal log; don't specify logdev on\nthe mount command line.");
if (unlikely(
sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
cmn_err(CE_WARN,
"XFS: filesystem is marked as having an internal log; "
"don't specify logdev on\nthe mount command line.");
XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(2)",
XFS_ERRLEVEL_HIGH, mp, sbp);
return XFS_ERROR(EFSCORRUPTED);
......@@ -276,10 +282,14 @@ xfs_mount_validate_sb(
return XFS_ERROR(EFSCORRUPTED);
}
#if !XFS_BIG_FILESYSTEMS
if (sbp->sb_dblocks > INT_MAX || sbp->sb_rblocks > INT_MAX) {
#if !XFS_BIG_BLKNOS
if (unlikely(
(sbp->sb_dblocks << (__uint64_t)(sbp->sb_blocklog - BBSHIFT))
> INT_MAX ||
(sbp->sb_rblocks << (__uint64_t)(sbp->sb_blocklog - BBSHIFT))
> INT_MAX)) {
cmn_err(CE_WARN,
"XFS: File systems greater than 1TB not supported on this system.");
"XFS: File system is too large to be mounted on this system.");
return XFS_ERROR(E2BIG);
}
#endif
......@@ -294,7 +304,7 @@ xfs_mount_validate_sb(
/*
* Until this is fixed only page-sized or smaller data blocks work.
*/
if (sbp->sb_blocksize > PAGE_SIZE) {
if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
cmn_err(CE_WARN,
"XFS: Attempted to mount file system with blocksize %d bytes",
sbp->sb_blocksize);
......
......@@ -354,7 +354,7 @@ typedef struct xfs_mount {
__uint64_t m_maxioffset; /* maximum inode offset */
__uint64_t m_resblks; /* total reserved blocks */
__uint64_t m_resblks_avail;/* available reserved blocks */
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
xfs_ino_t m_inoadd; /* add value for ino64_offset */
#endif
int m_dalign; /* stripe unit */
......@@ -392,9 +392,7 @@ typedef struct xfs_mount {
#define XFS_MOUNT_WSYNC 0x00000001 /* for nfs - all metadata ops
must be synchronous except
for space allocations */
#if XFS_BIG_FILESYSTEMS
#define XFS_MOUNT_INO64 0x00000002
#endif
/* 0x00000004 -- currently unused */
/* 0x00000008 -- currently unused */
#define XFS_MOUNT_FS_SHUTDOWN 0x00000010 /* atomic stop of all filesystem
......
......@@ -77,7 +77,7 @@ struct xfs_trans;
#define XFS_RTLOBIT(w) xfs_lowbit32(w)
#define XFS_RTHIBIT(w) xfs_highbit32(w)
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
#define XFS_RTBLOCKLOG(b) xfs_highbit64(b)
#else
#define XFS_RTBLOCKLOG(b) xfs_highbit32(b)
......
......@@ -78,20 +78,21 @@ typedef __uint64_t __psunsigned_t;
#endif /* __KERNEL__ */
/*
* Some types are conditional based on the selected configuration.
* Set XFS_BIG_FILESYSTEMS=1 or 0 depending on the desired configuration.
* XFS_BIG_FILESYSTEMS needs daddr_t to be 64 bits
*
* On linux right now we are limited to 2^32 512 byte blocks in a
* filesystem, Once this limit is changed, setting this to 1
* will allow XFS to go larger. With BIG_FILESYSTEMS set to 0
* a 4K block filesystem could still theoretically be 16Gbytes
* long, so on an ia32 box the 32 bit page index will then be
* the limiting factor.
* Some types are conditional depending on the target system.
* XFS_BIG_BLKNOS needs block layer disk addresses to be 64 bits.
* XFS_BIG_INUMS needs the VFS inode number to be 64 bits, as well
* as requiring XFS_BIG_BLKNOS to be set.
*/
#ifndef XFS_BIG_FILESYSTEMS
#define XFS_BIG_FILESYSTEMS 0
#if defined(CONFIG_LBD) || (defined(HAVE_SECTOR_T) && (BITS_PER_LONG == 64))
# define XFS_BIG_BLKNOS 1
# if BITS_PER_LONG == 64
# define XFS_BIG_INUMS 1
# else
# define XFS_BIG_INUMS 0
# endif
#else
# define XFS_BIG_BLKNOS 0
# define XFS_BIG_INUMS 0
#endif
typedef __uint32_t xfs_agblock_t; /* blockno in alloc. group */
......@@ -126,7 +127,7 @@ typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
/*
* Memory based types are conditional.
*/
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_BLKNOS
typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
......
......@@ -264,7 +264,7 @@ xfs_start_flags(
*/
if (ap->flags & XFSMNT_WSYNC)
mp->m_flags |= XFS_MOUNT_WSYNC;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (ap->flags & XFSMNT_INO64) {
mp->m_flags |= XFS_MOUNT_INO64;
mp->m_inoadd = XFS_INO64_OFFSET;
......@@ -769,13 +769,13 @@ xfs_statvfs(
statp->f_blocks = sbp->sb_dblocks - lsize;
statp->f_bfree = statp->f_bavail = sbp->sb_fdblocks;
fakeinos = statp->f_bfree << sbp->sb_inopblog;
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
fakeinos += mp->m_inoadd;
#endif
statp->f_files =
MIN(sbp->sb_icount + fakeinos, (__uint64_t)XFS_MAXINUMBER);
if (mp->m_maxicount)
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
if (!mp->m_inoadd)
#endif
statp->f_files =
......@@ -1674,7 +1674,7 @@ xfs_parseargs(
args->flags |= XFSMNT_NORECOVERY;
} else if (!strcmp(this_char, MNTOPT_INO64)) {
args->flags |= XFSMNT_INO64;
#ifndef XFS_BIG_FILESYSTEMS
#if !XFS_BIG_INUMS
printk("XFS: %s option not allowed on this system\n",
MNTOPT_INO64);
return EINVAL;
......@@ -1697,7 +1697,7 @@ xfs_parseargs(
dswidth = simple_strtoul(value, &eov, 10);
} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
args->flags &= ~XFSMNT_32BITINODES;
#ifndef XFS_BIG_FILESYSTEMS
#if !XFS_BIG_INUMS
printk("XFS: %s option not allowed on this system\n",
MNTOPT_64BITINODE);
return EINVAL;
......
......@@ -152,10 +152,9 @@ xfs_getattr(
vap->va_nblocks =
XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
vap->va_fsid = mp->m_dev;
#if XFS_BIG_FILESYSTEMS
vap->va_nodeid = ip->i_ino + mp->m_inoadd;
#else
vap->va_nodeid = ip->i_ino;
#if XFS_BIG_INUMS
vap->va_nodeid += mp->m_inoadd;
#endif
vap->va_nlink = ip->i_d.di_nlink;
......
......@@ -4692,7 +4692,7 @@ xfsidbg_xmount(xfs_mount_t *mp)
mp->m_attroffset, mp->m_maxicount, mp->m_inoalign_mask);
kdb_printf("resblks %Ld resblks_avail %Ld\n", mp->m_resblks,
mp->m_resblks_avail);
#if XFS_BIG_FILESYSTEMS
#if XFS_BIG_INUMS
kdb_printf(" inoadd %llx\n", (unsigned long long) mp->m_inoadd);
#else
kdb_printf("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment