aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_node.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r--fs/xfs/xfs_dir2_node.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 89777bf63551..ef34c197b62f 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -327,9 +327,9 @@ xfs_dir2_leaf_to_node(
327 free = fbp->b_addr; 327 free = fbp->b_addr;
328 dp->d_ops->free_hdr_from_disk(&freehdr, free); 328 dp->d_ops->free_hdr_from_disk(&freehdr, free);
329 leaf = lbp->b_addr; 329 leaf = lbp->b_addr;
330 ltp = xfs_dir2_leaf_tail_p(mp, leaf); 330 ltp = xfs_dir2_leaf_tail_p(args->geo, leaf);
331 ASSERT(be32_to_cpu(ltp->bestcount) <= 331 ASSERT(be32_to_cpu(ltp->bestcount) <=
332 (uint)dp->i_d.di_size / mp->m_dirblksize); 332 (uint)dp->i_d.di_size / args->geo->blksize);
333 333
334 /* 334 /*
335 * Copy freespace entries from the leaf block to the new block. 335 * Copy freespace entries from the leaf block to the new block.
@@ -416,7 +416,7 @@ xfs_dir2_leafn_add(
416 * a compact. 416 * a compact.
417 */ 417 */
418 418
419 if (leafhdr.count == dp->d_ops->leaf_max_ents(mp)) { 419 if (leafhdr.count == dp->d_ops->leaf_max_ents(args->geo)) {
420 if (!leafhdr.stale) 420 if (!leafhdr.stale)
421 return XFS_ERROR(ENOSPC); 421 return XFS_ERROR(ENOSPC);
422 compact = leafhdr.stale > 1; 422 compact = leafhdr.stale > 1;
@@ -472,7 +472,8 @@ xfs_dir2_free_hdr_check(
472 472
473 dp->d_ops->free_hdr_from_disk(&hdr, bp->b_addr); 473 dp->d_ops->free_hdr_from_disk(&hdr, bp->b_addr);
474 474
475 ASSERT((hdr.firstdb % dp->d_ops->free_max_bests(dp->i_mount)) == 0); 475 ASSERT((hdr.firstdb %
476 dp->d_ops->free_max_bests(dp->i_mount->m_dir_geo)) == 0);
476 ASSERT(hdr.firstdb <= db); 477 ASSERT(hdr.firstdb <= db);
477 ASSERT(db < hdr.firstdb + hdr.nvalid); 478 ASSERT(db < hdr.firstdb + hdr.nvalid);
478} 479}
@@ -595,7 +596,7 @@ xfs_dir2_leafn_lookup_for_addname(
595 * Convert the data block to the free block 596 * Convert the data block to the free block
596 * holding its freespace information. 597 * holding its freespace information.
597 */ 598 */
598 newfdb = dp->d_ops->db_to_fdb(mp, newdb); 599 newfdb = dp->d_ops->db_to_fdb(args->geo, newdb);
599 /* 600 /*
600 * If it's not the one we have in hand, read it in. 601 * If it's not the one we have in hand, read it in.
601 */ 602 */
@@ -619,7 +620,7 @@ xfs_dir2_leafn_lookup_for_addname(
619 /* 620 /*
620 * Get the index for our entry. 621 * Get the index for our entry.
621 */ 622 */
622 fi = dp->d_ops->db_to_fdindex(mp, curdb); 623 fi = dp->d_ops->db_to_fdindex(args->geo, curdb);
623 /* 624 /*
624 * If it has room, return it. 625 * If it has room, return it.
625 */ 626 */
@@ -1251,7 +1252,7 @@ xfs_dir2_leafn_remove(
1251 * Convert the data block number to a free block, 1252 * Convert the data block number to a free block,
1252 * read in the free block. 1253 * read in the free block.
1253 */ 1254 */
1254 fdb = dp->d_ops->db_to_fdb(mp, db); 1255 fdb = dp->d_ops->db_to_fdb(args->geo, db);
1255 error = xfs_dir2_free_read(tp, dp, 1256 error = xfs_dir2_free_read(tp, dp,
1256 xfs_dir2_db_to_da(args->geo, fdb), 1257 xfs_dir2_db_to_da(args->geo, fdb),
1257 &fbp); 1258 &fbp);
@@ -1262,7 +1263,7 @@ xfs_dir2_leafn_remove(
1262 { 1263 {
1263 struct xfs_dir3_icfree_hdr freehdr; 1264 struct xfs_dir3_icfree_hdr freehdr;
1264 dp->d_ops->free_hdr_from_disk(&freehdr, free); 1265 dp->d_ops->free_hdr_from_disk(&freehdr, free);
1265 ASSERT(freehdr.firstdb == dp->d_ops->free_max_bests(mp) * 1266 ASSERT(freehdr.firstdb == dp->d_ops->free_max_bests(args->geo) *
1266 (fdb - xfs_dir2_byte_to_db(args->geo, 1267 (fdb - xfs_dir2_byte_to_db(args->geo,
1267 XFS_DIR2_FREE_OFFSET))); 1268 XFS_DIR2_FREE_OFFSET)));
1268 } 1269 }
@@ -1270,13 +1271,13 @@ xfs_dir2_leafn_remove(
1270 /* 1271 /*
1271 * Calculate which entry we need to fix. 1272 * Calculate which entry we need to fix.
1272 */ 1273 */
1273 findex = dp->d_ops->db_to_fdindex(mp, db); 1274 findex = dp->d_ops->db_to_fdindex(args->geo, db);
1274 longest = be16_to_cpu(bf[0].length); 1275 longest = be16_to_cpu(bf[0].length);
1275 /* 1276 /*
1276 * If the data block is now empty we can get rid of it 1277 * If the data block is now empty we can get rid of it
1277 * (usually). 1278 * (usually).
1278 */ 1279 */
1279 if (longest == mp->m_dirblksize - 1280 if (longest == args->geo->blksize -
1280 dp->d_ops->data_entry_offset) { 1281 dp->d_ops->data_entry_offset) {
1281 /* 1282 /*
1282 * Try to punch out the data block. 1283 * Try to punch out the data block.
@@ -1595,7 +1596,7 @@ xfs_dir2_node_addname(
1595 state = xfs_da_state_alloc(); 1596 state = xfs_da_state_alloc();
1596 state->args = args; 1597 state->args = args;
1597 state->mp = args->dp->i_mount; 1598 state->mp = args->dp->i_mount;
1598 state->blocksize = state->mp->m_dirblksize; 1599 state->blocksize = state->args->geo->blksize;
1599 state->node_ents = state->mp->m_dir_node_ents; 1600 state->node_ents = state->mp->m_dir_node_ents;
1600 /* 1601 /*
1601 * Look up the name. We're not supposed to find it, but 1602 * Look up the name. We're not supposed to find it, but
@@ -1843,7 +1844,7 @@ xfs_dir2_node_addname_int(
1843 * Get the freespace block corresponding to the data block 1844 * Get the freespace block corresponding to the data block
1844 * that was just allocated. 1845 * that was just allocated.
1845 */ 1846 */
1846 fbno = dp->d_ops->db_to_fdb(mp, dbno); 1847 fbno = dp->d_ops->db_to_fdb(args->geo, dbno);
1847 error = xfs_dir2_free_try_read(tp, dp, 1848 error = xfs_dir2_free_try_read(tp, dp,
1848 xfs_dir2_db_to_da(args->geo, fbno), 1849 xfs_dir2_db_to_da(args->geo, fbno),
1849 &fbp); 1850 &fbp);
@@ -1860,12 +1861,13 @@ xfs_dir2_node_addname_int(
1860 if (error) 1861 if (error)
1861 return error; 1862 return error;
1862 1863
1863 if (unlikely(dp->d_ops->db_to_fdb(mp, dbno) != fbno)) { 1864 if (dp->d_ops->db_to_fdb(args->geo, dbno) != fbno) {
1864 xfs_alert(mp, 1865 xfs_alert(mp,
1865 "%s: dir ino %llu needed freesp block %lld for\n" 1866 "%s: dir ino %llu needed freesp block %lld for\n"
1866 " data block %lld, got %lld ifbno %llu lastfbno %d", 1867 " data block %lld, got %lld ifbno %llu lastfbno %d",
1867 __func__, (unsigned long long)dp->i_ino, 1868 __func__, (unsigned long long)dp->i_ino,
1868 (long long)dp->d_ops->db_to_fdb(mp, dbno), 1869 (long long)dp->d_ops->db_to_fdb(
1870 args->geo, dbno),
1869 (long long)dbno, (long long)fbno, 1871 (long long)dbno, (long long)fbno,
1870 (unsigned long long)ifbno, lastfbno); 1872 (unsigned long long)ifbno, lastfbno);
1871 if (fblk) { 1873 if (fblk) {
@@ -1899,7 +1901,7 @@ xfs_dir2_node_addname_int(
1899 freehdr.firstdb = 1901 freehdr.firstdb =
1900 (fbno - xfs_dir2_byte_to_db(args->geo, 1902 (fbno - xfs_dir2_byte_to_db(args->geo,
1901 XFS_DIR2_FREE_OFFSET)) * 1903 XFS_DIR2_FREE_OFFSET)) *
1902 dp->d_ops->free_max_bests(mp); 1904 dp->d_ops->free_max_bests(args->geo);
1903 } else { 1905 } else {
1904 free = fbp->b_addr; 1906 free = fbp->b_addr;
1905 bests = dp->d_ops->free_bests_p(free); 1907 bests = dp->d_ops->free_bests_p(free);
@@ -1909,13 +1911,13 @@ xfs_dir2_node_addname_int(
1909 /* 1911 /*
1910 * Set the freespace block index from the data block number. 1912 * Set the freespace block index from the data block number.
1911 */ 1913 */
1912 findex = dp->d_ops->db_to_fdindex(mp, dbno); 1914 findex = dp->d_ops->db_to_fdindex(args->geo, dbno);
1913 /* 1915 /*
1914 * If it's after the end of the current entries in the 1916 * If it's after the end of the current entries in the
1915 * freespace block, extend that table. 1917 * freespace block, extend that table.
1916 */ 1918 */
1917 if (findex >= freehdr.nvalid) { 1919 if (findex >= freehdr.nvalid) {
1918 ASSERT(findex < dp->d_ops->free_max_bests(mp)); 1920 ASSERT(findex < dp->d_ops->free_max_bests(args->geo));
1919 freehdr.nvalid = findex + 1; 1921 freehdr.nvalid = findex + 1;
1920 /* 1922 /*
1921 * Tag new entry so nused will go up. 1923 * Tag new entry so nused will go up.
@@ -2040,7 +2042,7 @@ xfs_dir2_node_lookup(
2040 state = xfs_da_state_alloc(); 2042 state = xfs_da_state_alloc();
2041 state->args = args; 2043 state->args = args;
2042 state->mp = args->dp->i_mount; 2044 state->mp = args->dp->i_mount;
2043 state->blocksize = state->mp->m_dirblksize; 2045 state->blocksize = args->geo->blksize;
2044 state->node_ents = state->mp->m_dir_node_ents; 2046 state->node_ents = state->mp->m_dir_node_ents;
2045 /* 2047 /*
2046 * Fill in the path to the entry in the cursor. 2048 * Fill in the path to the entry in the cursor.
@@ -2095,7 +2097,7 @@ xfs_dir2_node_removename(
2095 state = xfs_da_state_alloc(); 2097 state = xfs_da_state_alloc();
2096 state->args = args; 2098 state->args = args;
2097 state->mp = args->dp->i_mount; 2099 state->mp = args->dp->i_mount;
2098 state->blocksize = state->mp->m_dirblksize; 2100 state->blocksize = args->geo->blksize;
2099 state->node_ents = state->mp->m_dir_node_ents; 2101 state->node_ents = state->mp->m_dir_node_ents;
2100 2102
2101 /* Look up the entry we're deleting, set up the cursor. */ 2103 /* Look up the entry we're deleting, set up the cursor. */
@@ -2165,7 +2167,7 @@ xfs_dir2_node_replace(
2165 state = xfs_da_state_alloc(); 2167 state = xfs_da_state_alloc();
2166 state->args = args; 2168 state->args = args;
2167 state->mp = args->dp->i_mount; 2169 state->mp = args->dp->i_mount;
2168 state->blocksize = state->mp->m_dirblksize; 2170 state->blocksize = args->geo->blksize;
2169 state->node_ents = state->mp->m_dir_node_ents; 2171 state->node_ents = state->mp->m_dir_node_ents;
2170 inum = args->inumber; 2172 inum = args->inumber;
2171 /* 2173 /*