32
32
33
33
static int squashfs_symlink_read_folio (struct file * file , struct folio * folio )
34
34
{
35
- struct page * page = & folio -> page ;
36
- struct inode * inode = page -> mapping -> host ;
35
+ struct inode * inode = folio -> mapping -> host ;
37
36
struct super_block * sb = inode -> i_sb ;
38
37
struct squashfs_sb_info * msblk = sb -> s_fs_info ;
39
- int index = page -> index << PAGE_SHIFT ;
38
+ int index = folio_pos ( folio ) ;
40
39
u64 block = squashfs_i (inode )-> start ;
41
40
int offset = squashfs_i (inode )-> offset ;
42
41
int length = min_t (int , i_size_read (inode ) - index , PAGE_SIZE );
43
- int bytes , copied ;
42
+ int bytes , copied , error ;
44
43
void * pageaddr ;
45
44
struct squashfs_cache_entry * entry ;
46
45
47
46
TRACE ("Entered squashfs_symlink_readpage, page index %ld, start block "
48
- "%llx, offset %x\n" , page -> index , block , offset );
47
+ "%llx, offset %x\n" , folio -> index , block , offset );
49
48
50
49
/*
51
50
* Skip index bytes into symlink metadata.
@@ -57,14 +56,15 @@ static int squashfs_symlink_read_folio(struct file *file, struct folio *folio)
57
56
ERROR ("Unable to read symlink [%llx:%x]\n" ,
58
57
squashfs_i (inode )-> start ,
59
58
squashfs_i (inode )-> offset );
60
- goto error_out ;
59
+ error = bytes ;
60
+ goto out ;
61
61
}
62
62
}
63
63
64
64
/*
65
65
* Read length bytes from symlink metadata. Squashfs_read_metadata
66
66
* is not used here because it can sleep and we want to use
67
- * kmap_atomic to map the page . Instead call the underlying
67
+ * kmap_local to map the folio . Instead call the underlying
68
68
* squashfs_cache_get routine. As length bytes may overlap metadata
69
69
* blocks, we may need to call squashfs_cache_get multiple times.
70
70
*/
@@ -75,29 +75,26 @@ static int squashfs_symlink_read_folio(struct file *file, struct folio *folio)
75
75
squashfs_i (inode )-> start ,
76
76
squashfs_i (inode )-> offset );
77
77
squashfs_cache_put (entry );
78
- goto error_out ;
78
+ error = entry -> error ;
79
+ goto out ;
79
80
}
80
81
81
- pageaddr = kmap_atomic ( page );
82
+ pageaddr = kmap_local_folio ( folio , 0 );
82
83
copied = squashfs_copy_data (pageaddr + bytes , entry , offset ,
83
84
length - bytes );
84
85
if (copied == length - bytes )
85
86
memset (pageaddr + length , 0 , PAGE_SIZE - length );
86
87
else
87
88
block = entry -> next_index ;
88
- kunmap_atomic (pageaddr );
89
+ kunmap_local (pageaddr );
89
90
squashfs_cache_put (entry );
90
91
}
91
92
92
- flush_dcache_page (page );
93
- SetPageUptodate (page );
94
- unlock_page (page );
95
- return 0 ;
96
-
97
- error_out :
98
- SetPageError (page );
99
- unlock_page (page );
100
- return 0 ;
93
+ flush_dcache_folio (folio );
94
+ error = 0 ;
95
+ out :
96
+ folio_end_read (folio , error == 0 );
97
+ return error ;
101
98
}
102
99
103
100
0 commit comments