Skip to content

Commit c253666

Browse files
committed
[XFS] Cleanup in XFS after recent get_block_t interface tweaks.
Signed-off-by: Nathan Scott <nathans@sgi.com>
1 parent 0b7e56a commit c253666

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

fs/xfs/linux-2.6/xfs_aops.c

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,10 +1223,9 @@ xfs_vm_releasepage(
12231223
}
12241224

12251225
STATIC int
1226-
__xfs_get_block(
1226+
__xfs_get_blocks(
12271227
struct inode *inode,
12281228
sector_t iblock,
1229-
unsigned long blocks,
12301229
struct buffer_head *bh_result,
12311230
int create,
12321231
int direct,
@@ -1236,22 +1235,17 @@ __xfs_get_block(
12361235
xfs_iomap_t iomap;
12371236
xfs_off_t offset;
12381237
ssize_t size;
1239-
int retpbbm = 1;
1238+
int niomap = 1;
12401239
int error;
12411240

12421241
offset = (xfs_off_t)iblock << inode->i_blkbits;
1243-
if (blocks)
1244-
size = (ssize_t) min_t(xfs_off_t, LONG_MAX,
1245-
(xfs_off_t)blocks << inode->i_blkbits);
1246-
else
1247-
size = 1 << inode->i_blkbits;
1248-
1242+
ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
1243+
size = bh_result->b_size;
12491244
VOP_BMAP(vp, offset, size,
1250-
create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
1245+
create ? flags : BMAPI_READ, &iomap, &niomap, error);
12511246
if (error)
12521247
return -error;
1253-
1254-
if (retpbbm == 0)
1248+
if (niomap == 0)
12551249
return 0;
12561250

12571251
if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
@@ -1271,12 +1265,16 @@ __xfs_get_block(
12711265
}
12721266
}
12731267

1274-
/* If this is a realtime file, data might be on a new device */
1268+
/*
1269+
* If this is a realtime file, data may be on a different device.
1270+
* to that pointed to from the buffer_head b_bdev currently.
1271+
*/
12751272
bh_result->b_bdev = iomap.iomap_target->bt_bdev;
12761273

1277-
/* If we previously allocated a block out beyond eof and
1278-
* we are now coming back to use it then we will need to
1279-
* flag it as new even if it has a disk address.
1274+
/*
1275+
* If we previously allocated a block out beyond eof and we are
1276+
* now coming back to use it then we will need to flag it as new
1277+
* even if it has a disk address.
12801278
*/
12811279
if (create &&
12821280
((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
@@ -1292,26 +1290,24 @@ __xfs_get_block(
12921290
}
12931291
}
12941292

1295-
if (blocks) {
1293+
if (direct || size > (1 << inode->i_blkbits)) {
12961294
ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0);
12971295
offset = min_t(xfs_off_t,
1298-
iomap.iomap_bsize - iomap.iomap_delta,
1299-
(xfs_off_t)blocks << inode->i_blkbits);
1300-
bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset);
1296+
iomap.iomap_bsize - iomap.iomap_delta, size);
1297+
bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset);
13011298
}
13021299

13031300
return 0;
13041301
}
13051302

13061303
int
1307-
xfs_get_block(
1304+
xfs_get_blocks(
13081305
struct inode *inode,
13091306
sector_t iblock,
13101307
struct buffer_head *bh_result,
13111308
int create)
13121309
{
1313-
return __xfs_get_block(inode, iblock,
1314-
bh_result->b_size >> inode->i_blkbits,
1310+
return __xfs_get_blocks(inode, iblock,
13151311
bh_result, create, 0, BMAPI_WRITE);
13161312
}
13171313

@@ -1322,8 +1318,7 @@ xfs_get_blocks_direct(
13221318
struct buffer_head *bh_result,
13231319
int create)
13241320
{
1325-
return __xfs_get_block(inode, iblock,
1326-
bh_result->b_size >> inode->i_blkbits,
1321+
return __xfs_get_blocks(inode, iblock,
13271322
bh_result, create, 1, BMAPI_WRITE|BMAPI_DIRECT);
13281323
}
13291324

@@ -1405,7 +1400,7 @@ xfs_vm_prepare_write(
14051400
unsigned int from,
14061401
unsigned int to)
14071402
{
1408-
return block_prepare_write(page, from, to, xfs_get_block);
1403+
return block_prepare_write(page, from, to, xfs_get_blocks);
14091404
}
14101405

14111406
STATIC sector_t
@@ -1422,15 +1417,15 @@ xfs_vm_bmap(
14221417
VOP_RWLOCK(vp, VRWLOCK_READ);
14231418
VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
14241419
VOP_RWUNLOCK(vp, VRWLOCK_READ);
1425-
return generic_block_bmap(mapping, block, xfs_get_block);
1420+
return generic_block_bmap(mapping, block, xfs_get_blocks);
14261421
}
14271422

14281423
STATIC int
14291424
xfs_vm_readpage(
14301425
struct file *unused,
14311426
struct page *page)
14321427
{
1433-
return mpage_readpage(page, xfs_get_block);
1428+
return mpage_readpage(page, xfs_get_blocks);
14341429
}
14351430

14361431
STATIC int
@@ -1440,7 +1435,7 @@ xfs_vm_readpages(
14401435
struct list_head *pages,
14411436
unsigned nr_pages)
14421437
{
1443-
return mpage_readpages(mapping, pages, nr_pages, xfs_get_block);
1438+
return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks);
14441439
}
14451440

14461441
STATIC void

fs/xfs/linux-2.6/xfs_aops.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ typedef struct xfs_ioend {
4141
} xfs_ioend_t;
4242

4343
extern struct address_space_operations xfs_address_space_operations;
44-
extern int xfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
44+
extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);
4545

4646
#endif /* __XFS_IOPS_H__ */

fs/xfs/linux-2.6/xfs_iops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ STATIC void
708708
xfs_vn_truncate(
709709
struct inode *inode)
710710
{
711-
block_truncate_page(inode->i_mapping, inode->i_size, xfs_get_block);
711+
block_truncate_page(inode->i_mapping, inode->i_size, xfs_get_blocks);
712712
}
713713

714714
STATIC int

0 commit comments

Comments
 (0)