Skip to content

Commit

Permalink
cramfs: read_mapping_page() is synchronous
Browse files Browse the repository at this point in the history
Since commit 67f9fd9, the code to wait for the read to complete has
been dead.  That commit wrongly stated that the read was synchronous
already; this seems to have been a confusion about which ->readpage
operation was being called.  Instead of reintroducing an asynchronous
version of read_mapping_page(), call the readahead code directly to
submit all reads first before waiting for them in read_mapping_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
  • Loading branch information
Matthew Wilcox (Oracle) committed Aug 2, 2022
1 parent 97a3a38 commit cf948cb
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions fs/cramfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
unsigned int len)
{
struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
struct file_ra_state ra;
struct page *pages[BLKS_PER_BUF];
unsigned i, blocknr, buffer;
unsigned long devsize;
Expand Down Expand Up @@ -212,6 +213,9 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
devsize = bdev_nr_bytes(sb->s_bdev) >> PAGE_SHIFT;

/* Ok, read in BLKS_PER_BUF pages completely first. */
file_ra_state_init(&ra, mapping);
page_cache_sync_readahead(mapping, &ra, NULL, blocknr, BLKS_PER_BUF);

for (i = 0; i < BLKS_PER_BUF; i++) {
struct page *page = NULL;

Expand All @@ -224,19 +228,6 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
pages[i] = page;
}

for (i = 0; i < BLKS_PER_BUF; i++) {
struct page *page = pages[i];

if (page) {
wait_on_page_locked(page);
if (!PageUptodate(page)) {
/* asynchronous error */
put_page(page);
pages[i] = NULL;
}
}
}

buffer = next_buffer;
next_buffer = NEXT_BUFFER(buffer);
buffer_blocknr[buffer] = blocknr;
Expand Down

0 comments on commit cf948cb

Please sign in to comment.