Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocfs2: use memcpy_to_folio() in ocfs2_symlink_get_block()

Replace use of kmap_atomic() with the higher-level construct
memcpy_to_folio(). This removes a use of b_page and supports large folios
as well as being easier to understand. It also removes the check for
kmap_atomic() failing (because it can't).

Link: https://lkml.kernel.org/r/20250213214533.2242224-1-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Tinguely <mark.tinguely@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
dbc3b632 a406aff8

+5 -12
+5 -12
fs/ocfs2/aops.c
··· 46 46 struct buffer_head *bh = NULL; 47 47 struct buffer_head *buffer_cache_bh = NULL; 48 48 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 49 - void *kaddr; 50 49 51 50 trace_ocfs2_symlink_get_block( 52 51 (unsigned long long)OCFS2_I(inode)->ip_blkno, ··· 90 91 * could've happened. Since we've got a reference on 91 92 * the bh, even if it commits while we're doing the 92 93 * copy, the data is still good. */ 93 - if (buffer_jbd(buffer_cache_bh) 94 - && ocfs2_inode_is_new(inode)) { 95 - kaddr = kmap_atomic(bh_result->b_page); 96 - if (!kaddr) { 97 - mlog(ML_ERROR, "couldn't kmap!\n"); 98 - goto bail; 99 - } 100 - memcpy(kaddr + (bh_result->b_size * iblock), 101 - buffer_cache_bh->b_data, 102 - bh_result->b_size); 103 - kunmap_atomic(kaddr); 94 + if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) { 95 + memcpy_to_folio(bh_result->b_folio, 96 + bh_result->b_size * iblock, 97 + buffer_cache_bh->b_data, 98 + bh_result->b_size); 104 99 set_buffer_uptodate(bh_result); 105 100 } 106 101 brelse(buffer_cache_bh);