Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195822
b: refs/heads/master
c: 2b8f12b
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Alex Elder committed May 19, 2010
1 parent ff28bba commit bf6d63b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 558e6891693f4c383c51c7343a88dea174eadacf
refs/heads/master: 2b8f12b7e438fa6ba4a0f8f861871be0beb3a3e6
25 changes: 16 additions & 9 deletions trunk/fs/xfs/linux-2.6/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1536,16 +1536,23 @@ __xfs_get_blocks(
}
}

/*
* If this is O_DIRECT or the mpage code calling tell them how large
* the mapping is, so that we can avoid repeated get_blocks calls.
*/
if (direct || size > (1 << inode->i_blkbits)) {
struct xfs_mount *mp = XFS_I(inode)->i_mount;
xfs_off_t iomap_offset = XFS_FSB_TO_B(mp, imap.br_startoff);
xfs_off_t iomap_delta = offset - iomap_offset;
xfs_off_t iomap_bsize = XFS_FSB_TO_B(mp, imap.br_blockcount);

ASSERT(iomap_bsize - iomap_delta > 0);
offset = min_t(xfs_off_t,
iomap_bsize - iomap_delta, size);
bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset);
xfs_off_t mapping_size;

mapping_size = imap.br_startoff + imap.br_blockcount - iblock;
mapping_size <<= inode->i_blkbits;

ASSERT(mapping_size > 0);
if (mapping_size > size)
mapping_size = size;
if (mapping_size > LONG_MAX)
mapping_size = LONG_MAX;

bh_result->b_size = mapping_size;
}

return 0;
Expand Down

0 comments on commit bf6d63b

Please sign in to comment.