]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
reiserfs: Switch to memcpy_from_folio() bh-fixes
authorRitesh Harjani (IBM) <ritesh.list@gmail.com>
Thu, 7 Sep 2023 13:57:49 +0000 (09:57 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 7 Sep 2023 13:57:49 +0000 (09:57 -0400)
Use a modern API instead of open-coded calls to kmap/memcpy/kunmap.
Also removes a call to offset_in_page() which assumes the buffer_head
points into a single page.

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
fs/reiserfs/journal.c

index 015bfe4e452417fa8ef39b0ff727c5687cb9039f..55a105e68c411889c76d851af52042c745f0a488 100644 (file)
@@ -4205,8 +4205,6 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, int flags)
                /* copy all the real blocks into log area.  dirty log blocks */
                if (buffer_journaled(cn->bh)) {
                        struct buffer_head *tmp_bh;
-                       char *addr;
-                       struct page *page;
                        tmp_bh =
                            journal_getblk(sb,
                                           SB_ONDISK_JOURNAL_1st_BLOCK(sb) +
@@ -4214,12 +4212,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, int flags)
                                             jindex) %
                                            SB_ONDISK_JOURNAL_SIZE(sb)));
                        set_buffer_uptodate(tmp_bh);
-                       page = cn->bh->b_page;
-                       addr = kmap(page);
-                       memcpy(tmp_bh->b_data,
-                              addr + offset_in_page(cn->bh->b_data),
-                              cn->bh->b_size);
-                       kunmap(page);
+                       memcpy_from_folio(tmp_bh->b_data, cn->bh->b_folio,
+                                       bh_offset(cn->bh), cn->bh->b_size);
                        mark_buffer_dirty(tmp_bh);
                        jindex++;
                        set_buffer_journal_dirty(cn->bh);