Loading fs/xfs/kmem.c +15 −11 Original line number Diff line number Diff line Loading @@ -93,19 +93,23 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags) } void * kmem_realloc(const void *ptr, size_t newsize, size_t oldsize, xfs_km_flags_t flags) kmem_realloc(const void *old, size_t newsize, xfs_km_flags_t flags) { void *new; int retries = 0; gfp_t lflags = kmem_flags_convert(flags); void *ptr; new = kmem_alloc(newsize, flags); if (ptr) { if (new) memcpy(new, ptr, ((oldsize < newsize) ? oldsize : newsize)); kmem_free(ptr); } return new; do { ptr = krealloc(old, newsize, lflags); if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) return ptr; if (!(++retries % 100)) xfs_err(NULL, "%s(%u) possible memory allocation deadlock size %zu in %s (mode:0x%x)", current->comm, current->pid, newsize, __func__, lflags); congestion_wait(BLK_RW_ASYNC, HZ/50); } while (1); } void * Loading fs/xfs/kmem.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ kmem_flags_convert(xfs_km_flags_t flags) extern void *kmem_alloc(size_t, xfs_km_flags_t); extern void *kmem_zalloc_large(size_t size, xfs_km_flags_t); extern void *kmem_realloc(const void *, size_t, size_t, xfs_km_flags_t); extern void *kmem_realloc(const void *, size_t, xfs_km_flags_t); static inline void kmem_free(const void *ptr) { kvfree(ptr); Loading fs/xfs/libxfs/xfs_inode_fork.c +3 −7 Original line number Diff line number Diff line Loading @@ -542,7 +542,6 @@ xfs_iroot_realloc( 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, XFS_BMAP_BROOT_SPACE_CALC(mp, cur_max), KM_SLEEP | KM_NOFS); op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, ifp->if_broot_bytes); Loading Loading @@ -686,7 +685,6 @@ xfs_idata_realloc( ifp->if_u1.if_data = kmem_realloc(ifp->if_u1.if_data, real_size, ifp->if_real_bytes, KM_SLEEP | KM_NOFS); } } else { Loading Loading @@ -1402,8 +1400,7 @@ xfs_iext_realloc_direct( if (rnew_size != ifp->if_real_bytes) { ifp->if_u1.if_extents = kmem_realloc(ifp->if_u1.if_extents, rnew_size, ifp->if_real_bytes, KM_NOFS); rnew_size, KM_NOFS); } if (rnew_size > ifp->if_real_bytes) { memset(&ifp->if_u1.if_extents[ifp->if_bytes / Loading Loading @@ -1487,9 +1484,8 @@ xfs_iext_realloc_indirect( if (new_size == 0) { xfs_iext_destroy(ifp); } else { ifp->if_u1.if_ext_irec = (xfs_ext_irec_t *) kmem_realloc(ifp->if_u1.if_ext_irec, new_size, size, KM_NOFS); ifp->if_u1.if_ext_irec = kmem_realloc(ifp->if_u1.if_ext_irec, new_size, KM_NOFS); } } Loading fs/xfs/xfs_dquot.c +1 −1 Original line number Diff line number Diff line Loading @@ -691,7 +691,7 @@ xfs_qm_dqread( * end of the chunk, skip ahead to first id in next allocated chunk * using the SEEK_DATA interface. */ int static int xfs_dq_get_next_id( xfs_mount_t *mp, uint type, Loading fs/xfs/xfs_inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -1030,7 +1030,7 @@ xfs_dir_ialloc( tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY); } code = xfs_trans_roll(&tp, 0); code = xfs_trans_roll(&tp, NULL); if (committed != NULL) *committed = 1; Loading Loading
fs/xfs/kmem.c +15 −11 Original line number Diff line number Diff line Loading @@ -93,19 +93,23 @@ kmem_zalloc_large(size_t size, xfs_km_flags_t flags) } void * kmem_realloc(const void *ptr, size_t newsize, size_t oldsize, xfs_km_flags_t flags) kmem_realloc(const void *old, size_t newsize, xfs_km_flags_t flags) { void *new; int retries = 0; gfp_t lflags = kmem_flags_convert(flags); void *ptr; new = kmem_alloc(newsize, flags); if (ptr) { if (new) memcpy(new, ptr, ((oldsize < newsize) ? oldsize : newsize)); kmem_free(ptr); } return new; do { ptr = krealloc(old, newsize, lflags); if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) return ptr; if (!(++retries % 100)) xfs_err(NULL, "%s(%u) possible memory allocation deadlock size %zu in %s (mode:0x%x)", current->comm, current->pid, newsize, __func__, lflags); congestion_wait(BLK_RW_ASYNC, HZ/50); } while (1); } void * Loading
fs/xfs/kmem.h +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ kmem_flags_convert(xfs_km_flags_t flags) extern void *kmem_alloc(size_t, xfs_km_flags_t); extern void *kmem_zalloc_large(size_t size, xfs_km_flags_t); extern void *kmem_realloc(const void *, size_t, size_t, xfs_km_flags_t); extern void *kmem_realloc(const void *, size_t, xfs_km_flags_t); static inline void kmem_free(const void *ptr) { kvfree(ptr); Loading
fs/xfs/libxfs/xfs_inode_fork.c +3 −7 Original line number Diff line number Diff line Loading @@ -542,7 +542,6 @@ xfs_iroot_realloc( 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, XFS_BMAP_BROOT_SPACE_CALC(mp, cur_max), KM_SLEEP | KM_NOFS); op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, ifp->if_broot_bytes); Loading Loading @@ -686,7 +685,6 @@ xfs_idata_realloc( ifp->if_u1.if_data = kmem_realloc(ifp->if_u1.if_data, real_size, ifp->if_real_bytes, KM_SLEEP | KM_NOFS); } } else { Loading Loading @@ -1402,8 +1400,7 @@ xfs_iext_realloc_direct( if (rnew_size != ifp->if_real_bytes) { ifp->if_u1.if_extents = kmem_realloc(ifp->if_u1.if_extents, rnew_size, ifp->if_real_bytes, KM_NOFS); rnew_size, KM_NOFS); } if (rnew_size > ifp->if_real_bytes) { memset(&ifp->if_u1.if_extents[ifp->if_bytes / Loading Loading @@ -1487,9 +1484,8 @@ xfs_iext_realloc_indirect( if (new_size == 0) { xfs_iext_destroy(ifp); } else { ifp->if_u1.if_ext_irec = (xfs_ext_irec_t *) kmem_realloc(ifp->if_u1.if_ext_irec, new_size, size, KM_NOFS); ifp->if_u1.if_ext_irec = kmem_realloc(ifp->if_u1.if_ext_irec, new_size, KM_NOFS); } } Loading
fs/xfs/xfs_dquot.c +1 −1 Original line number Diff line number Diff line Loading @@ -691,7 +691,7 @@ xfs_qm_dqread( * end of the chunk, skip ahead to first id in next allocated chunk * using the SEEK_DATA interface. */ int static int xfs_dq_get_next_id( xfs_mount_t *mp, uint type, Loading
fs/xfs/xfs_inode.c +1 −1 Original line number Diff line number Diff line Loading @@ -1030,7 +1030,7 @@ xfs_dir_ialloc( tp->t_flags &= ~(XFS_TRANS_DQ_DIRTY); } code = xfs_trans_roll(&tp, 0); code = xfs_trans_roll(&tp, NULL); if (committed != NULL) *committed = 1; Loading