* [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block()
@ 2025-02-13 21:45 Matthew Wilcox (Oracle)
2025-02-13 21:45 ` [PATCH 2/2] ocfs2: Remove reference to bh->b_page Matthew Wilcox (Oracle)
2025-02-14 1:32 ` [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Joseph Qi
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2025-02-13 21:45 UTC (permalink / raw)
To: Joseph Qi
Cc: Matthew Wilcox (Oracle), Mark Tinguely, ocfs2-devel,
linux-fsdevel
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).
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ocfs2/aops.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 5bbeb6fbb1ac..ccf2930cd2e6 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -46,7 +46,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh = NULL;
struct buffer_head *buffer_cache_bh = NULL;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
- void *kaddr;
trace_ocfs2_symlink_get_block(
(unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -91,17 +90,11 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
* could've happened. Since we've got a reference on
* the bh, even if it commits while we're doing the
* copy, the data is still good. */
- if (buffer_jbd(buffer_cache_bh)
- && ocfs2_inode_is_new(inode)) {
- kaddr = kmap_atomic(bh_result->b_page);
- if (!kaddr) {
- mlog(ML_ERROR, "couldn't kmap!\n");
- goto bail;
- }
- memcpy(kaddr + (bh_result->b_size * iblock),
- buffer_cache_bh->b_data,
- bh_result->b_size);
- kunmap_atomic(kaddr);
+ if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
+ memcpy_to_folio(bh_result->b_folio,
+ bh_result->b_size * iblock,
+ buffer_cache_bh->b_data,
+ bh_result->b_size);
set_buffer_uptodate(bh_result);
}
brelse(buffer_cache_bh);
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ocfs2: Remove reference to bh->b_page
2025-02-13 21:45 [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Matthew Wilcox (Oracle)
@ 2025-02-13 21:45 ` Matthew Wilcox (Oracle)
2025-02-14 1:34 ` Joseph Qi
2025-02-14 1:32 ` [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Joseph Qi
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2025-02-13 21:45 UTC (permalink / raw)
To: Joseph Qi
Cc: Matthew Wilcox (Oracle), Mark Tinguely, ocfs2-devel,
linux-fsdevel
Buffer heads are attached to folios, not to pages. Also
flush_dcache_page() is now deprecated in favour of flush_dcache_folio().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ocfs2/quota_global.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 15d9acd456ec..e85b1ccf81be 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -273,7 +273,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
if (new)
memset(bh->b_data, 0, sb->s_blocksize);
memcpy(bh->b_data + offset, data, len);
- flush_dcache_page(bh->b_page);
+ flush_dcache_folio(bh->b_folio);
set_buffer_uptodate(bh);
unlock_buffer(bh);
ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh);
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block()
2025-02-13 21:45 [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Matthew Wilcox (Oracle)
2025-02-13 21:45 ` [PATCH 2/2] ocfs2: Remove reference to bh->b_page Matthew Wilcox (Oracle)
@ 2025-02-14 1:32 ` Joseph Qi
1 sibling, 0 replies; 4+ messages in thread
From: Joseph Qi @ 2025-02-14 1:32 UTC (permalink / raw)
To: Matthew Wilcox (Oracle), akpm; +Cc: Mark Tinguely, ocfs2-devel, linux-fsdevel
On 2025/2/14 05:45, Matthew Wilcox (Oracle) wrote:
> 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).
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> fs/ocfs2/aops.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index 5bbeb6fbb1ac..ccf2930cd2e6 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -46,7 +46,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
> struct buffer_head *bh = NULL;
> struct buffer_head *buffer_cache_bh = NULL;
> struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
> - void *kaddr;
>
> trace_ocfs2_symlink_get_block(
> (unsigned long long)OCFS2_I(inode)->ip_blkno,
> @@ -91,17 +90,11 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
> * could've happened. Since we've got a reference on
> * the bh, even if it commits while we're doing the
> * copy, the data is still good. */
> - if (buffer_jbd(buffer_cache_bh)
> - && ocfs2_inode_is_new(inode)) {
> - kaddr = kmap_atomic(bh_result->b_page);
> - if (!kaddr) {
> - mlog(ML_ERROR, "couldn't kmap!\n");
> - goto bail;
> - }
> - memcpy(kaddr + (bh_result->b_size * iblock),
> - buffer_cache_bh->b_data,
> - bh_result->b_size);
> - kunmap_atomic(kaddr);
> + if (buffer_jbd(buffer_cache_bh) && ocfs2_inode_is_new(inode)) {
> + memcpy_to_folio(bh_result->b_folio,
> + bh_result->b_size * iblock,
> + buffer_cache_bh->b_data,
> + bh_result->b_size);
> set_buffer_uptodate(bh_result);
> }
> brelse(buffer_cache_bh);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ocfs2: Remove reference to bh->b_page
2025-02-13 21:45 ` [PATCH 2/2] ocfs2: Remove reference to bh->b_page Matthew Wilcox (Oracle)
@ 2025-02-14 1:34 ` Joseph Qi
0 siblings, 0 replies; 4+ messages in thread
From: Joseph Qi @ 2025-02-14 1:34 UTC (permalink / raw)
To: Matthew Wilcox (Oracle), akpm; +Cc: Mark Tinguely, ocfs2-devel, linux-fsdevel
On 2025/2/14 05:45, Matthew Wilcox (Oracle) wrote:
> Buffer heads are attached to folios, not to pages. Also
> flush_dcache_page() is now deprecated in favour of flush_dcache_folio().
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
> ---
> fs/ocfs2/quota_global.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
> index 15d9acd456ec..e85b1ccf81be 100644
> --- a/fs/ocfs2/quota_global.c
> +++ b/fs/ocfs2/quota_global.c
> @@ -273,7 +273,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type,
> if (new)
> memset(bh->b_data, 0, sb->s_blocksize);
> memcpy(bh->b_data + offset, data, len);
> - flush_dcache_page(bh->b_page);
> + flush_dcache_folio(bh->b_folio);
> set_buffer_uptodate(bh);
> unlock_buffer(bh);
> ocfs2_set_buffer_uptodate(INODE_CACHE(gqinode), bh);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-14 1:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 21:45 [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Matthew Wilcox (Oracle)
2025-02-13 21:45 ` [PATCH 2/2] ocfs2: Remove reference to bh->b_page Matthew Wilcox (Oracle)
2025-02-14 1:34 ` Joseph Qi
2025-02-14 1:32 ` [PATCH 1/2] ocfs2: Use memcpy_to_folio() in ocfs2_symlink_get_block() Joseph Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).