diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index da71a1819d78..e0cc1243a8aa 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -1300,10 +1300,8 @@ out: | |||
1300 | int /* error */ | 1300 | int /* error */ |
1301 | xfs_dir2_leaf_getdents( | 1301 | xfs_dir2_leaf_getdents( |
1302 | xfs_inode_t *dp, /* incore directory inode */ | 1302 | xfs_inode_t *dp, /* incore directory inode */ |
1303 | void *dirent, | 1303 | struct dir_context *ctx, |
1304 | size_t bufsize, | 1304 | size_t bufsize) |
1305 | xfs_off_t *offset, | ||
1306 | filldir_t filldir) | ||
1307 | { | 1305 | { |
1308 | struct xfs_buf *bp = NULL; /* data block buffer */ | 1306 | struct xfs_buf *bp = NULL; /* data block buffer */ |
1309 | xfs_dir2_data_hdr_t *hdr; /* data block header */ | 1307 | xfs_dir2_data_hdr_t *hdr; /* data block header */ |
@@ -1322,7 +1320,7 @@ xfs_dir2_leaf_getdents( | |||
1322 | * If the offset is at or past the largest allowed value, | 1320 | * If the offset is at or past the largest allowed value, |
1323 | * give up right away. | 1321 | * give up right away. |
1324 | */ | 1322 | */ |
1325 | if (*offset >= XFS_DIR2_MAX_DATAPTR) | 1323 | if (ctx->pos >= XFS_DIR2_MAX_DATAPTR) |
1326 | return 0; | 1324 | return 0; |
1327 | 1325 | ||
1328 | mp = dp->i_mount; | 1326 | mp = dp->i_mount; |
@@ -1343,7 +1341,7 @@ xfs_dir2_leaf_getdents( | |||
1343 | * Inside the loop we keep the main offset value as a byte offset | 1341 | * Inside the loop we keep the main offset value as a byte offset |
1344 | * in the directory file. | 1342 | * in the directory file. |
1345 | */ | 1343 | */ |
1346 | curoff = xfs_dir2_dataptr_to_byte(mp, *offset); | 1344 | curoff = xfs_dir2_dataptr_to_byte(mp, ctx->pos); |
1347 | 1345 | ||
1348 | /* | 1346 | /* |
1349 | * Force this conversion through db so we truncate the offset | 1347 | * Force this conversion through db so we truncate the offset |
@@ -1444,8 +1442,8 @@ xfs_dir2_leaf_getdents( | |||
1444 | dep = (xfs_dir2_data_entry_t *)ptr; | 1442 | dep = (xfs_dir2_data_entry_t *)ptr; |
1445 | length = xfs_dir2_data_entsize(dep->namelen); | 1443 | length = xfs_dir2_data_entsize(dep->namelen); |
1446 | 1444 | ||
1447 | if (filldir(dirent, (char *)dep->name, dep->namelen, | 1445 | ctx->pos = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff; |
1448 | xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff, | 1446 | if (!dir_emit(ctx, (char *)dep->name, dep->namelen, |
1449 | be64_to_cpu(dep->inumber), DT_UNKNOWN)) | 1447 | be64_to_cpu(dep->inumber), DT_UNKNOWN)) |
1450 | break; | 1448 | break; |
1451 | 1449 | ||
@@ -1462,9 +1460,9 @@ xfs_dir2_leaf_getdents( | |||
1462 | * All done. Set output offset value to current offset. | 1460 | * All done. Set output offset value to current offset. |
1463 | */ | 1461 | */ |
1464 | if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) | 1462 | if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR)) |
1465 | *offset = XFS_DIR2_MAX_DATAPTR & 0x7fffffff; | 1463 | ctx->pos = XFS_DIR2_MAX_DATAPTR & 0x7fffffff; |
1466 | else | 1464 | else |
1467 | *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff; | 1465 | ctx->pos = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff; |
1468 | kmem_free(map_info); | 1466 | kmem_free(map_info); |
1469 | if (bp) | 1467 | if (bp) |
1470 | xfs_trans_brelse(NULL, bp); | 1468 | xfs_trans_brelse(NULL, bp); |