diff options
author | Jan Kara <jack@suse.cz> | 2023-01-25 10:33:37 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 16:46:37 +0100 |
commit | 1eeceaec794ef937d161379d89504990c82133ad (patch) | |
tree | 72fd99934b99302829d923710b462e20cb79f875 /fs/udf | |
parent | 5cfc45321a6d81c2587b38f26187dbe0018c6b04 (diff) |
udf: Convert udf_expand_file_adinicb() to avoid kmap_atomic()
Remove the last two remaining kmap_atomic() uses in UDF in
udf_expand_file_adinicb(). The first use can be actually conveniently
replaced with udf_adinicb_readpage(), the second with memcpy_to_page().
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 1d661faffde0..3b2adf4cbc57 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -336,7 +336,6 @@ const struct address_space_operations udf_aops = { int udf_expand_file_adinicb(struct inode *inode) { struct page *page; - char *kaddr; struct udf_inode_info *iinfo = UDF_I(inode); int err; @@ -358,16 +357,8 @@ int udf_expand_file_adinicb(struct inode *inode) if (!page) return -ENOMEM; - if (!PageUptodate(page)) { - kaddr = kmap_atomic(page); - memset(kaddr + iinfo->i_lenAlloc, 0x00, - PAGE_SIZE - iinfo->i_lenAlloc); - memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, - iinfo->i_lenAlloc); - flush_dcache_page(page); - SetPageUptodate(page); - kunmap_atomic(kaddr); - } + if (!PageUptodate(page)) + udf_adinicb_readpage(page); down_write(&iinfo->i_data_sem); memset(iinfo->i_data + iinfo->i_lenEAttr, 0x00, iinfo->i_lenAlloc); @@ -384,9 +375,8 @@ int udf_expand_file_adinicb(struct inode *inode) /* Restore everything back so that we don't lose data... */ lock_page(page); down_write(&iinfo->i_data_sem); - kaddr = kmap_atomic(page); - memcpy(iinfo->i_data + iinfo->i_lenEAttr, kaddr, inode->i_size); - kunmap_atomic(kaddr); + memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr, + inode->i_size); unlock_page(page); iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; iinfo->i_lenAlloc = inode->i_size; |