* [PATCH 1/3] xfs: remove kmem_realloc()
2020-10-26 23:32 [PATCH 0/3] xfsprogs: sync with 5.10, part 1 Darrick J. Wong
@ 2020-10-26 23:32 ` Darrick J. Wong
2020-10-26 23:32 ` [PATCH 2/3] xfs: move the buffer retry logic to xfs_buf.c Darrick J. Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2020-10-26 23:32 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: Carlos Maiolino, Christoph Hellwig, linux-xfs
From: Carlos Maiolino <cmaiolino@redhat.com>
Source kernel commit: 771915c4f68889b8c41092a928c604c9cd279927
Remove kmem_realloc() function and convert its users to use MM API
directly (krealloc())
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
include/kmem.h | 2 +-
libxfs/kmem.c | 2 +-
libxfs/xfs_iext_tree.c | 2 +-
libxfs/xfs_inode_fork.c | 8 ++++----
libxlog/xfs_log_recover.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/kmem.h b/include/kmem.h
index 75fb00579904..c8e25953fd9f 100644
--- a/include/kmem.h
+++ b/include/kmem.h
@@ -46,6 +46,6 @@ kmem_free(void *ptr) {
free(ptr);
}
-extern void *kmem_realloc(void *, size_t, int);
+extern void *krealloc(void *, size_t, int);
#endif
diff --git a/libxfs/kmem.c b/libxfs/kmem.c
index a7a3f2d07102..ee50ab667e56 100644
--- a/libxfs/kmem.c
+++ b/libxfs/kmem.c
@@ -91,7 +91,7 @@ kmem_zalloc(size_t size, int flags)
}
void *
-kmem_realloc(void *ptr, size_t new_size, int flags)
+krealloc(void *ptr, size_t new_size, int flags)
{
ptr = realloc(ptr, new_size);
if (ptr == NULL) {
diff --git a/libxfs/xfs_iext_tree.c b/libxfs/xfs_iext_tree.c
index f68091dc65a0..a52eed0426a2 100644
--- a/libxfs/xfs_iext_tree.c
+++ b/libxfs/xfs_iext_tree.c
@@ -603,7 +603,7 @@ xfs_iext_realloc_root(
if (new_size / sizeof(struct xfs_iext_rec) == RECS_PER_LEAF)
new_size = NODE_SIZE;
- new = kmem_realloc(ifp->if_u1.if_root, new_size, KM_NOFS);
+ new = krealloc(ifp->if_u1.if_root, new_size, GFP_NOFS | __GFP_NOFAIL);
memset(new + ifp->if_bytes, 0, new_size - ifp->if_bytes);
ifp->if_u1.if_root = new;
cur->leaf = new;
diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c
index 30522d695e3b..0b1af5012e41 100644
--- a/libxfs/xfs_inode_fork.c
+++ b/libxfs/xfs_inode_fork.c
@@ -384,8 +384,8 @@ xfs_iroot_realloc(
cur_max = xfs_bmbt_maxrecs(mp, ifp->if_broot_bytes, 0);
new_max = cur_max + rec_diff;
new_size = XFS_BMAP_BROOT_SPACE_CALC(mp, new_max);
- ifp->if_broot = kmem_realloc(ifp->if_broot, new_size,
- KM_NOFS);
+ ifp->if_broot = krealloc(ifp->if_broot, new_size,
+ GFP_NOFS | __GFP_NOFAIL);
op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
ifp->if_broot_bytes);
np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
@@ -494,8 +494,8 @@ xfs_idata_realloc(
* in size so that it can be logged and stay on word boundaries.
* We enforce that here.
*/
- ifp->if_u1.if_data = kmem_realloc(ifp->if_u1.if_data,
- roundup(new_size, 4), KM_NOFS);
+ ifp->if_u1.if_data = krealloc(ifp->if_u1.if_data, roundup(new_size, 4),
+ GFP_NOFS | __GFP_NOFAIL);
ifp->if_bytes = new_size;
}
diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c
index ec6533991f0f..a7dfa7047ab9 100644
--- a/libxlog/xfs_log_recover.c
+++ b/libxlog/xfs_log_recover.c
@@ -1045,7 +1045,7 @@ xlog_recover_add_to_cont_trans(
old_ptr = item->ri_buf[item->ri_cnt-1].i_addr;
old_len = item->ri_buf[item->ri_cnt-1].i_len;
- ptr = kmem_realloc(old_ptr, len+old_len, 0);
+ ptr = krealloc(old_ptr, len+old_len, 0);
memcpy(&ptr[old_len], dp, len); /* d, s, l */
item->ri_buf[item->ri_cnt-1].i_len += len;
item->ri_buf[item->ri_cnt-1].i_addr = ptr;
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] xfs: simplify xfs_trans_getsb
2020-10-26 23:32 [PATCH 0/3] xfsprogs: sync with 5.10, part 1 Darrick J. Wong
2020-10-26 23:32 ` [PATCH 1/3] xfs: remove kmem_realloc() Darrick J. Wong
2020-10-26 23:32 ` [PATCH 2/3] xfs: move the buffer retry logic to xfs_buf.c Darrick J. Wong
@ 2020-10-26 23:33 ` Darrick J. Wong
2020-10-29 9:42 ` [PATCH 0/3] xfsprogs: sync with 5.10, part 1 Christoph Hellwig
3 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2020-10-26 23:33 UTC (permalink / raw)
To: sandeen, darrick.wong; +Cc: Christoph Hellwig, linux-xfs
From: Christoph Hellwig <hch@lst.de>
Source kernel commit: cead0b10f557a2331e0e131ce52aaf7ed7f5355f
Remove the mp argument as this function is only called in transaction
context, and open code xfs_getsb given that the function already accesses
the buffer pointer in the mount point directly.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
include/xfs_trans.h | 2 +-
libxfs/trans.c | 6 +++---
libxfs/xfs_sb.c | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/xfs_trans.h b/include/xfs_trans.h
index 1f087672a2a8..9292a4a54237 100644
--- a/include/xfs_trans.h
+++ b/include/xfs_trans.h
@@ -91,7 +91,7 @@ void libxfs_trans_cancel(struct xfs_trans *);
/* cancel dfops associated with a transaction */
void xfs_defer_cancel(struct xfs_trans *);
-struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *, struct xfs_mount *);
+struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *);
void libxfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *, uint);
void libxfs_trans_log_inode (struct xfs_trans *, struct xfs_inode *,
diff --git a/libxfs/trans.c b/libxfs/trans.c
index 51ce83021e87..6838b727350b 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -463,10 +463,10 @@ libxfs_trans_get_buf_map(
xfs_buf_t *
libxfs_trans_getsb(
- xfs_trans_t *tp,
- struct xfs_mount *mp)
+ struct xfs_trans *tp)
{
- xfs_buf_t *bp;
+ struct xfs_mount *mp = tp->t_mountp;
+ struct xfs_buf *bp;
struct xfs_buf_log_item *bip;
int len = XFS_FSS_TO_BB(mp, 1);
DEFINE_SINGLE_BUF_MAP(map, XFS_SB_DADDR, len);
diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c
index 302eea167f4e..7c7e56a8979c 100644
--- a/libxfs/xfs_sb.c
+++ b/libxfs/xfs_sb.c
@@ -931,7 +931,7 @@ xfs_log_sb(
struct xfs_trans *tp)
{
struct xfs_mount *mp = tp->t_mountp;
- struct xfs_buf *bp = xfs_trans_getsb(tp, mp);
+ struct xfs_buf *bp = xfs_trans_getsb(tp);
mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount);
mp->m_sb.sb_ifree = percpu_counter_sum(&mp->m_ifree);
@@ -1061,7 +1061,7 @@ xfs_sync_sb_buf(
if (error)
return error;
- bp = xfs_trans_getsb(tp, mp);
+ bp = xfs_trans_getsb(tp);
xfs_log_sb(tp);
xfs_trans_bhold(tp, bp);
xfs_trans_set_sync(tp);
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] xfsprogs: sync with 5.10, part 1
2020-10-26 23:32 [PATCH 0/3] xfsprogs: sync with 5.10, part 1 Darrick J. Wong
` (2 preceding siblings ...)
2020-10-26 23:33 ` [PATCH 3/3] xfs: simplify xfs_trans_getsb Darrick J. Wong
@ 2020-10-29 9:42 ` Christoph Hellwig
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2020-10-29 9:42 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: sandeen, Carlos Maiolino, Christoph Hellwig, linux-xfs
On Mon, Oct 26, 2020 at 04:32:43PM -0700, Darrick J. Wong wrote:
> Hi all,
>
> The first part of syncing libxfs with 5.10.
>
> If you're going to start using this mess, you probably ought to just
> pull from my git trees, which are linked below.
>
> This is an extraordinary way to destroy everything. Enjoy!
> Comments and questions are, as always, welcome.
This all looks good to me:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread