aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rw.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_rw.c')
-rw-r--r--fs/xfs/xfs_rw.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c
index 3f816ad7ff19..5aa07caea5f1 100644
--- a/fs/xfs/xfs_rw.c
+++ b/fs/xfs/xfs_rw.c
@@ -44,6 +44,7 @@
44#include "xfs_error.h" 44#include "xfs_error.h"
45#include "xfs_buf_item.h" 45#include "xfs_buf_item.h"
46#include "xfs_rw.h" 46#include "xfs_rw.h"
47#include "xfs_trace.h"
47 48
48/* 49/*
49 * This is a subroutine for xfs_write() and other writers (xfs_ioctl) 50 * This is a subroutine for xfs_write() and other writers (xfs_ioctl)
@@ -171,7 +172,6 @@ xfs_bioerror(
171 * No need to wait until the buffer is unpinned. 172 * No need to wait until the buffer is unpinned.
172 * We aren't flushing it. 173 * We aren't flushing it.
173 */ 174 */
174 xfs_buftrace("XFS IOERROR", bp);
175 XFS_BUF_ERROR(bp, EIO); 175 XFS_BUF_ERROR(bp, EIO);
176 /* 176 /*
177 * We're calling biodone, so delete B_DONE flag. Either way 177 * We're calling biodone, so delete B_DONE flag. Either way
@@ -205,7 +205,6 @@ xfs_bioerror_relse(
205 ASSERT(XFS_BUF_IODONE_FUNC(bp) != xfs_buf_iodone_callbacks); 205 ASSERT(XFS_BUF_IODONE_FUNC(bp) != xfs_buf_iodone_callbacks);
206 ASSERT(XFS_BUF_IODONE_FUNC(bp) != xlog_iodone); 206 ASSERT(XFS_BUF_IODONE_FUNC(bp) != xlog_iodone);
207 207
208 xfs_buftrace("XFS IOERRELSE", bp);
209 fl = XFS_BUF_BFLAGS(bp); 208 fl = XFS_BUF_BFLAGS(bp);
210 /* 209 /*
211 * No need to wait until the buffer is unpinned. 210 * No need to wait until the buffer is unpinned.
@@ -277,10 +276,10 @@ xfs_read_buf(
277 xfs_buf_t *bp; 276 xfs_buf_t *bp;
278 int error; 277 int error;
279 278
280 if (flags) 279 if (!flags)
281 bp = xfs_buf_read_flags(target, blkno, len, flags); 280 flags = XBF_LOCK | XBF_MAPPED;
282 else 281
283 bp = xfs_buf_read(target, blkno, len, flags); 282 bp = xfs_buf_read(target, blkno, len, flags);
284 if (!bp) 283 if (!bp)
285 return XFS_ERROR(EIO); 284 return XFS_ERROR(EIO);
286 error = XFS_BUF_GETERROR(bp); 285 error = XFS_BUF_GETERROR(bp);
@@ -336,3 +335,25 @@ xfs_bwrite(
336 } 335 }
337 return (error); 336 return (error);
338} 337}
338
339/*
340 * helper function to extract extent size hint from inode
341 */
342xfs_extlen_t
343xfs_get_extsz_hint(
344 struct xfs_inode *ip)
345{
346 xfs_extlen_t extsz;
347
348 if (unlikely(XFS_IS_REALTIME_INODE(ip))) {
349 extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
350 ? ip->i_d.di_extsize
351 : ip->i_mount->m_sb.sb_rextsize;
352 ASSERT(extsz);
353 } else {
354 extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
355 ? ip->i_d.di_extsize : 0;
356 }
357
358 return extsz;
359}