* [PATCH 1/5] ufs: Convert ufs_inode_getblock() to take a folio
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
@ 2024-10-05 18:02 ` Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 2/5] ufs: Convert ufs_extend_tail() " Matthew Wilcox (Oracle)
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-05 18:02 UTC (permalink / raw)
To: Alexander Viro; +Cc: Matthew Wilcox (Oracle), linux-fsdevel
Pass bh->b_folio instead of bh->b_page. They're in a union, so no
code change expected.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ufs/inode.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 5331ae7ebf3e..aad3bdd4422f 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -329,12 +329,11 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
* (block will hold this fragment and also uspi->s_fpb-1)
* @err: see ufs_inode_getfrag()
* @new: see ufs_inode_getfrag()
- * @locked_page: see ufs_inode_getfrag()
+ * @locked_folio: see ufs_inode_getfrag()
*/
-static u64
-ufs_inode_getblock(struct inode *inode, u64 ind_block,
- unsigned index, sector_t new_fragment, int *err,
- int *new, struct page *locked_page)
+static u64 ufs_inode_getblock(struct inode *inode, u64 ind_block,
+ unsigned index, sector_t new_fragment, int *err,
+ int *new, struct folio *locked_folio)
{
struct super_block *sb = inode->i_sb;
struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
@@ -369,7 +368,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
else
goal = bh->b_blocknr + uspi->s_fpb;
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal,
- uspi->s_fpb, err, locked_page);
+ uspi->s_fpb, err, &locked_folio->page);
if (!tmp)
goto out;
@@ -450,7 +449,7 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
phys64 = ufs_inode_getblock(inode, phys64, offsets[i],
fragment, &err, NULL, NULL);
phys64 = ufs_inode_getblock(inode, phys64, offsets[depth - 1],
- fragment, &err, &new, bh_result->b_page);
+ fragment, &err, &new, bh_result->b_folio);
}
out:
if (phys64) {
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] ufs: Convert ufs_extend_tail() to take a folio
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 1/5] ufs: Convert ufs_inode_getblock() to take a folio Matthew Wilcox (Oracle)
@ 2024-10-05 18:02 ` Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 3/5] ufs: Convert ufs_inode_getfrag() " Matthew Wilcox (Oracle)
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-05 18:02 UTC (permalink / raw)
To: Alexander Viro; +Cc: Matthew Wilcox (Oracle), linux-fsdevel
Pass bh->b_folio instead of bh->b_page. They're in a union, so no
code change expected.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ufs/inode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index aad3bdd4422f..937d3b787d1e 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -220,7 +220,7 @@ static u64 ufs_frag_map(struct inode *inode, unsigned offsets[4], int depth)
*/
static bool
ufs_extend_tail(struct inode *inode, u64 writes_to,
- int *err, struct page *locked_page)
+ int *err, struct folio *locked_folio)
{
struct ufs_inode_info *ufsi = UFS_I(inode);
struct super_block *sb = inode->i_sb;
@@ -239,7 +239,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
p = ufs_get_direct_data_ptr(uspi, ufsi, block);
tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p),
new_size - (lastfrag & uspi->s_fpbmask), err,
- locked_page);
+ &locked_folio->page);
return tmp != 0;
}
@@ -433,7 +433,7 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
unsigned tailfrags = lastfrag & uspi->s_fpbmask;
if (tailfrags && fragment >= lastfrag) {
if (!ufs_extend_tail(inode, fragment,
- &err, bh_result->b_page))
+ &err, bh_result->b_folio))
goto out;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] ufs: Convert ufs_inode_getfrag() to take a folio
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 1/5] ufs: Convert ufs_inode_getblock() to take a folio Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 2/5] ufs: Convert ufs_extend_tail() " Matthew Wilcox (Oracle)
@ 2024-10-05 18:02 ` Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 4/5] ufs: Pass a folio to ufs_new_fragments() Matthew Wilcox (Oracle)
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-05 18:02 UTC (permalink / raw)
To: Alexander Viro; +Cc: Matthew Wilcox (Oracle), linux-fsdevel
Pass bh->b_folio instead of bh->b_page. They're in a union, so no
code change expected.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ufs/inode.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 937d3b787d1e..a2be1bd301ee 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -252,10 +252,9 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
* @new: we set it if we allocate new block
* @locked_page: for ufs_new_fragments()
*/
-static u64
-ufs_inode_getfrag(struct inode *inode, unsigned index,
+static u64 ufs_inode_getfrag(struct inode *inode, unsigned index,
sector_t new_fragment, int *err,
- int *new, struct page *locked_page)
+ int *new, struct folio *locked_folio)
{
struct ufs_inode_info *ufsi = UFS_I(inode);
struct super_block *sb = inode->i_sb;
@@ -288,7 +287,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
goal += uspi->s_fpb;
}
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment),
- goal, nfrags, err, locked_page);
+ goal, nfrags, err, &locked_folio->page);
if (!tmp) {
*err = -ENOSPC;
@@ -440,7 +439,7 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff
if (depth == 1) {
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
- &err, &new, bh_result->b_page);
+ &err, &new, bh_result->b_folio);
} else {
int i;
phys64 = ufs_inode_getfrag(inode, offsets[0], fragment,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] ufs: Pass a folio to ufs_new_fragments()
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
` (2 preceding siblings ...)
2024-10-05 18:02 ` [PATCH 3/5] ufs: Convert ufs_inode_getfrag() " Matthew Wilcox (Oracle)
@ 2024-10-05 18:02 ` Matthew Wilcox (Oracle)
2024-10-05 18:02 ` [PATCH 5/5] ufs: Convert ufs_change_blocknr() to take a folio Matthew Wilcox (Oracle)
2024-10-05 18:31 ` [PATCH 0/5] UFS: Final folio conversions Al Viro
5 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-05 18:02 UTC (permalink / raw)
To: Alexander Viro; +Cc: Matthew Wilcox (Oracle), linux-fsdevel
All callers now have a folio, pass it to ufs_new_fragments() instead
of converting back to a page.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ufs/balloc.c | 10 +++++-----
fs/ufs/inode.c | 8 ++++----
fs/ufs/ufs.h | 8 ++++----
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 53c11be2b2c1..2abe13d07f85 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -337,7 +337,7 @@ static void ufs_clear_frags(struct inode *inode, sector_t beg, unsigned int n,
u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
u64 goal, unsigned count, int *err,
- struct page *locked_page)
+ struct folio *locked_folio)
{
struct super_block * sb;
struct ufs_sb_private_info * uspi;
@@ -417,7 +417,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
result = ufs_alloc_fragments (inode, cgno, goal, count, err);
if (result) {
ufs_clear_frags(inode, result + oldcount,
- newcount - oldcount, locked_page != NULL);
+ newcount - oldcount, locked_folio != NULL);
*err = 0;
write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result);
@@ -441,7 +441,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
fragment + count);
read_sequnlock_excl(&UFS_I(inode)->meta_lock);
ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
- locked_page != NULL);
+ locked_folio != NULL);
mutex_unlock(&UFS_SB(sb)->s_lock);
UFSD("EXIT, result %llu\n", (unsigned long long)result);
return result;
@@ -462,11 +462,11 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
result = ufs_alloc_fragments (inode, cgno, goal, request, err);
if (result) {
ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
- locked_page != NULL);
+ locked_folio != NULL);
mutex_unlock(&UFS_SB(sb)->s_lock);
ufs_change_blocknr(inode, fragment - oldcount, oldcount,
uspi->s_sbbase + tmp,
- uspi->s_sbbase + result, locked_page);
+ uspi->s_sbbase + result, &locked_folio->page);
*err = 0;
write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index a2be1bd301ee..b9359fd95d00 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -239,7 +239,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
p = ufs_get_direct_data_ptr(uspi, ufsi, block);
tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p),
new_size - (lastfrag & uspi->s_fpbmask), err,
- &locked_folio->page);
+ locked_folio);
return tmp != 0;
}
@@ -250,7 +250,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
* @new_fragment: number of new allocated fragment(s)
* @err: we set it if something wrong
* @new: we set it if we allocate new block
- * @locked_page: for ufs_new_fragments()
+ * @locked_folio: for ufs_new_fragments()
*/
static u64 ufs_inode_getfrag(struct inode *inode, unsigned index,
sector_t new_fragment, int *err,
@@ -287,7 +287,7 @@ static u64 ufs_inode_getfrag(struct inode *inode, unsigned index,
goal += uspi->s_fpb;
}
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment),
- goal, nfrags, err, &locked_folio->page);
+ goal, nfrags, err, locked_folio);
if (!tmp) {
*err = -ENOSPC;
@@ -367,7 +367,7 @@ static u64 ufs_inode_getblock(struct inode *inode, u64 ind_block,
else
goal = bh->b_blocknr + uspi->s_fpb;
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal,
- uspi->s_fpb, err, &locked_folio->page);
+ uspi->s_fpb, err, locked_folio);
if (!tmp)
goto out;
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h
index a2c762cb65a0..9b462c62511f 100644
--- a/fs/ufs/ufs.h
+++ b/fs/ufs/ufs.h
@@ -88,10 +88,10 @@ struct ufs_inode_info {
#endif
/* balloc.c */
-extern void ufs_free_fragments (struct inode *, u64, unsigned);
-extern void ufs_free_blocks (struct inode *, u64, unsigned);
-extern u64 ufs_new_fragments(struct inode *, void *, u64, u64,
- unsigned, int *, struct page *);
+void ufs_free_fragments (struct inode *, u64 fragment, unsigned count);
+void ufs_free_blocks (struct inode *, u64 fragment, unsigned count);
+u64 ufs_new_fragments(struct inode *, void *, u64 fragment, u64 goal,
+ unsigned count, int *err, struct folio *);
/* cylinder.c */
extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/5] ufs: Convert ufs_change_blocknr() to take a folio
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
` (3 preceding siblings ...)
2024-10-05 18:02 ` [PATCH 4/5] ufs: Pass a folio to ufs_new_fragments() Matthew Wilcox (Oracle)
@ 2024-10-05 18:02 ` Matthew Wilcox (Oracle)
2024-10-05 18:31 ` [PATCH 0/5] UFS: Final folio conversions Al Viro
5 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox (Oracle) @ 2024-10-05 18:02 UTC (permalink / raw)
To: Alexander Viro; +Cc: Matthew Wilcox (Oracle), linux-fsdevel
Now that ufs_new_fragments() has a folio, pass it to ufs_change_blocknr()
as a folio instead of converting it from folio to page to folio.
This removes the last use of struct page in UFS.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ufs/balloc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 2abe13d07f85..8709954adb2a 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -234,13 +234,13 @@ void ufs_free_blocks(struct inode *inode, u64 fragment, unsigned count)
* situated at the end of file.
*
* We can come here from ufs_writepage or ufs_prepare_write,
- * locked_page is argument of these functions, so we already lock it.
+ * locked_folio is argument of these functions, so we already lock it.
*/
static void ufs_change_blocknr(struct inode *inode, sector_t beg,
unsigned int count, sector_t oldb,
- sector_t newb, struct page *locked_page)
+ sector_t newb, struct folio *locked_folio)
{
- struct folio *folio, *locked_folio = page_folio(locked_page);
+ struct folio *folio;
const unsigned blks_per_page =
1 << (PAGE_SHIFT - inode->i_blkbits);
const unsigned mask = blks_per_page - 1;
@@ -466,7 +466,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
mutex_unlock(&UFS_SB(sb)->s_lock);
ufs_change_blocknr(inode, fragment - oldcount, oldcount,
uspi->s_sbbase + tmp,
- uspi->s_sbbase + result, &locked_folio->page);
+ uspi->s_sbbase + result, locked_folio);
*err = 0;
write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result);
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] UFS: Final folio conversions
2024-10-05 18:02 [PATCH 0/5] UFS: Final folio conversions Matthew Wilcox (Oracle)
` (4 preceding siblings ...)
2024-10-05 18:02 ` [PATCH 5/5] ufs: Convert ufs_change_blocknr() to take a folio Matthew Wilcox (Oracle)
@ 2024-10-05 18:31 ` Al Viro
2024-10-05 21:21 ` Al Viro
5 siblings, 1 reply; 8+ messages in thread
From: Al Viro @ 2024-10-05 18:31 UTC (permalink / raw)
To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel
On Sat, Oct 05, 2024 at 07:02:03PM +0100, Matthew Wilcox (Oracle) wrote:
> This is the last use of struct page I've been able to find in UFS.
> All the hard work was done earlier; this is just passing in bh->b_folio
> instead of bh->b_page.
>
> Matthew Wilcox (Oracle) (5):
> ufs: Convert ufs_inode_getblock() to take a folio
> ufs: Convert ufs_extend_tail() to take a folio
> ufs: Convert ufs_inode_getfrag() to take a folio
> ufs: Pass a folio to ufs_new_fragments()
> ufs: Convert ufs_change_blocknr() to take a folio
>
> fs/ufs/balloc.c | 16 ++++++++--------
> fs/ufs/inode.c | 30 ++++++++++++++----------------
> fs/ufs/ufs.h | 8 ++++----
> 3 files changed, 26 insertions(+), 28 deletions(-)
Looks sane (for now - there's really interesting shite around the block
relocation, hole filling, etc.); I've got a bunch of UFS patches and IMO
it makes sense to keep it in the same branch. Mine is in #work.ufs
and there's pending work locally.
I'll add yours to the mix and see if xfstests catch any problems there;
will post tonight.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] UFS: Final folio conversions
2024-10-05 18:31 ` [PATCH 0/5] UFS: Final folio conversions Al Viro
@ 2024-10-05 21:21 ` Al Viro
0 siblings, 0 replies; 8+ messages in thread
From: Al Viro @ 2024-10-05 21:21 UTC (permalink / raw)
To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel
On Sat, Oct 05, 2024 at 07:31:08PM +0100, Al Viro wrote:
> On Sat, Oct 05, 2024 at 07:02:03PM +0100, Matthew Wilcox (Oracle) wrote:
> > This is the last use of struct page I've been able to find in UFS.
> > All the hard work was done earlier; this is just passing in bh->b_folio
> > instead of bh->b_page.
> >
> > Matthew Wilcox (Oracle) (5):
> > ufs: Convert ufs_inode_getblock() to take a folio
> > ufs: Convert ufs_extend_tail() to take a folio
> > ufs: Convert ufs_inode_getfrag() to take a folio
> > ufs: Pass a folio to ufs_new_fragments()
> > ufs: Convert ufs_change_blocknr() to take a folio
> >
> > fs/ufs/balloc.c | 16 ++++++++--------
> > fs/ufs/inode.c | 30 ++++++++++++++----------------
> > fs/ufs/ufs.h | 8 ++++----
> > 3 files changed, 26 insertions(+), 28 deletions(-)
>
> Looks sane (for now - there's really interesting shite around the block
> relocation, hole filling, etc.); I've got a bunch of UFS patches and IMO
> it makes sense to keep it in the same branch. Mine is in #work.ufs
> and there's pending work locally.
>
> I'll add yours to the mix and see if xfstests catch any problems there;
> will post tonight.
No regressions.
^ permalink raw reply [flat|nested] 8+ messages in thread