From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: add kmem_alloc_io()
Date: Mon, 26 Aug 2019 00:52:17 -0700 [thread overview]
Message-ID: <20190826075217.GC20346@infradead.org> (raw)
In-Reply-To: <20190826014007.10877-4-david@fromorbit.com>
> + ptr = kmem_alloc(size, flags | KM_MAYFAIL);
> + if (ptr) {
> + if (!((uintptr_t)ptr & align_mask))
> + return ptr;
> + kfree(ptr);
> + }
> + return __kmem_vmalloc(size, flags);
Not that іt really matters, I'd write so that the fast path is the main
return:
ptr = kmem_alloc(size, flags | KM_MAYFAIL);
if (unlikely(!ptr || (intptr_t)ptr & align_mask)) {
kfree(ptr);
ptr = __kmem_vmalloc(size, flags);
}
return ptr;
> + int align_mask = xfs_buftarg_dma_alignment(bp->b_target);
> + bp->b_addr = kmem_alloc_io(size, align_mask, KM_NOFS);
The int vs an unsigned type here looks a little odd, but I guess that
just propagates from queue_dma_alignment.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
prev parent reply other threads:[~2019-08-26 7:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 1:40 [PATCH v2] xfs: use aligned buffers for IO Dave Chinner
2019-08-26 1:40 ` [PATCH 1/3] xfs: add kmem allocation trace points Dave Chinner
2019-08-26 7:47 ` Christoph Hellwig
2019-08-26 1:40 ` [PATCH 2/3] xfs: get allocation alignment from the buftarg Dave Chinner
2019-08-26 7:48 ` Christoph Hellwig
2019-08-26 1:40 ` [PATCH 3/3] xfs: add kmem_alloc_io() Dave Chinner
2019-08-26 7:52 ` Christoph Hellwig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190826075217.GC20346@infradead.org \
--to=hch@infradead.org \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.