Skip to content

Commit 10d83e1

Browse files
cmaiolinoAl Viro
authored andcommitted
cachefiles: drop direct usage of ->bmap method.
Replace the direct usage of ->bmap method by a bmap() call. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 30460e1 commit 10d83e1

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

fs/cachefiles/rdwr.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
396396
struct cachefiles_object *object;
397397
struct cachefiles_cache *cache;
398398
struct inode *inode;
399-
sector_t block0, block;
399+
sector_t block;
400400
unsigned shift;
401401
int ret;
402402

@@ -412,7 +412,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
412412

413413
inode = d_backing_inode(object->backer);
414414
ASSERT(S_ISREG(inode->i_mode));
415-
ASSERT(inode->i_mapping->a_ops->bmap);
416415
ASSERT(inode->i_mapping->a_ops->readpages);
417416

418417
/* calculate the shift required to use bmap */
@@ -428,12 +427,14 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
428427
* enough for this as it doesn't indicate errors, but it's all we've
429428
* got for the moment
430429
*/
431-
block0 = page->index;
432-
block0 <<= shift;
430+
block = page->index;
431+
block <<= shift;
432+
433+
ret = bmap(inode, &block);
434+
ASSERT(ret < 0);
433435

434-
block = inode->i_mapping->a_ops->bmap(inode->i_mapping, block0);
435436
_debug("%llx -> %llx",
436-
(unsigned long long) block0,
437+
(unsigned long long) (page->index << shift),
437438
(unsigned long long) block);
438439

439440
if (block) {
@@ -711,7 +712,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
711712

712713
inode = d_backing_inode(object->backer);
713714
ASSERT(S_ISREG(inode->i_mode));
714-
ASSERT(inode->i_mapping->a_ops->bmap);
715715
ASSERT(inode->i_mapping->a_ops->readpages);
716716

717717
/* calculate the shift required to use bmap */
@@ -728,21 +728,22 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op,
728728

729729
ret = space ? -ENODATA : -ENOBUFS;
730730
list_for_each_entry_safe(page, _n, pages, lru) {
731-
sector_t block0, block;
731+
sector_t block;
732732

733733
/* we assume the absence or presence of the first block is a
734734
* good enough indication for the page as a whole
735735
* - TODO: don't use bmap() for this as it is _not_ actually
736736
* good enough for this as it doesn't indicate errors, but
737737
* it's all we've got for the moment
738738
*/
739-
block0 = page->index;
740-
block0 <<= shift;
739+
block = page->index;
740+
block <<= shift;
741+
742+
ret = bmap(inode, &block);
743+
ASSERT(!ret);
741744

742-
block = inode->i_mapping->a_ops->bmap(inode->i_mapping,
743-
block0);
744745
_debug("%llx -> %llx",
745-
(unsigned long long) block0,
746+
(unsigned long long) (page->index << shift),
746747
(unsigned long long) block);
747748

748749
if (block) {

0 commit comments

Comments
 (0)