Loading fs/xfs/xfs_alloc.c +8 −11 Original line number Original line Diff line number Diff line Loading @@ -257,16 +257,14 @@ xfs_alloc_fix_len( k = rlen % args->prod; k = rlen % args->prod; if (k == args->mod) if (k == args->mod) return; return; if (k > args->mod) { if (k > args->mod) if ((int)(rlen = rlen - k - args->mod) < (int)args->minlen) rlen = rlen - (k - args->mod); return; else } else { rlen = rlen - args->prod + (args->mod - k); if ((int)(rlen = rlen - args->prod - (args->mod - k)) < if ((int)rlen < (int)args->minlen) (int)args->minlen) return; return; } ASSERT(rlen >= args->minlen && rlen <= args->maxlen); ASSERT(rlen >= args->minlen); ASSERT(rlen % args->prod == args->mod); ASSERT(rlen <= args->maxlen); args->len = rlen; args->len = rlen; } } Loading Loading @@ -541,7 +539,6 @@ xfs_alloc_read_agfl( XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops); XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops); if (error) if (error) return error; return error; ASSERT(!xfs_buf_geterror(bp)); xfs_buf_set_ref(bp, XFS_AGFL_REF); xfs_buf_set_ref(bp, XFS_AGFL_REF); *bpp = bp; *bpp = bp; return 0; return 0; Loading fs/xfs/xfs_aops.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -975,7 +975,7 @@ xfs_vm_writepage( * Given that we do not allow direct reclaim to call us, we should * Given that we do not allow direct reclaim to call us, we should * never be called while in a filesystem transaction. * never be called while in a filesystem transaction. */ */ if (WARN_ON(current->flags & PF_FSTRANS)) if (WARN_ON_ONCE(current->flags & PF_FSTRANS)) goto redirty; goto redirty; /* Is this page beyond the end of the file? */ /* Is this page beyond the end of the file? */ Loading Loading @@ -1225,9 +1225,9 @@ xfs_vm_releasepage( xfs_count_page_state(page, &delalloc, &unwritten); xfs_count_page_state(page, &delalloc, &unwritten); if (WARN_ON(delalloc)) if (WARN_ON_ONCE(delalloc)) return 0; return 0; if (WARN_ON(unwritten)) if (WARN_ON_ONCE(unwritten)) return 0; return 0; return try_to_free_buffers(page); return try_to_free_buffers(page); Loading fs/xfs/xfs_bit.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,12 @@ static inline int xfs_lowbit64(__uint64_t v) n = ffs(w); n = ffs(w); } else { /* upper bits */ } else { /* upper bits */ w = (__uint32_t)(v >> 32); w = (__uint32_t)(v >> 32); if (w && (n = ffs(w))) if (w) { n = ffs(w); if (n) n += 32; n += 32; } } } return n - 1; return n - 1; } } Loading fs/xfs/xfs_bmap_util.c +13 −3 Original line number Original line Diff line number Diff line Loading @@ -258,14 +258,23 @@ xfs_bmapi_allocate_worker( struct xfs_bmalloca *args = container_of(work, struct xfs_bmalloca *args = container_of(work, struct xfs_bmalloca, work); struct xfs_bmalloca, work); unsigned long pflags; unsigned long pflags; unsigned long new_pflags = PF_FSTRANS; /* we are in a transaction context here */ /* current_set_flags_nested(&pflags, PF_FSTRANS); * we are in a transaction context here, but may also be doing work * in kswapd context, and hence we may need to inherit that state * temporarily to ensure that we don't block waiting for memory reclaim * in any way. */ if (args->kswapd) new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; current_set_flags_nested(&pflags, new_pflags); args->result = __xfs_bmapi_allocate(args); args->result = __xfs_bmapi_allocate(args); complete(args->done); complete(args->done); current_restore_flags_nested(&pflags, PF_FSTRANS); current_restore_flags_nested(&pflags, new_pflags); } } /* /* Loading @@ -284,6 +293,7 @@ xfs_bmapi_allocate( args->done = &done; args->done = &done; args->kswapd = current_is_kswapd(); INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); queue_work(xfs_alloc_wq, &args->work); queue_work(xfs_alloc_wq, &args->work); wait_for_completion(&done); wait_for_completion(&done); Loading fs/xfs/xfs_bmap_util.h +7 −6 Original line number Original line Diff line number Diff line Loading @@ -50,12 +50,13 @@ struct xfs_bmalloca { xfs_extlen_t total; /* total blocks needed for xaction */ xfs_extlen_t total; /* total blocks needed for xaction */ xfs_extlen_t minlen; /* minimum allocation size (blocks) */ xfs_extlen_t minlen; /* minimum allocation size (blocks) */ xfs_extlen_t minleft; /* amount must be left after alloc */ xfs_extlen_t minleft; /* amount must be left after alloc */ char eof; /* set if allocating past last extent */ bool eof; /* set if allocating past last extent */ char wasdel; /* replacing a delayed allocation */ bool wasdel; /* replacing a delayed allocation */ char userdata;/* set if is user data */ bool userdata;/* set if is user data */ char aeof; /* allocated space at eof */ bool aeof; /* allocated space at eof */ char conv; /* overwriting unwritten extents */ bool conv; /* overwriting unwritten extents */ char stack_switch; bool stack_switch; bool kswapd; /* allocation in kswapd context */ int flags; int flags; struct completion *done; struct completion *done; struct work_struct work; struct work_struct work; Loading Loading
fs/xfs/xfs_alloc.c +8 −11 Original line number Original line Diff line number Diff line Loading @@ -257,16 +257,14 @@ xfs_alloc_fix_len( k = rlen % args->prod; k = rlen % args->prod; if (k == args->mod) if (k == args->mod) return; return; if (k > args->mod) { if (k > args->mod) if ((int)(rlen = rlen - k - args->mod) < (int)args->minlen) rlen = rlen - (k - args->mod); return; else } else { rlen = rlen - args->prod + (args->mod - k); if ((int)(rlen = rlen - args->prod - (args->mod - k)) < if ((int)rlen < (int)args->minlen) (int)args->minlen) return; return; } ASSERT(rlen >= args->minlen && rlen <= args->maxlen); ASSERT(rlen >= args->minlen); ASSERT(rlen % args->prod == args->mod); ASSERT(rlen <= args->maxlen); args->len = rlen; args->len = rlen; } } Loading Loading @@ -541,7 +539,6 @@ xfs_alloc_read_agfl( XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops); XFS_FSS_TO_BB(mp, 1), 0, &bp, &xfs_agfl_buf_ops); if (error) if (error) return error; return error; ASSERT(!xfs_buf_geterror(bp)); xfs_buf_set_ref(bp, XFS_AGFL_REF); xfs_buf_set_ref(bp, XFS_AGFL_REF); *bpp = bp; *bpp = bp; return 0; return 0; Loading
fs/xfs/xfs_aops.c +3 −3 Original line number Original line Diff line number Diff line Loading @@ -975,7 +975,7 @@ xfs_vm_writepage( * Given that we do not allow direct reclaim to call us, we should * Given that we do not allow direct reclaim to call us, we should * never be called while in a filesystem transaction. * never be called while in a filesystem transaction. */ */ if (WARN_ON(current->flags & PF_FSTRANS)) if (WARN_ON_ONCE(current->flags & PF_FSTRANS)) goto redirty; goto redirty; /* Is this page beyond the end of the file? */ /* Is this page beyond the end of the file? */ Loading Loading @@ -1225,9 +1225,9 @@ xfs_vm_releasepage( xfs_count_page_state(page, &delalloc, &unwritten); xfs_count_page_state(page, &delalloc, &unwritten); if (WARN_ON(delalloc)) if (WARN_ON_ONCE(delalloc)) return 0; return 0; if (WARN_ON(unwritten)) if (WARN_ON_ONCE(unwritten)) return 0; return 0; return try_to_free_buffers(page); return try_to_free_buffers(page); Loading
fs/xfs/xfs_bit.h +5 −2 Original line number Original line Diff line number Diff line Loading @@ -66,9 +66,12 @@ static inline int xfs_lowbit64(__uint64_t v) n = ffs(w); n = ffs(w); } else { /* upper bits */ } else { /* upper bits */ w = (__uint32_t)(v >> 32); w = (__uint32_t)(v >> 32); if (w && (n = ffs(w))) if (w) { n = ffs(w); if (n) n += 32; n += 32; } } } return n - 1; return n - 1; } } Loading
fs/xfs/xfs_bmap_util.c +13 −3 Original line number Original line Diff line number Diff line Loading @@ -258,14 +258,23 @@ xfs_bmapi_allocate_worker( struct xfs_bmalloca *args = container_of(work, struct xfs_bmalloca *args = container_of(work, struct xfs_bmalloca, work); struct xfs_bmalloca, work); unsigned long pflags; unsigned long pflags; unsigned long new_pflags = PF_FSTRANS; /* we are in a transaction context here */ /* current_set_flags_nested(&pflags, PF_FSTRANS); * we are in a transaction context here, but may also be doing work * in kswapd context, and hence we may need to inherit that state * temporarily to ensure that we don't block waiting for memory reclaim * in any way. */ if (args->kswapd) new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; current_set_flags_nested(&pflags, new_pflags); args->result = __xfs_bmapi_allocate(args); args->result = __xfs_bmapi_allocate(args); complete(args->done); complete(args->done); current_restore_flags_nested(&pflags, PF_FSTRANS); current_restore_flags_nested(&pflags, new_pflags); } } /* /* Loading @@ -284,6 +293,7 @@ xfs_bmapi_allocate( args->done = &done; args->done = &done; args->kswapd = current_is_kswapd(); INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); queue_work(xfs_alloc_wq, &args->work); queue_work(xfs_alloc_wq, &args->work); wait_for_completion(&done); wait_for_completion(&done); Loading
fs/xfs/xfs_bmap_util.h +7 −6 Original line number Original line Diff line number Diff line Loading @@ -50,12 +50,13 @@ struct xfs_bmalloca { xfs_extlen_t total; /* total blocks needed for xaction */ xfs_extlen_t total; /* total blocks needed for xaction */ xfs_extlen_t minlen; /* minimum allocation size (blocks) */ xfs_extlen_t minlen; /* minimum allocation size (blocks) */ xfs_extlen_t minleft; /* amount must be left after alloc */ xfs_extlen_t minleft; /* amount must be left after alloc */ char eof; /* set if allocating past last extent */ bool eof; /* set if allocating past last extent */ char wasdel; /* replacing a delayed allocation */ bool wasdel; /* replacing a delayed allocation */ char userdata;/* set if is user data */ bool userdata;/* set if is user data */ char aeof; /* allocated space at eof */ bool aeof; /* allocated space at eof */ char conv; /* overwriting unwritten extents */ bool conv; /* overwriting unwritten extents */ char stack_switch; bool stack_switch; bool kswapd; /* allocation in kswapd context */ int flags; int flags; struct completion *done; struct completion *done; struct work_struct work; struct work_struct work; Loading