aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_block.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-22 17:07:56 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:57:00 -0400
commitb8227554c951eb144e975c5e741d33f29c29596f (patch)
treed980fa8d88fd7bf4a1b7a5ac02d29dbc95fc7200 /fs/xfs/xfs_dir2_block.c
parent9cdda8d31ffb87ba688f91104be200e2a96a38cd (diff)
[readdir] convert xfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xfs/xfs_dir2_block.c')
-rw-r--r--fs/xfs/xfs_dir2_block.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index e59f5fc816fe..09aea0247d96 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -569,9 +569,7 @@ xfs_dir2_block_addname(
569int /* error */ 569int /* error */
570xfs_dir2_block_getdents( 570xfs_dir2_block_getdents(
571 xfs_inode_t *dp, /* incore inode */ 571 xfs_inode_t *dp, /* incore inode */
572 void *dirent, 572 struct dir_context *ctx)
573 xfs_off_t *offset,
574 filldir_t filldir)
575{ 573{
576 xfs_dir2_data_hdr_t *hdr; /* block header */ 574 xfs_dir2_data_hdr_t *hdr; /* block header */
577 struct xfs_buf *bp; /* buffer for block */ 575 struct xfs_buf *bp; /* buffer for block */
@@ -589,7 +587,7 @@ xfs_dir2_block_getdents(
589 /* 587 /*
590 * If the block number in the offset is out of range, we're done. 588 * If the block number in the offset is out of range, we're done.
591 */ 589 */
592 if (xfs_dir2_dataptr_to_db(mp, *offset) > mp->m_dirdatablk) 590 if (xfs_dir2_dataptr_to_db(mp, ctx->pos) > mp->m_dirdatablk)
593 return 0; 591 return 0;
594 592
595 error = xfs_dir3_block_read(NULL, dp, &bp); 593 error = xfs_dir3_block_read(NULL, dp, &bp);
@@ -600,7 +598,7 @@ xfs_dir2_block_getdents(
600 * Extract the byte offset we start at from the seek pointer. 598 * Extract the byte offset we start at from the seek pointer.
601 * We'll skip entries before this. 599 * We'll skip entries before this.
602 */ 600 */
603 wantoff = xfs_dir2_dataptr_to_off(mp, *offset); 601 wantoff = xfs_dir2_dataptr_to_off(mp, ctx->pos);
604 hdr = bp->b_addr; 602 hdr = bp->b_addr;
605 xfs_dir3_data_check(dp, bp); 603 xfs_dir3_data_check(dp, bp);
606 /* 604 /*
@@ -639,13 +637,12 @@ xfs_dir2_block_getdents(
639 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 637 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
640 (char *)dep - (char *)hdr); 638 (char *)dep - (char *)hdr);
641 639
640 ctx->pos = cook & 0x7fffffff;
642 /* 641 /*
643 * If it didn't fit, set the final offset to here & return. 642 * If it didn't fit, set the final offset to here & return.
644 */ 643 */
645 if (filldir(dirent, (char *)dep->name, dep->namelen, 644 if (!dir_emit(ctx, (char *)dep->name, dep->namelen,
646 cook & 0x7fffffff, be64_to_cpu(dep->inumber), 645 be64_to_cpu(dep->inumber), DT_UNKNOWN)) {
647 DT_UNKNOWN)) {
648 *offset = cook & 0x7fffffff;
649 xfs_trans_brelse(NULL, bp); 646 xfs_trans_brelse(NULL, bp);
650 return 0; 647 return 0;
651 } 648 }
@@ -655,7 +652,7 @@ xfs_dir2_block_getdents(
655 * Reached the end of the block. 652 * Reached the end of the block.
656 * Set the offset to a non-existent block 1 and return. 653 * Set the offset to a non-existent block 1 and return.
657 */ 654 */
658 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) & 655 ctx->pos = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
659 0x7fffffff; 656 0x7fffffff;
660 xfs_trans_brelse(NULL, bp); 657 xfs_trans_brelse(NULL, bp);
661 return 0; 658 return 0;