xfs: Add verifiers to dir2 data readahead.
Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Phil White <pwhite@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
This commit is contained in:
parent
d9392a4bb7
commit
da6958c873
|
@ -2285,10 +2285,10 @@ xfs_da_reada_buf(
|
||||||
struct xfs_trans *trans,
|
struct xfs_trans *trans,
|
||||||
struct xfs_inode *dp,
|
struct xfs_inode *dp,
|
||||||
xfs_dablk_t bno,
|
xfs_dablk_t bno,
|
||||||
|
xfs_daddr_t mappedbno,
|
||||||
int whichfork,
|
int whichfork,
|
||||||
xfs_buf_iodone_t verifier)
|
xfs_buf_iodone_t verifier)
|
||||||
{
|
{
|
||||||
xfs_daddr_t mappedbno = -1;
|
|
||||||
struct xfs_buf_map map;
|
struct xfs_buf_map map;
|
||||||
struct xfs_buf_map *mapp;
|
struct xfs_buf_map *mapp;
|
||||||
int nmap;
|
int nmap;
|
||||||
|
@ -2296,7 +2296,7 @@ xfs_da_reada_buf(
|
||||||
|
|
||||||
mapp = ↦
|
mapp = ↦
|
||||||
nmap = 1;
|
nmap = 1;
|
||||||
error = xfs_dabuf_map(trans, dp, bno, -1, whichfork,
|
error = xfs_dabuf_map(trans, dp, bno, mappedbno, whichfork,
|
||||||
&mapp, &nmap);
|
&mapp, &nmap);
|
||||||
if (error) {
|
if (error) {
|
||||||
/* mapping a hole is not an error, but we don't continue */
|
/* mapping a hole is not an error, but we don't continue */
|
||||||
|
|
|
@ -231,8 +231,8 @@ int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
|
||||||
struct xfs_buf **bpp, int whichfork,
|
struct xfs_buf **bpp, int whichfork,
|
||||||
xfs_buf_iodone_t verifier);
|
xfs_buf_iodone_t verifier);
|
||||||
xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
|
xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
|
||||||
xfs_dablk_t bno, int whichfork,
|
xfs_dablk_t bno, xfs_daddr_t mapped_bno,
|
||||||
xfs_buf_iodone_t verifier);
|
int whichfork, xfs_buf_iodone_t verifier);
|
||||||
int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
|
int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
|
||||||
struct xfs_buf *dead_buf);
|
struct xfs_buf *dead_buf);
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ __xfs_dir2_data_check(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
xfs_dir2_data_verify(
|
xfs_dir2_data_verify(
|
||||||
struct xfs_buf *bp)
|
struct xfs_buf *bp)
|
||||||
{
|
{
|
||||||
|
@ -217,6 +217,17 @@ xfs_dir2_data_read(
|
||||||
XFS_DATA_FORK, xfs_dir2_data_verify);
|
XFS_DATA_FORK, xfs_dir2_data_verify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
xfs_dir2_data_readahead(
|
||||||
|
struct xfs_trans *tp,
|
||||||
|
struct xfs_inode *dp,
|
||||||
|
xfs_dablk_t bno,
|
||||||
|
xfs_daddr_t mapped_bno)
|
||||||
|
{
|
||||||
|
return xfs_da_reada_buf(tp, dp, bno, mapped_bno,
|
||||||
|
XFS_DATA_FORK, xfs_dir2_data_verify);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given a data block and an unused entry from that block,
|
* Given a data block and an unused entry from that block,
|
||||||
* return the bestfree entry if any that corresponds to it.
|
* return the bestfree entry if any that corresponds to it.
|
||||||
|
|
|
@ -972,11 +972,11 @@ xfs_dir2_leaf_readbuf(
|
||||||
*/
|
*/
|
||||||
if (i > mip->ra_current &&
|
if (i > mip->ra_current &&
|
||||||
map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) {
|
map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) {
|
||||||
xfs_buf_readahead(mp->m_ddev_targp,
|
xfs_dir2_data_readahead(NULL, dp,
|
||||||
|
map[mip->ra_index].br_startoff + mip->ra_offset,
|
||||||
XFS_FSB_TO_DADDR(mp,
|
XFS_FSB_TO_DADDR(mp,
|
||||||
map[mip->ra_index].br_startblock +
|
map[mip->ra_index].br_startblock +
|
||||||
mip->ra_offset),
|
mip->ra_offset));
|
||||||
(int)BTOBB(mp->m_dirblksize), NULL);
|
|
||||||
mip->ra_current = i;
|
mip->ra_current = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,10 +985,9 @@ xfs_dir2_leaf_readbuf(
|
||||||
* use our mapping, but this is a very rare case.
|
* use our mapping, but this is a very rare case.
|
||||||
*/
|
*/
|
||||||
else if (i > mip->ra_current) {
|
else if (i > mip->ra_current) {
|
||||||
xfs_da_reada_buf(NULL, dp,
|
xfs_dir2_data_readahead(NULL, dp,
|
||||||
map[mip->ra_index].br_startoff +
|
map[mip->ra_index].br_startoff +
|
||||||
mip->ra_offset,
|
mip->ra_offset, -1);
|
||||||
XFS_DATA_FORK, NULL);
|
|
||||||
mip->ra_current = i;
|
mip->ra_current = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
|
||||||
extern int __xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
|
extern int __xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
|
||||||
extern int xfs_dir2_data_read(struct xfs_trans *tp, struct xfs_inode *dp,
|
extern int xfs_dir2_data_read(struct xfs_trans *tp, struct xfs_inode *dp,
|
||||||
xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp);
|
xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp);
|
||||||
|
extern int xfs_dir2_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp,
|
||||||
|
xfs_dablk_t bno, xfs_daddr_t mapped_bno);
|
||||||
|
|
||||||
extern struct xfs_dir2_data_free *
|
extern struct xfs_dir2_data_free *
|
||||||
xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
|
xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "xfs_error.h"
|
#include "xfs_error.h"
|
||||||
#include "xfs_vnodeops.h"
|
#include "xfs_vnodeops.h"
|
||||||
#include "xfs_da_btree.h"
|
#include "xfs_da_btree.h"
|
||||||
|
#include "xfs_dir2_format.h"
|
||||||
|
#include "xfs_dir2_priv.h"
|
||||||
#include "xfs_ioctl.h"
|
#include "xfs_ioctl.h"
|
||||||
#include "xfs_trace.h"
|
#include "xfs_trace.h"
|
||||||
|
|
||||||
|
@ -891,7 +893,7 @@ xfs_dir_open(
|
||||||
*/
|
*/
|
||||||
mode = xfs_ilock_map_shared(ip);
|
mode = xfs_ilock_map_shared(ip);
|
||||||
if (ip->i_d.di_nextents > 0)
|
if (ip->i_d.di_nextents > 0)
|
||||||
xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK, NULL);
|
xfs_dir2_data_readahead(NULL, ip, 0, -1);
|
||||||
xfs_iunlock(ip, mode);
|
xfs_iunlock(ip, mode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue