xfs: remove kmem_realloc()
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>
diff --git a/include/kmem.h b/include/kmem.h
index 75fb005..c8e2595 100644
--- a/include/kmem.h
+++ b/include/kmem.h
@@ -46,6 +46,6 @@
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 a7a3f2d..ee50ab6 100644
--- a/libxfs/kmem.c
+++ b/libxfs/kmem.c
@@ -91,7 +91,7 @@
}
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 f68091d..a52eed0 100644
--- a/libxfs/xfs_iext_tree.c
+++ b/libxfs/xfs_iext_tree.c
@@ -603,7 +603,7 @@
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 30522d6..0b1af50 100644
--- a/libxfs/xfs_inode_fork.c
+++ b/libxfs/xfs_inode_fork.c
@@ -384,8 +384,8 @@
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 @@
* 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 ec65339..a7dfa70 100644
--- a/libxlog/xfs_log_recover.c
+++ b/libxlog/xfs_log_recover.c
@@ -1045,7 +1045,7 @@
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;