|
@@ -253,7 +253,8 @@ xfs_itobp(
|
|
|
xfs_inode_t *ip,
|
|
|
xfs_dinode_t **dipp,
|
|
|
xfs_buf_t **bpp,
|
|
|
- xfs_daddr_t bno)
|
|
|
+ xfs_daddr_t bno,
|
|
|
+ uint imap_flags)
|
|
|
{
|
|
|
xfs_buf_t *bp;
|
|
|
int error;
|
|
@@ -269,10 +270,9 @@ xfs_itobp(
|
|
|
* inode on disk.
|
|
|
*/
|
|
|
imap.im_blkno = bno;
|
|
|
- error = xfs_imap(mp, tp, ip->i_ino, &imap, XFS_IMAP_LOOKUP);
|
|
|
- if (error != 0) {
|
|
|
+ if ((error = xfs_imap(mp, tp, ip->i_ino, &imap,
|
|
|
+ XFS_IMAP_LOOKUP | imap_flags)))
|
|
|
return error;
|
|
|
- }
|
|
|
|
|
|
/*
|
|
|
* If the inode number maps to a block outside the bounds
|
|
@@ -336,9 +336,10 @@ xfs_itobp(
|
|
|
* (if DEBUG kernel) or the first inode in the buffer, otherwise.
|
|
|
*/
|
|
|
#ifdef DEBUG
|
|
|
- ni = BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog;
|
|
|
+ ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 :
|
|
|
+ (BBTOB(imap.im_len) >> mp->m_sb.sb_inodelog);
|
|
|
#else
|
|
|
- ni = 1;
|
|
|
+ ni = (imap_flags & XFS_IMAP_BULKSTAT) ? 0 : 1;
|
|
|
#endif
|
|
|
for (i = 0; i < ni; i++) {
|
|
|
int di_ok;
|
|
@@ -868,9 +869,8 @@ xfs_iread(
|
|
|
* return NULL as well. Set i_blkno to 0 so that xfs_itobp() will
|
|
|
* know that this is a new incore inode.
|
|
|
*/
|
|
|
- error = xfs_itobp(mp, tp, ip, &dip, &bp, bno);
|
|
|
-
|
|
|
- if (error != 0) {
|
|
|
+ error = xfs_itobp(mp, tp, ip, &dip, &bp, bno, 0);
|
|
|
+ if (error) {
|
|
|
kmem_zone_free(xfs_inode_zone, ip);
|
|
|
return error;
|
|
|
}
|
|
@@ -1895,7 +1895,7 @@ xfs_iunlink(
|
|
|
* Here we put the head pointer into our next pointer,
|
|
|
* and then we fall through to point the head at us.
|
|
|
*/
|
|
|
- error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0);
|
|
|
+ error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
|
|
|
if (error) {
|
|
|
return error;
|
|
|
}
|
|
@@ -2004,7 +2004,7 @@ xfs_iunlink_remove(
|
|
|
* of dealing with the buffer when there is no need to
|
|
|
* change it.
|
|
|
*/
|
|
|
- error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0);
|
|
|
+ error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
|
|
|
if (error) {
|
|
|
cmn_err(CE_WARN,
|
|
|
"xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.",
|
|
@@ -2066,7 +2066,7 @@ xfs_iunlink_remove(
|
|
|
* Now last_ibp points to the buffer previous to us on
|
|
|
* the unlinked list. Pull us from the list.
|
|
|
*/
|
|
|
- error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0);
|
|
|
+ error = xfs_itobp(mp, tp, ip, &dip, &ibp, 0, 0);
|
|
|
if (error) {
|
|
|
cmn_err(CE_WARN,
|
|
|
"xfs_iunlink_remove: xfs_itobp() returned an error %d on %s. Returning error.",
|
|
@@ -3023,8 +3023,8 @@ xfs_iflush(
|
|
|
/*
|
|
|
* Get the buffer containing the on-disk inode.
|
|
|
*/
|
|
|
- error = xfs_itobp(mp, NULL, ip, &dip, &bp, 0);
|
|
|
- if (error != 0) {
|
|
|
+ error = xfs_itobp(mp, NULL, ip, &dip, &bp, 0, 0);
|
|
|
+ if (error) {
|
|
|
xfs_ifunlock(ip);
|
|
|
return error;
|
|
|
}
|