From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: jfs-discussion@lists.sourceforge.net, linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Christoph Hellwig <hch@infradead.org>,
"Darrick J . Wong" <djwong@kernel.org>
Subject: [RFC PATCH 9/9] jfs: Convert buffered IO paths to iomap
Date: Thu, 26 May 2022 20:29:10 +0100 [thread overview]
Message-ID: <20220526192910.357055-10-willy@infradead.org> (raw)
In-Reply-To: <20220526192910.357055-1-willy@infradead.org>
Use the iomap helper functions and remove jfs_get_block().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/jfs/inode.c | 70 ++++++++-----------------------------------
fs/jfs/jfs_inode.h | 1 -
fs/jfs/jfs_logmgr.c | 1 -
fs/jfs/jfs_metapage.c | 1 -
4 files changed, 12 insertions(+), 61 deletions(-)
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 19c091d9c20e..f1d4c308e047 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -7,7 +7,6 @@
#include <linux/fs.h>
#include <linux/iomap.h>
#include <linux/mpage.h>
-#include <linux/buffer_head.h>
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/uio.h>
@@ -298,69 +297,25 @@ const struct iomap_ops jfs_iomap_ops = {
.iomap_begin = jfs_iomap_begin,
};
-int jfs_get_block(struct inode *ip, sector_t lblock,
- struct buffer_head *bh_result, int create)
-{
- struct iomap iomap = { };
- int ret;
-
- ret = jfs_iomap_begin(ip, lblock << ip->i_blkbits, bh_result->b_size,
- create ? IOMAP_WRITE : 0, &iomap, NULL);
- if (ret)
- return ret;
-
- bh_result->b_size = iomap.length;
- if (iomap.type == IOMAP_HOLE)
- return 0;
-
- map_bh(bh_result, ip->i_sb, iomap.addr >> ip->i_blkbits);
- if (iomap.flags & IOMAP_F_NEW)
- set_buffer_new(bh_result);
- return 0;
-}
-
-static int jfs_writepage(struct page *page, struct writeback_control *wbc)
-{
- return block_write_full_page(page, jfs_get_block, wbc);
-}
+static const struct iomap_writeback_ops jfs_writeback_ops = {
+};
static int jfs_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
- return mpage_writepages(mapping, wbc, jfs_get_block);
+ struct iomap_writepage_ctx wpc = { };
+
+ return iomap_writepages(mapping, wbc, &wpc, &jfs_writeback_ops);
}
static int jfs_read_folio(struct file *file, struct folio *folio)
{
- return mpage_read_folio(folio, jfs_get_block);
+ return iomap_read_folio(folio, &jfs_iomap_ops);
}
static void jfs_readahead(struct readahead_control *rac)
{
- mpage_readahead(rac, jfs_get_block);
-}
-
-static void jfs_write_failed(struct address_space *mapping, loff_t to)
-{
- struct inode *inode = mapping->host;
-
- if (to > inode->i_size) {
- truncate_pagecache(inode, inode->i_size);
- jfs_truncate(inode);
- }
-}
-
-static int jfs_write_begin(struct file *file, struct address_space *mapping,
- loff_t pos, unsigned len,
- struct page **pagep, void **fsdata)
-{
- int ret;
-
- ret = nobh_write_begin(mapping, pos, len, pagep, fsdata, jfs_get_block);
- if (unlikely(ret))
- jfs_write_failed(mapping, pos + len);
-
- return ret;
+ iomap_readahead(rac, &jfs_iomap_ops);
}
static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
@@ -369,14 +324,11 @@ static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
}
const struct address_space_operations jfs_aops = {
- .dirty_folio = block_dirty_folio,
- .invalidate_folio = block_invalidate_folio,
+ .dirty_folio = filemap_dirty_folio,
+ .invalidate_folio = iomap_invalidate_folio,
.read_folio = jfs_read_folio,
.readahead = jfs_readahead,
- .writepage = jfs_writepage,
.writepages = jfs_writepages,
- .write_begin = jfs_write_begin,
- .write_end = nobh_write_end,
.bmap = jfs_bmap,
.direct_IO = noop_direct_IO,
};
@@ -427,9 +379,11 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
void jfs_truncate(struct inode *ip)
{
+ bool did_zero;
+
jfs_info("jfs_truncate: size = 0x%lx", (ulong) ip->i_size);
- nobh_truncate_page(ip->i_mapping, ip->i_size, jfs_get_block);
+ iomap_truncate_page(ip, i_size_read(ip), &did_zero, &jfs_iomap_ops);
IWRITE_LOCK(ip, RDWRLOCK_NORMAL);
jfs_truncate_nolock(ip, ip->i_size);
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index afd12de3c341..b1d3816a1a5c 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -27,7 +27,6 @@ extern struct dentry *jfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fh_type);
extern void jfs_set_inode_flags(struct inode *);
-extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int jfs_setattr(struct user_namespace *, struct dentry *, struct iattr *);
extern const struct iomap_ops jfs_iomap_ops;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 997c81fcea34..466105331735 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -51,7 +51,6 @@
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/kthread.h>
-#include <linux/buffer_head.h> /* for sync_blockdev() */
#include <linux/bio.h>
#include <linux/freezer.h>
#include <linux/export.h>
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 5b4f0cd8d276..dd9b855092fd 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -10,7 +10,6 @@
#include <linux/bio.h>
#include <linux/slab.h>
#include <linux/init.h>
-#include <linux/buffer_head.h>
#include <linux/mempool.h>
#include <linux/seq_file.h>
#include <linux/writeback.h>
--
2.34.1
next prev parent reply other threads:[~2022-05-26 19:29 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-26 19:29 [RFC PATCH 0/9] Convert JFS to use iomap Matthew Wilcox (Oracle)
2022-05-26 19:29 ` [RFC PATCH 1/9] IOMAP_DIO_NOSYNC Matthew Wilcox (Oracle)
2022-05-27 5:35 ` Christoph Hellwig
2022-05-27 13:20 ` Matthew Wilcox
2022-05-26 19:29 ` [RFC PATCH 2/9] jfs: Add jfs_iomap_begin() Matthew Wilcox (Oracle)
2022-05-27 5:41 ` Christoph Hellwig
2022-05-27 13:45 ` Matthew Wilcox
2022-05-27 14:58 ` [Jfs-discussion] " Dave Kleikamp
2022-05-26 19:29 ` [RFC PATCH 3/9] jfs: Convert direct_IO read support to use iomap Matthew Wilcox (Oracle)
2022-05-26 19:29 ` [RFC PATCH 4/9] jfs: Convert direct_IO write " Matthew Wilcox (Oracle)
2022-05-26 19:29 ` [RFC PATCH 5/9] jfs: Remove old direct_IO support Matthew Wilcox (Oracle)
2022-05-26 19:29 ` [RFC PATCH 6/9] jfs: Handle bmap with iomap Matthew Wilcox (Oracle)
2022-05-26 19:29 ` [RFC PATCH 7/9] jfs: Read quota through the page cache Matthew Wilcox (Oracle)
2022-05-27 5:43 ` Christoph Hellwig
2022-05-27 13:56 ` Matthew Wilcox
2022-06-03 14:40 ` generic_quota_read Matthew Wilcox
2022-06-06 7:37 ` generic_quota_read Jan Kara
2022-05-26 19:29 ` [RFC PATCH 8/9] jfs: Write quota through the page cache Matthew Wilcox (Oracle)
2022-05-27 5:46 ` Christoph Hellwig
2022-05-26 19:29 ` Matthew Wilcox (Oracle) [this message]
2022-05-28 0:02 ` [RFC PATCH 0/9] Convert JFS to use iomap Dave Chinner
2022-05-28 2:15 ` Matthew Wilcox
2022-05-28 5:36 ` Dave Chinner
2022-05-28 18:59 ` Theodore Ts'o
2022-05-29 23:51 ` Dave Chinner
2022-05-31 13:51 ` [Jfs-discussion] " Dave Kleikamp
2022-05-31 15:31 ` Matthew Wilcox
2022-05-31 15:56 ` Dave Kleikamp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220526192910.357055-10-willy@infradead.org \
--to=willy@infradead.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).