Skip to content

Commit cf948cb

Browse files
author
Matthew Wilcox (Oracle)
committed
cramfs: read_mapping_page() is synchronous
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) <[email protected]>
1 parent 97a3a38 commit cf948cb

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

fs/cramfs/inode.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
183183
unsigned int len)
184184
{
185185
struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
186+
struct file_ra_state ra;
186187
struct page *pages[BLKS_PER_BUF];
187188
unsigned i, blocknr, buffer;
188189
unsigned long devsize;
@@ -212,6 +213,9 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
212213
devsize = bdev_nr_bytes(sb->s_bdev) >> PAGE_SHIFT;
213214

214215
/* Ok, read in BLKS_PER_BUF pages completely first. */
216+
file_ra_state_init(&ra, mapping);
217+
page_cache_sync_readahead(mapping, &ra, NULL, blocknr, BLKS_PER_BUF);
218+
215219
for (i = 0; i < BLKS_PER_BUF; i++) {
216220
struct page *page = NULL;
217221

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

227-
for (i = 0; i < BLKS_PER_BUF; i++) {
228-
struct page *page = pages[i];
229-
230-
if (page) {
231-
wait_on_page_locked(page);
232-
if (!PageUptodate(page)) {
233-
/* asynchronous error */
234-
put_page(page);
235-
pages[i] = NULL;
236-
}
237-
}
238-
}
239-
240231
buffer = next_buffer;
241232
next_buffer = NEXT_BUFFER(buffer);
242233
buffer_blocknr[buffer] = blocknr;

0 commit comments

Comments
 (0)