Skip to content

Commit de5ced2

Browse files
Matthew Wilcox (Oracle)brauner
authored andcommitted
ecryptfs: Convert ecryptfs_write_lower_page_segment() to take a folio
Both callers now have a folio, so pass it in and use it throughout. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 4d3727f commit de5ced2

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

fs/ecryptfs/ecryptfs_kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key,
653653
int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
654654
loff_t offset, size_t size);
655655
int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
656-
struct page *page_for_lower,
656+
struct folio *folio_for_lower,
657657
size_t offset_in_page, size_t size);
658658
int ecryptfs_write(struct inode *inode, char *data, loff_t offset, size_t size);
659659
int ecryptfs_read_lower(char *data, loff_t offset, size_t size,

fs/ecryptfs/mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int ecryptfs_write_end(struct file *file,
454454
"(page w/ index = [0x%.16lx], to = [%d])\n", index, to);
455455
if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
456456
rc = ecryptfs_write_lower_page_segment(ecryptfs_inode,
457-
&folio->page, 0, to);
457+
folio, 0, to);
458458
if (!rc) {
459459
rc = copied;
460460
fsstack_copy_inode_size(ecryptfs_inode,

fs/ecryptfs/read_write.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,29 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
4141
/**
4242
* ecryptfs_write_lower_page_segment
4343
* @ecryptfs_inode: The eCryptfs inode
44-
* @page_for_lower: The page containing the data to be written to the
44+
* @folio_for_lower: The folio containing the data to be written to the
4545
* lower file
46-
* @offset_in_page: The offset in the @page_for_lower from which to
46+
* @offset_in_page: The offset in the @folio_for_lower from which to
4747
* start writing the data
48-
* @size: The amount of data from @page_for_lower to write to the
48+
* @size: The amount of data from @folio_for_lower to write to the
4949
* lower file
5050
*
5151
* Determines the byte offset in the file for the given page and
5252
* offset within the page, maps the page, and makes the call to write
53-
* the contents of @page_for_lower to the lower inode.
53+
* the contents of @folio_for_lower to the lower inode.
5454
*
5555
* Returns zero on success; non-zero otherwise
5656
*/
5757
int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode,
58-
struct page *page_for_lower,
58+
struct folio *folio_for_lower,
5959
size_t offset_in_page, size_t size)
6060
{
6161
char *virt;
6262
loff_t offset;
6363
int rc;
6464

65-
offset = ((((loff_t)page_for_lower->index) << PAGE_SHIFT)
66-
+ offset_in_page);
67-
virt = kmap_local_page(page_for_lower);
65+
offset = (loff_t)folio_for_lower->index * PAGE_SIZE + offset_in_page;
66+
virt = kmap_local_folio(folio_for_lower, 0);
6867
rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size);
6968
if (rc > 0)
7069
rc = 0;
@@ -172,7 +171,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
172171
rc = ecryptfs_encrypt_page(&ecryptfs_folio->page);
173172
else
174173
rc = ecryptfs_write_lower_page_segment(ecryptfs_inode,
175-
&ecryptfs_folio->page,
174+
ecryptfs_folio,
176175
start_offset_in_page,
177176
data_offset);
178177
folio_put(ecryptfs_folio);

0 commit comments

Comments
 (0)