aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/Kconfig1
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c8
-rw-r--r--fs/xfs/libxfs/xfs_bmap_btree.c89
-rw-r--r--fs/xfs/libxfs/xfs_btree.c32
-rw-r--r--fs/xfs/libxfs/xfs_btree.h2
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c2
-rw-r--r--fs/xfs/libxfs/xfs_dir2_sf.c45
-rw-r--r--fs/xfs/libxfs/xfs_format.h14
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.c4
-rw-r--r--fs/xfs/libxfs/xfs_inum.h4
-rw-r--r--fs/xfs/libxfs/xfs_log_format.h4
-rw-r--r--fs/xfs/libxfs/xfs_quota_defs.h2
-rw-r--r--fs/xfs/libxfs/xfs_sb.h8
-rw-r--r--fs/xfs/xfs_bmap_util.c2
-rw-r--r--fs/xfs/xfs_fs.h4
-rw-r--r--fs/xfs/xfs_linux.h12
-rw-r--r--fs/xfs/xfs_log_cil.c2
-rw-r--r--fs/xfs/xfs_mount.c10
-rw-r--r--fs/xfs/xfs_qm.c189
-rw-r--r--fs/xfs/xfs_qm.h1
-rw-r--r--fs/xfs/xfs_quotaops.c2
-rw-r--r--fs/xfs/xfs_rtalloc.c4
-rw-r--r--fs/xfs/xfs_super.c34
-rw-r--r--fs/xfs/xfs_super.h15
-rw-r--r--fs/xfs/xfs_types.h29
25 files changed, 166 insertions, 353 deletions
diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index 399e8cec6e60..5d47b4df61ea 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -1,6 +1,7 @@
1config XFS_FS 1config XFS_FS
2 tristate "XFS filesystem support" 2 tristate "XFS filesystem support"
3 depends on BLOCK 3 depends on BLOCK
4 depends on (64BIT || LBDAF)
4 select EXPORTFS 5 select EXPORTFS
5 select LIBCRC32C 6 select LIBCRC32C
6 help 7 help
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 94ac88306fa6..de2d26d32844 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -392,7 +392,7 @@ xfs_bmap_check_leaf_extents(
392 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); 392 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
393 bno = be64_to_cpu(*pp); 393 bno = be64_to_cpu(*pp);
394 394
395 ASSERT(bno != NULLDFSBNO); 395 ASSERT(bno != NULLFSBLOCK);
396 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); 396 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
397 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks); 397 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
398 398
@@ -1299,7 +1299,7 @@ xfs_bmap_read_extents(
1299 ASSERT(level > 0); 1299 ASSERT(level > 0);
1300 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); 1300 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
1301 bno = be64_to_cpu(*pp); 1301 bno = be64_to_cpu(*pp);
1302 ASSERT(bno != NULLDFSBNO); 1302 ASSERT(bno != NULLFSBLOCK);
1303 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); 1303 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
1304 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks); 1304 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
1305 /* 1305 /*
@@ -1429,11 +1429,7 @@ xfs_bmap_search_multi_extents(
1429 gotp->br_startoff = 0xffa5a5a5a5a5a5a5LL; 1429 gotp->br_startoff = 0xffa5a5a5a5a5a5a5LL;
1430 gotp->br_blockcount = 0xa55a5a5a5a5a5a5aLL; 1430 gotp->br_blockcount = 0xa55a5a5a5a5a5a5aLL;
1431 gotp->br_state = XFS_EXT_INVALID; 1431 gotp->br_state = XFS_EXT_INVALID;
1432#if XFS_BIG_BLKNOS
1433 gotp->br_startblock = 0xffffa5a5a5a5a5a5LL; 1432 gotp->br_startblock = 0xffffa5a5a5a5a5a5LL;
1434#else
1435 gotp->br_startblock = 0xffffa5a5;
1436#endif
1437 prevp->br_startoff = NULLFILEOFF; 1433 prevp->br_startoff = NULLFILEOFF;
1438 1434
1439 ep = xfs_iext_bno_to_ext(ifp, bno, &lastx); 1435 ep = xfs_iext_bno_to_ext(ifp, bno, &lastx);
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c
index a388de4ceaa1..fba753308f31 100644
--- a/fs/xfs/libxfs/xfs_bmap_btree.c
+++ b/fs/xfs/libxfs/xfs_bmap_btree.c
@@ -111,23 +111,8 @@ __xfs_bmbt_get_all(
111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN)); 111 ext_flag = (int)(l0 >> (64 - BMBT_EXNTFLAG_BITLEN));
112 s->br_startoff = ((xfs_fileoff_t)l0 & 112 s->br_startoff = ((xfs_fileoff_t)l0 &
113 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9; 113 xfs_mask64lo(64 - BMBT_EXNTFLAG_BITLEN)) >> 9;
114#if XFS_BIG_BLKNOS
115 s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) | 114 s->br_startblock = (((xfs_fsblock_t)l0 & xfs_mask64lo(9)) << 43) |
116 (((xfs_fsblock_t)l1) >> 21); 115 (((xfs_fsblock_t)l1) >> 21);
117#else
118#ifdef DEBUG
119 {
120 xfs_dfsbno_t b;
121
122 b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
123 (((xfs_dfsbno_t)l1) >> 21);
124 ASSERT((b >> 32) == 0 || isnulldstartblock(b));
125 s->br_startblock = (xfs_fsblock_t)b;
126 }
127#else /* !DEBUG */
128 s->br_startblock = (xfs_fsblock_t)(((xfs_dfsbno_t)l1) >> 21);
129#endif /* DEBUG */
130#endif /* XFS_BIG_BLKNOS */
131 s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21)); 116 s->br_blockcount = (xfs_filblks_t)(l1 & xfs_mask64lo(21));
132 /* This is xfs_extent_state() in-line */ 117 /* This is xfs_extent_state() in-line */
133 if (ext_flag) { 118 if (ext_flag) {
@@ -163,21 +148,8 @@ xfs_fsblock_t
163xfs_bmbt_get_startblock( 148xfs_bmbt_get_startblock(
164 xfs_bmbt_rec_host_t *r) 149 xfs_bmbt_rec_host_t *r)
165{ 150{
166#if XFS_BIG_BLKNOS
167 return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) | 151 return (((xfs_fsblock_t)r->l0 & xfs_mask64lo(9)) << 43) |
168 (((xfs_fsblock_t)r->l1) >> 21); 152 (((xfs_fsblock_t)r->l1) >> 21);
169#else
170#ifdef DEBUG
171 xfs_dfsbno_t b;
172
173 b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
174 (((xfs_dfsbno_t)r->l1) >> 21);
175 ASSERT((b >> 32) == 0 || isnulldstartblock(b));
176 return (xfs_fsblock_t)b;
177#else /* !DEBUG */
178 return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
179#endif /* DEBUG */
180#endif /* XFS_BIG_BLKNOS */
181} 153}
182 154
183/* 155/*
@@ -241,7 +213,6 @@ xfs_bmbt_set_allf(
241 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0); 213 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
242 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 214 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
243 215
244#if XFS_BIG_BLKNOS
245 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0); 216 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
246 217
247 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 218 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
@@ -250,23 +221,6 @@ xfs_bmbt_set_allf(
250 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) | 221 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
251 ((xfs_bmbt_rec_base_t)blockcount & 222 ((xfs_bmbt_rec_base_t)blockcount &
252 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)); 223 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
253#else /* !XFS_BIG_BLKNOS */
254 if (isnullstartblock(startblock)) {
255 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
256 ((xfs_bmbt_rec_base_t)startoff << 9) |
257 (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
258 r->l1 = xfs_mask64hi(11) |
259 ((xfs_bmbt_rec_base_t)startblock << 21) |
260 ((xfs_bmbt_rec_base_t)blockcount &
261 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
262 } else {
263 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
264 ((xfs_bmbt_rec_base_t)startoff << 9);
265 r->l1 = ((xfs_bmbt_rec_base_t)startblock << 21) |
266 ((xfs_bmbt_rec_base_t)blockcount &
267 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
268 }
269#endif /* XFS_BIG_BLKNOS */
270} 224}
271 225
272/* 226/*
@@ -298,8 +252,6 @@ xfs_bmbt_disk_set_allf(
298 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN); 252 ASSERT(state == XFS_EXT_NORM || state == XFS_EXT_UNWRITTEN);
299 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0); 253 ASSERT((startoff & xfs_mask64hi(64-BMBT_STARTOFF_BITLEN)) == 0);
300 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0); 254 ASSERT((blockcount & xfs_mask64hi(64-BMBT_BLOCKCOUNT_BITLEN)) == 0);
301
302#if XFS_BIG_BLKNOS
303 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0); 255 ASSERT((startblock & xfs_mask64hi(64-BMBT_STARTBLOCK_BITLEN)) == 0);
304 256
305 r->l0 = cpu_to_be64( 257 r->l0 = cpu_to_be64(
@@ -310,26 +262,6 @@ xfs_bmbt_disk_set_allf(
310 ((xfs_bmbt_rec_base_t)startblock << 21) | 262 ((xfs_bmbt_rec_base_t)startblock << 21) |
311 ((xfs_bmbt_rec_base_t)blockcount & 263 ((xfs_bmbt_rec_base_t)blockcount &
312 (xfs_bmbt_rec_base_t)xfs_mask64lo(21))); 264 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
313#else /* !XFS_BIG_BLKNOS */
314 if (isnullstartblock(startblock)) {
315 r->l0 = cpu_to_be64(
316 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
317 ((xfs_bmbt_rec_base_t)startoff << 9) |
318 (xfs_bmbt_rec_base_t)xfs_mask64lo(9));
319 r->l1 = cpu_to_be64(xfs_mask64hi(11) |
320 ((xfs_bmbt_rec_base_t)startblock << 21) |
321 ((xfs_bmbt_rec_base_t)blockcount &
322 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
323 } else {
324 r->l0 = cpu_to_be64(
325 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
326 ((xfs_bmbt_rec_base_t)startoff << 9));
327 r->l1 = cpu_to_be64(
328 ((xfs_bmbt_rec_base_t)startblock << 21) |
329 ((xfs_bmbt_rec_base_t)blockcount &
330 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
331 }
332#endif /* XFS_BIG_BLKNOS */
333} 265}
334 266
335/* 267/*
@@ -365,24 +297,11 @@ xfs_bmbt_set_startblock(
365 xfs_bmbt_rec_host_t *r, 297 xfs_bmbt_rec_host_t *r,
366 xfs_fsblock_t v) 298 xfs_fsblock_t v)
367{ 299{
368#if XFS_BIG_BLKNOS
369 ASSERT((v & xfs_mask64hi(12)) == 0); 300 ASSERT((v & xfs_mask64hi(12)) == 0);
370 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) | 301 r->l0 = (r->l0 & (xfs_bmbt_rec_base_t)xfs_mask64hi(55)) |
371 (xfs_bmbt_rec_base_t)(v >> 43); 302 (xfs_bmbt_rec_base_t)(v >> 43);
372 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) | 303 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
373 (xfs_bmbt_rec_base_t)(v << 21); 304 (xfs_bmbt_rec_base_t)(v << 21);
374#else /* !XFS_BIG_BLKNOS */
375 if (isnullstartblock(v)) {
376 r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
377 r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
378 ((xfs_bmbt_rec_base_t)v << 21) |
379 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
380 } else {
381 r->l0 &= ~(xfs_bmbt_rec_base_t)xfs_mask64lo(9);
382 r->l1 = ((xfs_bmbt_rec_base_t)v << 21) |
383 (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
384 }
385#endif /* XFS_BIG_BLKNOS */
386} 305}
387 306
388/* 307/*
@@ -438,8 +357,8 @@ xfs_bmbt_to_bmdr(
438 cpu_to_be64(XFS_BUF_DADDR_NULL)); 357 cpu_to_be64(XFS_BUF_DADDR_NULL));
439 } else 358 } else
440 ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_MAGIC)); 359 ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_MAGIC));
441 ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO)); 360 ASSERT(rblock->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK));
442 ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO)); 361 ASSERT(rblock->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK));
443 ASSERT(rblock->bb_level != 0); 362 ASSERT(rblock->bb_level != 0);
444 dblock->bb_level = rblock->bb_level; 363 dblock->bb_level = rblock->bb_level;
445 dblock->bb_numrecs = rblock->bb_numrecs; 364 dblock->bb_numrecs = rblock->bb_numrecs;
@@ -763,11 +682,11 @@ xfs_bmbt_verify(
763 682
764 /* sibling pointer verification */ 683 /* sibling pointer verification */
765 if (!block->bb_u.l.bb_leftsib || 684 if (!block->bb_u.l.bb_leftsib ||
766 (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLDFSBNO) && 685 (block->bb_u.l.bb_leftsib != cpu_to_be64(NULLFSBLOCK) &&
767 !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_leftsib)))) 686 !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_leftsib))))
768 return false; 687 return false;
769 if (!block->bb_u.l.bb_rightsib || 688 if (!block->bb_u.l.bb_rightsib ||
770 (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLDFSBNO) && 689 (block->bb_u.l.bb_rightsib != cpu_to_be64(NULLFSBLOCK) &&
771 !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_rightsib)))) 690 !XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_u.l.bb_rightsib))))
772 return false; 691 return false;
773 692
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index ba35c9ccb8f9..8fe6a93ff473 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -78,11 +78,11 @@ xfs_btree_check_lblock(
78 be16_to_cpu(block->bb_numrecs) <= 78 be16_to_cpu(block->bb_numrecs) <=
79 cur->bc_ops->get_maxrecs(cur, level) && 79 cur->bc_ops->get_maxrecs(cur, level) &&
80 block->bb_u.l.bb_leftsib && 80 block->bb_u.l.bb_leftsib &&
81 (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO) || 81 (block->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK) ||
82 XFS_FSB_SANITY_CHECK(mp, 82 XFS_FSB_SANITY_CHECK(mp,
83 be64_to_cpu(block->bb_u.l.bb_leftsib))) && 83 be64_to_cpu(block->bb_u.l.bb_leftsib))) &&
84 block->bb_u.l.bb_rightsib && 84 block->bb_u.l.bb_rightsib &&
85 (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO) || 85 (block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK) ||
86 XFS_FSB_SANITY_CHECK(mp, 86 XFS_FSB_SANITY_CHECK(mp,
87 be64_to_cpu(block->bb_u.l.bb_rightsib))); 87 be64_to_cpu(block->bb_u.l.bb_rightsib)));
88 88
@@ -167,12 +167,12 @@ xfs_btree_check_block(
167int /* error (0 or EFSCORRUPTED) */ 167int /* error (0 or EFSCORRUPTED) */
168xfs_btree_check_lptr( 168xfs_btree_check_lptr(
169 struct xfs_btree_cur *cur, /* btree cursor */ 169 struct xfs_btree_cur *cur, /* btree cursor */
170 xfs_dfsbno_t bno, /* btree block disk address */ 170 xfs_fsblock_t bno, /* btree block disk address */
171 int level) /* btree block level */ 171 int level) /* btree block level */
172{ 172{
173 XFS_WANT_CORRUPTED_RETURN( 173 XFS_WANT_CORRUPTED_RETURN(
174 level > 0 && 174 level > 0 &&
175 bno != NULLDFSBNO && 175 bno != NULLFSBLOCK &&
176 XFS_FSB_SANITY_CHECK(cur->bc_mp, bno)); 176 XFS_FSB_SANITY_CHECK(cur->bc_mp, bno));
177 return 0; 177 return 0;
178} 178}
@@ -595,7 +595,7 @@ xfs_btree_islastblock(
595 block = xfs_btree_get_block(cur, level, &bp); 595 block = xfs_btree_get_block(cur, level, &bp);
596 xfs_btree_check_block(cur, block, level, bp); 596 xfs_btree_check_block(cur, block, level, bp);
597 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) 597 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
598 return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO); 598 return block->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK);
599 else 599 else
600 return block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK); 600 return block->bb_u.s.bb_rightsib == cpu_to_be32(NULLAGBLOCK);
601} 601}
@@ -771,16 +771,16 @@ xfs_btree_readahead_lblock(
771 struct xfs_btree_block *block) 771 struct xfs_btree_block *block)
772{ 772{
773 int rval = 0; 773 int rval = 0;
774 xfs_dfsbno_t left = be64_to_cpu(block->bb_u.l.bb_leftsib); 774 xfs_fsblock_t left = be64_to_cpu(block->bb_u.l.bb_leftsib);
775 xfs_dfsbno_t right = be64_to_cpu(block->bb_u.l.bb_rightsib); 775 xfs_fsblock_t right = be64_to_cpu(block->bb_u.l.bb_rightsib);
776 776
777 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLDFSBNO) { 777 if ((lr & XFS_BTCUR_LEFTRA) && left != NULLFSBLOCK) {
778 xfs_btree_reada_bufl(cur->bc_mp, left, 1, 778 xfs_btree_reada_bufl(cur->bc_mp, left, 1,
779 cur->bc_ops->buf_ops); 779 cur->bc_ops->buf_ops);
780 rval++; 780 rval++;
781 } 781 }
782 782
783 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLDFSBNO) { 783 if ((lr & XFS_BTCUR_RIGHTRA) && right != NULLFSBLOCK) {
784 xfs_btree_reada_bufl(cur->bc_mp, right, 1, 784 xfs_btree_reada_bufl(cur->bc_mp, right, 1,
785 cur->bc_ops->buf_ops); 785 cur->bc_ops->buf_ops);
786 rval++; 786 rval++;
@@ -852,7 +852,7 @@ xfs_btree_ptr_to_daddr(
852 union xfs_btree_ptr *ptr) 852 union xfs_btree_ptr *ptr)
853{ 853{
854 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 854 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
855 ASSERT(ptr->l != cpu_to_be64(NULLDFSBNO)); 855 ASSERT(ptr->l != cpu_to_be64(NULLFSBLOCK));
856 856
857 return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); 857 return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
858 } else { 858 } else {
@@ -900,9 +900,9 @@ xfs_btree_setbuf(
900 900
901 b = XFS_BUF_TO_BLOCK(bp); 901 b = XFS_BUF_TO_BLOCK(bp);
902 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 902 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
903 if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLDFSBNO)) 903 if (b->bb_u.l.bb_leftsib == cpu_to_be64(NULLFSBLOCK))
904 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA; 904 cur->bc_ra[lev] |= XFS_BTCUR_LEFTRA;
905 if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLDFSBNO)) 905 if (b->bb_u.l.bb_rightsib == cpu_to_be64(NULLFSBLOCK))
906 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA; 906 cur->bc_ra[lev] |= XFS_BTCUR_RIGHTRA;
907 } else { 907 } else {
908 if (b->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK)) 908 if (b->bb_u.s.bb_leftsib == cpu_to_be32(NULLAGBLOCK))
@@ -918,7 +918,7 @@ xfs_btree_ptr_is_null(
918 union xfs_btree_ptr *ptr) 918 union xfs_btree_ptr *ptr)
919{ 919{
920 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) 920 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
921 return ptr->l == cpu_to_be64(NULLDFSBNO); 921 return ptr->l == cpu_to_be64(NULLFSBLOCK);
922 else 922 else
923 return ptr->s == cpu_to_be32(NULLAGBLOCK); 923 return ptr->s == cpu_to_be32(NULLAGBLOCK);
924} 924}
@@ -929,7 +929,7 @@ xfs_btree_set_ptr_null(
929 union xfs_btree_ptr *ptr) 929 union xfs_btree_ptr *ptr)
930{ 930{
931 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) 931 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
932 ptr->l = cpu_to_be64(NULLDFSBNO); 932 ptr->l = cpu_to_be64(NULLFSBLOCK);
933 else 933 else
934 ptr->s = cpu_to_be32(NULLAGBLOCK); 934 ptr->s = cpu_to_be32(NULLAGBLOCK);
935} 935}
@@ -997,8 +997,8 @@ xfs_btree_init_block_int(
997 buf->bb_numrecs = cpu_to_be16(numrecs); 997 buf->bb_numrecs = cpu_to_be16(numrecs);
998 998
999 if (flags & XFS_BTREE_LONG_PTRS) { 999 if (flags & XFS_BTREE_LONG_PTRS) {
1000 buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO); 1000 buf->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK);
1001 buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO); 1001 buf->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK);
1002 if (flags & XFS_BTREE_CRC_BLOCKS) { 1002 if (flags & XFS_BTREE_CRC_BLOCKS) {
1003 buf->bb_u.l.bb_blkno = cpu_to_be64(blkno); 1003 buf->bb_u.l.bb_blkno = cpu_to_be64(blkno);
1004 buf->bb_u.l.bb_owner = cpu_to_be64(owner); 1004 buf->bb_u.l.bb_owner = cpu_to_be64(owner);
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index a04b69422f67..8f18bab73ea5 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -258,7 +258,7 @@ xfs_btree_check_block(
258int /* error (0 or EFSCORRUPTED) */ 258int /* error (0 or EFSCORRUPTED) */
259xfs_btree_check_lptr( 259xfs_btree_check_lptr(
260 struct xfs_btree_cur *cur, /* btree cursor */ 260 struct xfs_btree_cur *cur, /* btree cursor */
261 xfs_dfsbno_t ptr, /* btree block disk address */ 261 xfs_fsblock_t ptr, /* btree block disk address */
262 int level); /* btree block level */ 262 int level); /* btree block level */
263 263
264/* 264/*
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 8d809873525b..2c42ae28d027 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2004,7 +2004,7 @@ xfs_da_grow_inode_int(
2004 struct xfs_trans *tp = args->trans; 2004 struct xfs_trans *tp = args->trans;
2005 struct xfs_inode *dp = args->dp; 2005 struct xfs_inode *dp = args->dp;
2006 int w = args->whichfork; 2006 int w = args->whichfork;
2007 xfs_drfsbno_t nblks = dp->i_d.di_nblocks; 2007 xfs_rfsblock_t nblks = dp->i_d.di_nblocks;
2008 struct xfs_bmbt_irec map, *mapp; 2008 struct xfs_bmbt_irec map, *mapp;
2009 int nmap, error, got, i, mapi; 2009 int nmap, error, got, i, mapi;
2010 2010
diff --git a/fs/xfs/libxfs/xfs_dir2_sf.c b/fs/xfs/libxfs/xfs_dir2_sf.c
index 8f4f26af35e1..5079e051ef08 100644
--- a/fs/xfs/libxfs/xfs_dir2_sf.c
+++ b/fs/xfs/libxfs/xfs_dir2_sf.c
@@ -51,10 +51,9 @@ static void xfs_dir2_sf_check(xfs_da_args_t *args);
51#else 51#else
52#define xfs_dir2_sf_check(args) 52#define xfs_dir2_sf_check(args)
53#endif /* DEBUG */ 53#endif /* DEBUG */
54#if XFS_BIG_INUMS 54
55static void xfs_dir2_sf_toino4(xfs_da_args_t *args); 55static void xfs_dir2_sf_toino4(xfs_da_args_t *args);
56static void xfs_dir2_sf_toino8(xfs_da_args_t *args); 56static void xfs_dir2_sf_toino8(xfs_da_args_t *args);
57#endif /* XFS_BIG_INUMS */
58 57
59/* 58/*
60 * Given a block directory (dp/block), calculate its size as a shortform (sf) 59 * Given a block directory (dp/block), calculate its size as a shortform (sf)
@@ -117,10 +116,10 @@ xfs_dir2_block_sfsize(
117 isdotdot = 116 isdotdot =
118 dep->namelen == 2 && 117 dep->namelen == 2 &&
119 dep->name[0] == '.' && dep->name[1] == '.'; 118 dep->name[0] == '.' && dep->name[1] == '.';
120#if XFS_BIG_INUMS 119
121 if (!isdot) 120 if (!isdot)
122 i8count += be64_to_cpu(dep->inumber) > XFS_DIR2_MAX_SHORT_INUM; 121 i8count += be64_to_cpu(dep->inumber) > XFS_DIR2_MAX_SHORT_INUM;
123#endif 122
124 /* take into account the file type field */ 123 /* take into account the file type field */
125 if (!isdot && !isdotdot) { 124 if (!isdot && !isdotdot) {
126 count++; 125 count++;
@@ -318,7 +317,7 @@ xfs_dir2_sf_addname(
318 */ 317 */
319 incr_isize = dp->d_ops->sf_entsize(sfp, args->namelen); 318 incr_isize = dp->d_ops->sf_entsize(sfp, args->namelen);
320 objchange = 0; 319 objchange = 0;
321#if XFS_BIG_INUMS 320
322 /* 321 /*
323 * Do we have to change to 8 byte inodes? 322 * Do we have to change to 8 byte inodes?
324 */ 323 */
@@ -332,7 +331,7 @@ xfs_dir2_sf_addname(
332 (uint)sizeof(xfs_dir2_ino4_t)); 331 (uint)sizeof(xfs_dir2_ino4_t));
333 objchange = 1; 332 objchange = 1;
334 } 333 }
335#endif 334
336 new_isize = (int)dp->i_d.di_size + incr_isize; 335 new_isize = (int)dp->i_d.di_size + incr_isize;
337 /* 336 /*
338 * Won't fit as shortform any more (due to size), 337 * Won't fit as shortform any more (due to size),
@@ -370,10 +369,8 @@ xfs_dir2_sf_addname(
370 */ 369 */
371 else { 370 else {
372 ASSERT(pick == 2); 371 ASSERT(pick == 2);
373#if XFS_BIG_INUMS
374 if (objchange) 372 if (objchange)
375 xfs_dir2_sf_toino8(args); 373 xfs_dir2_sf_toino8(args);
376#endif
377 xfs_dir2_sf_addname_hard(args, objchange, new_isize); 374 xfs_dir2_sf_addname_hard(args, objchange, new_isize);
378 } 375 }
379 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); 376 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
@@ -425,10 +422,8 @@ xfs_dir2_sf_addname_easy(
425 * Update the header and inode. 422 * Update the header and inode.
426 */ 423 */
427 sfp->count++; 424 sfp->count++;
428#if XFS_BIG_INUMS
429 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM) 425 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM)
430 sfp->i8count++; 426 sfp->i8count++;
431#endif
432 dp->i_d.di_size = new_isize; 427 dp->i_d.di_size = new_isize;
433 xfs_dir2_sf_check(args); 428 xfs_dir2_sf_check(args);
434} 429}
@@ -516,10 +511,8 @@ xfs_dir2_sf_addname_hard(
516 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber); 511 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
517 dp->d_ops->sf_put_ftype(sfep, args->filetype); 512 dp->d_ops->sf_put_ftype(sfep, args->filetype);
518 sfp->count++; 513 sfp->count++;
519#if XFS_BIG_INUMS
520 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange) 514 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
521 sfp->i8count++; 515 sfp->i8count++;
522#endif
523 /* 516 /*
524 * If there's more left to copy, do that. 517 * If there's more left to copy, do that.
525 */ 518 */
@@ -593,13 +586,8 @@ xfs_dir2_sf_addname_pick(
593 /* 586 /*
594 * If changing the inode number size, do it the hard way. 587 * If changing the inode number size, do it the hard way.
595 */ 588 */
596#if XFS_BIG_INUMS 589 if (objchange)
597 if (objchange) {
598 return 2; 590 return 2;
599 }
600#else
601 ASSERT(objchange == 0);
602#endif
603 /* 591 /*
604 * If it won't fit at the end then do it the hard way (use the hole). 592 * If it won't fit at the end then do it the hard way (use the hole).
605 */ 593 */
@@ -650,7 +638,6 @@ xfs_dir2_sf_check(
650 ASSERT(dp->d_ops->sf_get_ftype(sfep) < XFS_DIR3_FT_MAX); 638 ASSERT(dp->d_ops->sf_get_ftype(sfep) < XFS_DIR3_FT_MAX);
651 } 639 }
652 ASSERT(i8count == sfp->i8count); 640 ASSERT(i8count == sfp->i8count);
653 ASSERT(XFS_BIG_INUMS || i8count == 0);
654 ASSERT((char *)sfep - (char *)sfp == dp->i_d.di_size); 641 ASSERT((char *)sfep - (char *)sfp == dp->i_d.di_size);
655 ASSERT(offset + 642 ASSERT(offset +
656 (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) + 643 (sfp->count + 2) * (uint)sizeof(xfs_dir2_leaf_entry_t) +
@@ -870,7 +857,6 @@ xfs_dir2_sf_removename(
870 */ 857 */
871 xfs_idata_realloc(dp, newsize - oldsize, XFS_DATA_FORK); 858 xfs_idata_realloc(dp, newsize - oldsize, XFS_DATA_FORK);
872 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; 859 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
873#if XFS_BIG_INUMS
874 /* 860 /*
875 * Are we changing inode number size? 861 * Are we changing inode number size?
876 */ 862 */
@@ -880,7 +866,6 @@ xfs_dir2_sf_removename(
880 else 866 else
881 sfp->i8count--; 867 sfp->i8count--;
882 } 868 }
883#endif
884 xfs_dir2_sf_check(args); 869 xfs_dir2_sf_check(args);
885 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); 870 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
886 return 0; 871 return 0;
@@ -895,12 +880,8 @@ xfs_dir2_sf_replace(
895{ 880{
896 xfs_inode_t *dp; /* incore directory inode */ 881 xfs_inode_t *dp; /* incore directory inode */
897 int i; /* entry index */ 882 int i; /* entry index */
898#if XFS_BIG_INUMS || defined(DEBUG)
899 xfs_ino_t ino=0; /* entry old inode number */ 883 xfs_ino_t ino=0; /* entry old inode number */
900#endif
901#if XFS_BIG_INUMS
902 int i8elevated; /* sf_toino8 set i8count=1 */ 884 int i8elevated; /* sf_toino8 set i8count=1 */
903#endif
904 xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */ 885 xfs_dir2_sf_entry_t *sfep; /* shortform directory entry */
905 xfs_dir2_sf_hdr_t *sfp; /* shortform structure */ 886 xfs_dir2_sf_hdr_t *sfp; /* shortform structure */
906 887
@@ -920,7 +901,7 @@ xfs_dir2_sf_replace(
920 ASSERT(dp->i_df.if_u1.if_data != NULL); 901 ASSERT(dp->i_df.if_u1.if_data != NULL);
921 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; 902 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
922 ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->i8count)); 903 ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->i8count));
923#if XFS_BIG_INUMS 904
924 /* 905 /*
925 * New inode number is large, and need to convert to 8-byte inodes. 906 * New inode number is large, and need to convert to 8-byte inodes.
926 */ 907 */
@@ -951,17 +932,15 @@ xfs_dir2_sf_replace(
951 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; 932 sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data;
952 } else 933 } else
953 i8elevated = 0; 934 i8elevated = 0;
954#endif 935
955 ASSERT(args->namelen != 1 || args->name[0] != '.'); 936 ASSERT(args->namelen != 1 || args->name[0] != '.');
956 /* 937 /*
957 * Replace ..'s entry. 938 * Replace ..'s entry.
958 */ 939 */
959 if (args->namelen == 2 && 940 if (args->namelen == 2 &&
960 args->name[0] == '.' && args->name[1] == '.') { 941 args->name[0] == '.' && args->name[1] == '.') {
961#if XFS_BIG_INUMS || defined(DEBUG)
962 ino = dp->d_ops->sf_get_parent_ino(sfp); 942 ino = dp->d_ops->sf_get_parent_ino(sfp);
963 ASSERT(args->inumber != ino); 943 ASSERT(args->inumber != ino);
964#endif
965 dp->d_ops->sf_put_parent_ino(sfp, args->inumber); 944 dp->d_ops->sf_put_parent_ino(sfp, args->inumber);
966 } 945 }
967 /* 946 /*
@@ -972,10 +951,8 @@ xfs_dir2_sf_replace(
972 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) { 951 i++, sfep = dp->d_ops->sf_nextentry(sfp, sfep)) {
973 if (xfs_da_compname(args, sfep->name, sfep->namelen) == 952 if (xfs_da_compname(args, sfep->name, sfep->namelen) ==
974 XFS_CMP_EXACT) { 953 XFS_CMP_EXACT) {
975#if XFS_BIG_INUMS || defined(DEBUG)
976 ino = dp->d_ops->sf_get_ino(sfp, sfep); 954 ino = dp->d_ops->sf_get_ino(sfp, sfep);
977 ASSERT(args->inumber != ino); 955 ASSERT(args->inumber != ino);
978#endif
979 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber); 956 dp->d_ops->sf_put_ino(sfp, sfep, args->inumber);
980 dp->d_ops->sf_put_ftype(sfep, args->filetype); 957 dp->d_ops->sf_put_ftype(sfep, args->filetype);
981 break; 958 break;
@@ -986,14 +963,11 @@ xfs_dir2_sf_replace(
986 */ 963 */
987 if (i == sfp->count) { 964 if (i == sfp->count) {
988 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT); 965 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
989#if XFS_BIG_INUMS
990 if (i8elevated) 966 if (i8elevated)
991 xfs_dir2_sf_toino4(args); 967 xfs_dir2_sf_toino4(args);
992#endif
993 return -ENOENT; 968 return -ENOENT;
994 } 969 }
995 } 970 }
996#if XFS_BIG_INUMS
997 /* 971 /*
998 * See if the old number was large, the new number is small. 972 * See if the old number was large, the new number is small.
999 */ 973 */
@@ -1020,13 +994,11 @@ xfs_dir2_sf_replace(
1020 if (!i8elevated) 994 if (!i8elevated)
1021 sfp->i8count++; 995 sfp->i8count++;
1022 } 996 }
1023#endif
1024 xfs_dir2_sf_check(args); 997 xfs_dir2_sf_check(args);
1025 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA); 998 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_DDATA);
1026 return 0; 999 return 0;
1027} 1000}
1028 1001
1029#if XFS_BIG_INUMS
1030/* 1002/*
1031 * Convert from 8-byte inode numbers to 4-byte inode numbers. 1003 * Convert from 8-byte inode numbers to 4-byte inode numbers.
1032 * The last 8-byte inode number is gone, but the count is still 1. 1004 * The last 8-byte inode number is gone, but the count is still 1.
@@ -1181,4 +1153,3 @@ xfs_dir2_sf_toino8(
1181 dp->i_d.di_size = newsize; 1153 dp->i_d.di_size = newsize;
1182 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA); 1154 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_DDATA);
1183} 1155}
1184#endif /* XFS_BIG_INUMS */
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
index 34d85aca3058..7e42bba9a420 100644
--- a/fs/xfs/libxfs/xfs_format.h
+++ b/fs/xfs/libxfs/xfs_format.h
@@ -68,11 +68,7 @@ struct xfs_ifork;
68#define XFS_RTLOBIT(w) xfs_lowbit32(w) 68#define XFS_RTLOBIT(w) xfs_lowbit32(w)
69#define XFS_RTHIBIT(w) xfs_highbit32(w) 69#define XFS_RTHIBIT(w) xfs_highbit32(w)
70 70
71#if XFS_BIG_BLKNOS
72#define XFS_RTBLOCKLOG(b) xfs_highbit64(b) 71#define XFS_RTBLOCKLOG(b) xfs_highbit64(b)
73#else
74#define XFS_RTBLOCKLOG(b) xfs_highbit32(b)
75#endif
76 72
77/* 73/*
78 * Dquot and dquot block format definitions 74 * Dquot and dquot block format definitions
@@ -304,23 +300,15 @@ typedef struct xfs_bmbt_rec_host {
304 * Values and macros for delayed-allocation startblock fields. 300 * Values and macros for delayed-allocation startblock fields.
305 */ 301 */
306#define STARTBLOCKVALBITS 17 302#define STARTBLOCKVALBITS 17
307#define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20) 303#define STARTBLOCKMASKBITS (15 + 20)
308#define DSTARTBLOCKMASKBITS (15 + 20)
309#define STARTBLOCKMASK \ 304#define STARTBLOCKMASK \
310 (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) 305 (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
311#define DSTARTBLOCKMASK \
312 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
313 306
314static inline int isnullstartblock(xfs_fsblock_t x) 307static inline int isnullstartblock(xfs_fsblock_t x)
315{ 308{
316 return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; 309 return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
317} 310}
318 311
319static inline int isnulldstartblock(xfs_dfsbno_t x)
320{
321 return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
322}
323
324static inline xfs_fsblock_t nullstartblock(int k) 312static inline xfs_fsblock_t nullstartblock(int k)
325{ 313{
326 ASSERT(k < (1 << STARTBLOCKVALBITS)); 314 ASSERT(k < (1 << STARTBLOCKVALBITS));
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 8ac9411bcf2a..6a00f7fed69d 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -528,7 +528,7 @@ xfs_iroot_realloc(
528 ifp->if_broot_bytes = (int)new_size; 528 ifp->if_broot_bytes = (int)new_size;
529 ASSERT(XFS_BMAP_BMDR_SPACE(ifp->if_broot) <= 529 ASSERT(XFS_BMAP_BMDR_SPACE(ifp->if_broot) <=
530 XFS_IFORK_SIZE(ip, whichfork)); 530 XFS_IFORK_SIZE(ip, whichfork));
531 memmove(np, op, cur_max * (uint)sizeof(xfs_dfsbno_t)); 531 memmove(np, op, cur_max * (uint)sizeof(xfs_fsblock_t));
532 return; 532 return;
533 } 533 }
534 534
@@ -575,7 +575,7 @@ xfs_iroot_realloc(
575 ifp->if_broot_bytes); 575 ifp->if_broot_bytes);
576 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, new_broot, 1, 576 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, new_broot, 1,
577 (int)new_size); 577 (int)new_size);
578 memcpy(np, op, new_max * (uint)sizeof(xfs_dfsbno_t)); 578 memcpy(np, op, new_max * (uint)sizeof(xfs_fsblock_t));
579 } 579 }
580 kmem_free(ifp->if_broot); 580 kmem_free(ifp->if_broot);
581 ifp->if_broot = new_broot; 581 ifp->if_broot = new_broot;
diff --git a/fs/xfs/libxfs/xfs_inum.h b/fs/xfs/libxfs/xfs_inum.h
index 90efdaf1706f..4ff2278e147a 100644
--- a/fs/xfs/libxfs/xfs_inum.h
+++ b/fs/xfs/libxfs/xfs_inum.h
@@ -54,11 +54,7 @@ struct xfs_mount;
54#define XFS_OFFBNO_TO_AGINO(mp,b,o) \ 54#define XFS_OFFBNO_TO_AGINO(mp,b,o) \
55 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o))) 55 ((xfs_agino_t)(((b) << XFS_INO_OFFSET_BITS(mp)) | (o)))
56 56
57#if XFS_BIG_INUMS
58#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) 57#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL))
59#else
60#define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))
61#endif
62#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL)) 58#define XFS_MAXINUMBER_32 ((xfs_ino_t)((1ULL << 32) - 1ULL))
63 59
64#endif /* __XFS_INUM_H__ */ 60#endif /* __XFS_INUM_H__ */
diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
index f0969c77bdbe..aff12f2d4428 100644
--- a/fs/xfs/libxfs/xfs_log_format.h
+++ b/fs/xfs/libxfs/xfs_log_format.h
@@ -380,7 +380,7 @@ typedef struct xfs_icdinode {
380 xfs_ictimestamp_t di_mtime; /* time last modified */ 380 xfs_ictimestamp_t di_mtime; /* time last modified */
381 xfs_ictimestamp_t di_ctime; /* time created/inode modified */ 381 xfs_ictimestamp_t di_ctime; /* time created/inode modified */
382 xfs_fsize_t di_size; /* number of bytes in file */ 382 xfs_fsize_t di_size; /* number of bytes in file */
383 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ 383 xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
384 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ 384 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
385 xfs_extnum_t di_nextents; /* number of extents in data fork */ 385 xfs_extnum_t di_nextents; /* number of extents in data fork */
386 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ 386 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
@@ -516,7 +516,7 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)
516 * EFI/EFD log format definitions 516 * EFI/EFD log format definitions
517 */ 517 */
518typedef struct xfs_extent { 518typedef struct xfs_extent {
519 xfs_dfsbno_t ext_start; 519 xfs_fsblock_t ext_start;
520 xfs_extlen_t ext_len; 520 xfs_extlen_t ext_len;
521} xfs_extent_t; 521} xfs_extent_t;
522 522
diff --git a/fs/xfs/libxfs/xfs_quota_defs.h b/fs/xfs/libxfs/xfs_quota_defs.h
index 137e20937077..1b0a08379759 100644
--- a/fs/xfs/libxfs/xfs_quota_defs.h
+++ b/fs/xfs/libxfs/xfs_quota_defs.h
@@ -98,8 +98,6 @@ typedef __uint16_t xfs_qwarncnt_t;
98#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ 98#define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
99 XFS_GQUOTA_ACTIVE | \ 99 XFS_GQUOTA_ACTIVE | \
100 XFS_PQUOTA_ACTIVE)) 100 XFS_PQUOTA_ACTIVE))
101#define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \
102 XFS_PQUOTA_ACTIVE))
103#define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) 101#define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
104#define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) 102#define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
105#define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) 103#define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
diff --git a/fs/xfs/libxfs/xfs_sb.h b/fs/xfs/libxfs/xfs_sb.h
index c43c2d609a24..2e739708afd3 100644
--- a/fs/xfs/libxfs/xfs_sb.h
+++ b/fs/xfs/libxfs/xfs_sb.h
@@ -87,11 +87,11 @@ struct xfs_trans;
87typedef struct xfs_sb { 87typedef struct xfs_sb {
88 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ 88 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
89 __uint32_t sb_blocksize; /* logical block size, bytes */ 89 __uint32_t sb_blocksize; /* logical block size, bytes */
90 xfs_drfsbno_t sb_dblocks; /* number of data blocks */ 90 xfs_rfsblock_t sb_dblocks; /* number of data blocks */
91 xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */ 91 xfs_rfsblock_t sb_rblocks; /* number of realtime blocks */
92 xfs_drtbno_t sb_rextents; /* number of realtime extents */ 92 xfs_rtblock_t sb_rextents; /* number of realtime extents */
93 uuid_t sb_uuid; /* file system unique id */ 93 uuid_t sb_uuid; /* file system unique id */
94 xfs_dfsbno_t sb_logstart; /* starting block of log if internal */ 94 xfs_fsblock_t sb_logstart; /* starting block of log if internal */
95 xfs_ino_t sb_rootino; /* root inode number */ 95 xfs_ino_t sb_rootino; /* root inode number */
96 xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */ 96 xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */
97 xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */ 97 xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 43a97442f28a..d32889af1777 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -425,7 +425,7 @@ xfs_bmap_count_blocks(
425 ASSERT(level > 0); 425 ASSERT(level > 0);
426 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes); 426 pp = XFS_BMAP_BROOT_PTR_ADDR(mp, block, 1, ifp->if_broot_bytes);
427 bno = be64_to_cpu(*pp); 427 bno = be64_to_cpu(*pp);
428 ASSERT(bno != NULLDFSBNO); 428 ASSERT(bno != NULLFSBLOCK);
429 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount); 429 ASSERT(XFS_FSB_TO_AGNO(mp, bno) < mp->m_sb.sb_agcount);
430 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks); 430 ASSERT(XFS_FSB_TO_AGBNO(mp, bno) < mp->m_sb.sb_agblocks);
431 431
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index ffdabc687852..18dc721ca19f 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -255,8 +255,8 @@ typedef struct xfs_fsop_resblks {
255 ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES) 255 ((2 * 1024 * 1024 * 1024ULL) - XFS_MIN_LOG_BYTES)
256 256
257/* Used for sanity checks on superblock */ 257/* Used for sanity checks on superblock */
258#define XFS_MAX_DBLOCKS(s) ((xfs_drfsbno_t)(s)->sb_agcount * (s)->sb_agblocks) 258#define XFS_MAX_DBLOCKS(s) ((xfs_rfsblock_t)(s)->sb_agcount * (s)->sb_agblocks)
259#define XFS_MIN_DBLOCKS(s) ((xfs_drfsbno_t)((s)->sb_agcount - 1) * \ 259#define XFS_MIN_DBLOCKS(s) ((xfs_rfsblock_t)((s)->sb_agcount - 1) * \
260 (s)->sb_agblocks + XFS_MIN_AG_BLOCKS) 260 (s)->sb_agblocks + XFS_MIN_AG_BLOCKS)
261 261
262/* 262/*
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 8312771c2b5b..d3ef6de475bb 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -21,18 +21,6 @@
21#include <linux/types.h> 21#include <linux/types.h>
22 22
23/* 23/*
24 * XFS_BIG_BLKNOS needs block layer disk addresses to be 64 bits.
25 * XFS_BIG_INUMS requires XFS_BIG_BLKNOS to be set.
26 */
27#if defined(CONFIG_LBDAF) || (BITS_PER_LONG == 64)
28# define XFS_BIG_BLKNOS 1
29# define XFS_BIG_INUMS 1
30#else
31# define XFS_BIG_BLKNOS 0
32# define XFS_BIG_INUMS 0
33#endif
34
35/*
36 * Kernel specific type declarations for XFS 24 * Kernel specific type declarations for XFS
37 */ 25 */
38typedef signed char __int8_t; 26typedef signed char __int8_t;
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 2ee4388dc682..f6b79e5325dd 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -78,8 +78,6 @@ xlog_cil_init_post_recovery(
78{ 78{
79 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log); 79 log->l_cilp->xc_ctx->ticket = xlog_cil_ticket_alloc(log);
80 log->l_cilp->xc_ctx->sequence = 1; 80 log->l_cilp->xc_ctx->sequence = 1;
81 log->l_cilp->xc_ctx->commit_lsn = xlog_assign_lsn(log->l_curr_cycle,
82 log->l_curr_block);
83} 81}
84 82
85/* 83/*
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 39d84d379bbd..5b639df0413e 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -176,13 +176,9 @@ xfs_sb_validate_fsb_count(
176 ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); 176 ASSERT(PAGE_SHIFT >= sbp->sb_blocklog);
177 ASSERT(sbp->sb_blocklog >= BBSHIFT); 177 ASSERT(sbp->sb_blocklog >= BBSHIFT);
178 178
179#if XFS_BIG_BLKNOS /* Limited by ULONG_MAX of page cache index */ 179 /* Limited by ULONG_MAX of page cache index */
180 if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) 180 if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX)
181 return -EFBIG; 181 return -EFBIG;
182#else /* Limited by UINT_MAX of sectors */
183 if (nblocks << (sbp->sb_blocklog - BBSHIFT) > UINT_MAX)
184 return -EFBIG;
185#endif
186 return 0; 182 return 0;
187} 183}
188 184
@@ -253,9 +249,9 @@ xfs_initialize_perag(
253 mp->m_flags &= ~XFS_MOUNT_32BITINODES; 249 mp->m_flags &= ~XFS_MOUNT_32BITINODES;
254 250
255 if (mp->m_flags & XFS_MOUNT_32BITINODES) 251 if (mp->m_flags & XFS_MOUNT_32BITINODES)
256 index = xfs_set_inode32(mp); 252 index = xfs_set_inode32(mp, agcount);
257 else 253 else
258 index = xfs_set_inode64(mp); 254 index = xfs_set_inode64(mp, agcount);
259 255
260 if (maxagi) 256 if (maxagi)
261 *maxagi = index; 257 *maxagi = index;
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index ba284f6469db..7e1a80b45f87 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -221,100 +221,6 @@ xfs_qm_unmount(
221 } 221 }
222} 222}
223 223
224
225/*
226 * This is called from xfs_mountfs to start quotas and initialize all
227 * necessary data structures like quotainfo. This is also responsible for
228 * running a quotacheck as necessary. We are guaranteed that the superblock
229 * is consistently read in at this point.
230 *
231 * If we fail here, the mount will continue with quota turned off. We don't
232 * need to inidicate success or failure at all.
233 */
234void
235xfs_qm_mount_quotas(
236 xfs_mount_t *mp)
237{
238 int error = 0;
239 uint sbf;
240
241 /*
242 * If quotas on realtime volumes is not supported, we disable
243 * quotas immediately.
244 */
245 if (mp->m_sb.sb_rextents) {
246 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
247 mp->m_qflags = 0;
248 goto write_changes;
249 }
250
251 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
252
253 /*
254 * Allocate the quotainfo structure inside the mount struct, and
255 * create quotainode(s), and change/rev superblock if necessary.
256 */
257 error = xfs_qm_init_quotainfo(mp);
258 if (error) {
259 /*
260 * We must turn off quotas.
261 */
262 ASSERT(mp->m_quotainfo == NULL);
263 mp->m_qflags = 0;
264 goto write_changes;
265 }
266 /*
267 * If any of the quotas are not consistent, do a quotacheck.
268 */
269 if (XFS_QM_NEED_QUOTACHECK(mp)) {
270 error = xfs_qm_quotacheck(mp);
271 if (error) {
272 /* Quotacheck failed and disabled quotas. */
273 return;
274 }
275 }
276 /*
277 * If one type of quotas is off, then it will lose its
278 * quotachecked status, since we won't be doing accounting for
279 * that type anymore.
280 */
281 if (!XFS_IS_UQUOTA_ON(mp))
282 mp->m_qflags &= ~XFS_UQUOTA_CHKD;
283 if (!XFS_IS_GQUOTA_ON(mp))
284 mp->m_qflags &= ~XFS_GQUOTA_CHKD;
285 if (!XFS_IS_PQUOTA_ON(mp))
286 mp->m_qflags &= ~XFS_PQUOTA_CHKD;
287
288 write_changes:
289 /*
290 * We actually don't have to acquire the m_sb_lock at all.
291 * This can only be called from mount, and that's single threaded. XXX
292 */
293 spin_lock(&mp->m_sb_lock);
294 sbf = mp->m_sb.sb_qflags;
295 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
296 spin_unlock(&mp->m_sb_lock);
297
298 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
299 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
300 /*
301 * We could only have been turning quotas off.
302 * We aren't in very good shape actually because
303 * the incore structures are convinced that quotas are
304 * off, but the on disk superblock doesn't know that !
305 */
306 ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
307 xfs_alert(mp, "%s: Superblock update failed!",
308 __func__);
309 }
310 }
311
312 if (error) {
313 xfs_warn(mp, "Failed to initialize disk quotas.");
314 return;
315 }
316}
317
318/* 224/*
319 * Called from the vfsops layer. 225 * Called from the vfsops layer.
320 */ 226 */
@@ -1330,7 +1236,7 @@ out_unlock:
1330 * Walk thru all the filesystem inodes and construct a consistent view 1236 * Walk thru all the filesystem inodes and construct a consistent view
1331 * of the disk quota world. If the quotacheck fails, disable quotas. 1237 * of the disk quota world. If the quotacheck fails, disable quotas.
1332 */ 1238 */
1333int 1239STATIC int
1334xfs_qm_quotacheck( 1240xfs_qm_quotacheck(
1335 xfs_mount_t *mp) 1241 xfs_mount_t *mp)
1336{ 1242{
@@ -1467,6 +1373,99 @@ xfs_qm_quotacheck(
1467} 1373}
1468 1374
1469/* 1375/*
1376 * This is called from xfs_mountfs to start quotas and initialize all
1377 * necessary data structures like quotainfo. This is also responsible for
1378 * running a quotacheck as necessary. We are guaranteed that the superblock
1379 * is consistently read in at this point.
1380 *
1381 * If we fail here, the mount will continue with quota turned off. We don't
1382 * need to inidicate success or failure at all.
1383 */
1384void
1385xfs_qm_mount_quotas(
1386 struct xfs_mount *mp)
1387{
1388 int error = 0;
1389 uint sbf;
1390
1391 /*
1392 * If quotas on realtime volumes is not supported, we disable
1393 * quotas immediately.
1394 */
1395 if (mp->m_sb.sb_rextents) {
1396 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
1397 mp->m_qflags = 0;
1398 goto write_changes;
1399 }
1400
1401 ASSERT(XFS_IS_QUOTA_RUNNING(mp));
1402
1403 /*
1404 * Allocate the quotainfo structure inside the mount struct, and
1405 * create quotainode(s), and change/rev superblock if necessary.
1406 */
1407 error = xfs_qm_init_quotainfo(mp);
1408 if (error) {
1409 /*
1410 * We must turn off quotas.
1411 */
1412 ASSERT(mp->m_quotainfo == NULL);
1413 mp->m_qflags = 0;
1414 goto write_changes;
1415 }
1416 /*
1417 * If any of the quotas are not consistent, do a quotacheck.
1418 */
1419 if (XFS_QM_NEED_QUOTACHECK(mp)) {
1420 error = xfs_qm_quotacheck(mp);
1421 if (error) {
1422 /* Quotacheck failed and disabled quotas. */
1423 return;
1424 }
1425 }
1426 /*
1427 * If one type of quotas is off, then it will lose its
1428 * quotachecked status, since we won't be doing accounting for
1429 * that type anymore.
1430 */
1431 if (!XFS_IS_UQUOTA_ON(mp))
1432 mp->m_qflags &= ~XFS_UQUOTA_CHKD;
1433 if (!XFS_IS_GQUOTA_ON(mp))
1434 mp->m_qflags &= ~XFS_GQUOTA_CHKD;
1435 if (!XFS_IS_PQUOTA_ON(mp))
1436 mp->m_qflags &= ~XFS_PQUOTA_CHKD;
1437
1438 write_changes:
1439 /*
1440 * We actually don't have to acquire the m_sb_lock at all.
1441 * This can only be called from mount, and that's single threaded. XXX
1442 */
1443 spin_lock(&mp->m_sb_lock);
1444 sbf = mp->m_sb.sb_qflags;
1445 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
1446 spin_unlock(&mp->m_sb_lock);
1447
1448 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
1449 if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
1450 /*
1451 * We could only have been turning quotas off.
1452 * We aren't in very good shape actually because
1453 * the incore structures are convinced that quotas are
1454 * off, but the on disk superblock doesn't know that !
1455 */
1456 ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
1457 xfs_alert(mp, "%s: Superblock update failed!",
1458 __func__);
1459 }
1460 }
1461
1462 if (error) {
1463 xfs_warn(mp, "Failed to initialize disk quotas.");
1464 return;
1465 }
1466}
1467
1468/*
1470 * This is called after the superblock has been read in and we're ready to 1469 * This is called after the superblock has been read in and we're ready to
1471 * iget the quota inodes. 1470 * iget the quota inodes.
1472 */ 1471 */
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 797fd4636273..3a07a937e232 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -157,7 +157,6 @@ struct xfs_dquot_acct {
157#define XFS_QM_RTBWARNLIMIT 5 157#define XFS_QM_RTBWARNLIMIT 5
158 158
159extern void xfs_qm_destroy_quotainfo(struct xfs_mount *); 159extern void xfs_qm_destroy_quotainfo(struct xfs_mount *);
160extern int xfs_qm_quotacheck(struct xfs_mount *);
161extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t); 160extern int xfs_qm_write_sb_changes(struct xfs_mount *, __int64_t);
162 161
163/* dquot stuff */ 162/* dquot stuff */
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 4f7aecbe61da..b238027df987 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -123,7 +123,7 @@ xfs_fs_rm_xquota(
123 flags |= XFS_DQ_USER; 123 flags |= XFS_DQ_USER;
124 if (uflags & FS_GROUP_QUOTA) 124 if (uflags & FS_GROUP_QUOTA)
125 flags |= XFS_DQ_GROUP; 125 flags |= XFS_DQ_GROUP;
126 if (uflags & FS_USER_QUOTA) 126 if (uflags & FS_PROJ_QUOTA)
127 flags |= XFS_DQ_PROJ; 127 flags |= XFS_DQ_PROJ;
128 128
129 return xfs_qm_scall_trunc_qfiles(mp, flags); 129 return xfs_qm_scall_trunc_qfiles(mp, flags);
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index b741d7286990..909e143b87ae 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -944,9 +944,9 @@ xfs_growfs_rt(
944 xfs_buf_t *bp; /* temporary buffer */ 944 xfs_buf_t *bp; /* temporary buffer */
945 int error; /* error return value */ 945 int error; /* error return value */
946 xfs_mount_t *nmp; /* new (fake) mount structure */ 946 xfs_mount_t *nmp; /* new (fake) mount structure */
947 xfs_drfsbno_t nrblocks; /* new number of realtime blocks */ 947 xfs_rfsblock_t nrblocks; /* new number of realtime blocks */
948 xfs_extlen_t nrbmblocks; /* new number of rt bitmap blocks */ 948 xfs_extlen_t nrbmblocks; /* new number of rt bitmap blocks */
949 xfs_drtbno_t nrextents; /* new number of realtime extents */ 949 xfs_rtblock_t nrextents; /* new number of realtime extents */
950 uint8_t nrextslog; /* new log2 of sb_rextents */ 950 uint8_t nrextslog; /* new log2 of sb_rextents */
951 xfs_extlen_t nrsumblocks; /* new number of summary blocks */ 951 xfs_extlen_t nrsumblocks; /* new number of summary blocks */
952 uint nrsumlevels; /* new rt summary levels */ 952 uint nrsumlevels; /* new rt summary levels */
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 986c5577c4e9..b194652033cd 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -205,9 +205,6 @@ xfs_parseargs(
205 */ 205 */
206 mp->m_flags |= XFS_MOUNT_BARRIER; 206 mp->m_flags |= XFS_MOUNT_BARRIER;
207 mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE; 207 mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
208#if !XFS_BIG_INUMS
209 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
210#endif
211 208
212 /* 209 /*
213 * These can be overridden by the mount option parsing. 210 * These can be overridden by the mount option parsing.
@@ -314,11 +311,6 @@ xfs_parseargs(
314 mp->m_flags |= XFS_MOUNT_SMALL_INUMS; 311 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
315 } else if (!strcmp(this_char, MNTOPT_64BITINODE)) { 312 } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
316 mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS; 313 mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
317#if !XFS_BIG_INUMS
318 xfs_warn(mp, "%s option not allowed on this system",
319 this_char);
320 return -EINVAL;
321#endif
322 } else if (!strcmp(this_char, MNTOPT_NOUUID)) { 314 } else if (!strcmp(this_char, MNTOPT_NOUUID)) {
323 mp->m_flags |= XFS_MOUNT_NOUUID; 315 mp->m_flags |= XFS_MOUNT_NOUUID;
324 } else if (!strcmp(this_char, MNTOPT_BARRIER)) { 316 } else if (!strcmp(this_char, MNTOPT_BARRIER)) {
@@ -598,15 +590,20 @@ xfs_max_file_offset(
598 return (((__uint64_t)pagefactor) << bitshift) - 1; 590 return (((__uint64_t)pagefactor) << bitshift) - 1;
599} 591}
600 592
593/*
594 * xfs_set_inode32() and xfs_set_inode64() are passed an agcount
595 * because in the growfs case, mp->m_sb.sb_agcount is not updated
596 * yet to the potentially higher ag count.
597 */
601xfs_agnumber_t 598xfs_agnumber_t
602xfs_set_inode32(struct xfs_mount *mp) 599xfs_set_inode32(struct xfs_mount *mp, xfs_agnumber_t agcount)
603{ 600{
604 xfs_agnumber_t index = 0; 601 xfs_agnumber_t index = 0;
605 xfs_agnumber_t maxagi = 0; 602 xfs_agnumber_t maxagi = 0;
606 xfs_sb_t *sbp = &mp->m_sb; 603 xfs_sb_t *sbp = &mp->m_sb;
607 xfs_agnumber_t max_metadata; 604 xfs_agnumber_t max_metadata;
608 xfs_agino_t agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks -1, 0); 605 xfs_agino_t agino;
609 xfs_ino_t ino = XFS_AGINO_TO_INO(mp, sbp->sb_agcount -1, agino); 606 xfs_ino_t ino;
610 xfs_perag_t *pag; 607 xfs_perag_t *pag;
611 608
612 /* Calculate how much should be reserved for inodes to meet 609 /* Calculate how much should be reserved for inodes to meet
@@ -621,10 +618,12 @@ xfs_set_inode32(struct xfs_mount *mp)
621 do_div(icount, sbp->sb_agblocks); 618 do_div(icount, sbp->sb_agblocks);
622 max_metadata = icount; 619 max_metadata = icount;
623 } else { 620 } else {
624 max_metadata = sbp->sb_agcount; 621 max_metadata = agcount;
625 } 622 }
626 623
627 for (index = 0; index < sbp->sb_agcount; index++) { 624 agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0);
625
626 for (index = 0; index < agcount; index++) {
628 ino = XFS_AGINO_TO_INO(mp, index, agino); 627 ino = XFS_AGINO_TO_INO(mp, index, agino);
629 628
630 if (ino > XFS_MAXINUMBER_32) { 629 if (ino > XFS_MAXINUMBER_32) {
@@ -649,11 +648,11 @@ xfs_set_inode32(struct xfs_mount *mp)
649} 648}
650 649
651xfs_agnumber_t 650xfs_agnumber_t
652xfs_set_inode64(struct xfs_mount *mp) 651xfs_set_inode64(struct xfs_mount *mp, xfs_agnumber_t agcount)
653{ 652{
654 xfs_agnumber_t index = 0; 653 xfs_agnumber_t index = 0;
655 654
656 for (index = 0; index < mp->m_sb.sb_agcount; index++) { 655 for (index = 0; index < agcount; index++) {
657 struct xfs_perag *pag; 656 struct xfs_perag *pag;
658 657
659 pag = xfs_perag_get(mp, index); 658 pag = xfs_perag_get(mp, index);
@@ -1189,6 +1188,7 @@ xfs_fs_remount(
1189 char *options) 1188 char *options)
1190{ 1189{
1191 struct xfs_mount *mp = XFS_M(sb); 1190 struct xfs_mount *mp = XFS_M(sb);
1191 xfs_sb_t *sbp = &mp->m_sb;
1192 substring_t args[MAX_OPT_ARGS]; 1192 substring_t args[MAX_OPT_ARGS];
1193 char *p; 1193 char *p;
1194 int error; 1194 int error;
@@ -1209,10 +1209,10 @@ xfs_fs_remount(
1209 mp->m_flags &= ~XFS_MOUNT_BARRIER; 1209 mp->m_flags &= ~XFS_MOUNT_BARRIER;
1210 break; 1210 break;
1211 case Opt_inode64: 1211 case Opt_inode64:
1212 mp->m_maxagi = xfs_set_inode64(mp); 1212 mp->m_maxagi = xfs_set_inode64(mp, sbp->sb_agcount);
1213 break; 1213 break;
1214 case Opt_inode32: 1214 case Opt_inode32:
1215 mp->m_maxagi = xfs_set_inode32(mp); 1215 mp->m_maxagi = xfs_set_inode32(mp, sbp->sb_agcount);
1216 break; 1216 break;
1217 default: 1217 default:
1218 /* 1218 /*
diff --git a/fs/xfs/xfs_super.h b/fs/xfs/xfs_super.h
index bbe3d15a7904..2b830c2f322e 100644
--- a/fs/xfs/xfs_super.h
+++ b/fs/xfs/xfs_super.h
@@ -44,16 +44,6 @@ extern void xfs_qm_exit(void);
44# define XFS_REALTIME_STRING 44# define XFS_REALTIME_STRING
45#endif 45#endif
46 46
47#if XFS_BIG_BLKNOS
48# if XFS_BIG_INUMS
49# define XFS_BIGFS_STRING "large block/inode numbers, "
50# else
51# define XFS_BIGFS_STRING "large block numbers, "
52# endif
53#else
54# define XFS_BIGFS_STRING
55#endif
56
57#ifdef DEBUG 47#ifdef DEBUG
58# define XFS_DBG_STRING "debug" 48# define XFS_DBG_STRING "debug"
59#else 49#else
@@ -64,7 +54,6 @@ extern void xfs_qm_exit(void);
64#define XFS_BUILD_OPTIONS XFS_ACL_STRING \ 54#define XFS_BUILD_OPTIONS XFS_ACL_STRING \
65 XFS_SECURITY_STRING \ 55 XFS_SECURITY_STRING \
66 XFS_REALTIME_STRING \ 56 XFS_REALTIME_STRING \
67 XFS_BIGFS_STRING \
68 XFS_DBG_STRING /* DBG must be last */ 57 XFS_DBG_STRING /* DBG must be last */
69 58
70struct xfs_inode; 59struct xfs_inode;
@@ -76,8 +65,8 @@ extern __uint64_t xfs_max_file_offset(unsigned int);
76 65
77extern void xfs_flush_inodes(struct xfs_mount *mp); 66extern void xfs_flush_inodes(struct xfs_mount *mp);
78extern void xfs_blkdev_issue_flush(struct xfs_buftarg *); 67extern void xfs_blkdev_issue_flush(struct xfs_buftarg *);
79extern xfs_agnumber_t xfs_set_inode32(struct xfs_mount *); 68extern xfs_agnumber_t xfs_set_inode32(struct xfs_mount *, xfs_agnumber_t agcount);
80extern xfs_agnumber_t xfs_set_inode64(struct xfs_mount *); 69extern xfs_agnumber_t xfs_set_inode64(struct xfs_mount *, xfs_agnumber_t agcount);
81 70
82extern const struct export_operations xfs_export_operations; 71extern const struct export_operations xfs_export_operations;
83extern const struct xattr_handler *xfs_xattr_handlers[]; 72extern const struct xattr_handler *xfs_xattr_handlers[];
diff --git a/fs/xfs/xfs_types.h b/fs/xfs/xfs_types.h
index 65c6e6650b1a..b79dc66b2ecd 100644
--- a/fs/xfs/xfs_types.h
+++ b/fs/xfs/xfs_types.h
@@ -38,43 +38,18 @@ typedef __int32_t xfs_tid_t; /* transaction identifier */
38typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ 38typedef __uint32_t xfs_dablk_t; /* dir/attr block number (in file) */
39typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */ 39typedef __uint32_t xfs_dahash_t; /* dir/attr hash value */
40 40
41/*
42 * These types are 64 bits on disk but are either 32 or 64 bits in memory.
43 * Disk based types:
44 */
45typedef __uint64_t xfs_dfsbno_t; /* blockno in filesystem (agno|agbno) */
46typedef __uint64_t xfs_drfsbno_t; /* blockno in filesystem (raw) */
47typedef __uint64_t xfs_drtbno_t; /* extent (block) in realtime area */
48typedef __uint64_t xfs_dfiloff_t; /* block number in a file */
49typedef __uint64_t xfs_dfilblks_t; /* number of blocks in a file */
50
51/*
52 * Memory based types are conditional.
53 */
54#if XFS_BIG_BLKNOS
55typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ 41typedef __uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
56typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ 42typedef __uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
57typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ 43typedef __uint64_t xfs_rtblock_t; /* extent (block) in realtime area */
58typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
59#else
60typedef __uint32_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */
61typedef __uint32_t xfs_rfsblock_t; /* blockno in filesystem (raw) */
62typedef __uint32_t xfs_rtblock_t; /* extent (block) in realtime area */
63typedef __int32_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
64#endif
65typedef __uint64_t xfs_fileoff_t; /* block number in a file */ 44typedef __uint64_t xfs_fileoff_t; /* block number in a file */
66typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
67typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ 45typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
68 46
47typedef __int64_t xfs_srtblock_t; /* signed version of xfs_rtblock_t */
48typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
69 49
70/* 50/*
71 * Null values for the types. 51 * Null values for the types.
72 */ 52 */
73#define NULLDFSBNO ((xfs_dfsbno_t)-1)
74#define NULLDRFSBNO ((xfs_drfsbno_t)-1)
75#define NULLDRTBNO ((xfs_drtbno_t)-1)
76#define NULLDFILOFF ((xfs_dfiloff_t)-1)
77
78#define NULLFSBLOCK ((xfs_fsblock_t)-1) 53#define NULLFSBLOCK ((xfs_fsblock_t)-1)
79#define NULLRFSBLOCK ((xfs_rfsblock_t)-1) 54#define NULLRFSBLOCK ((xfs_rfsblock_t)-1)
80#define NULLRTBLOCK ((xfs_rtblock_t)-1) 55#define NULLRTBLOCK ((xfs_rtblock_t)-1)