Re: [PATCH 2/2] blk-mq: make per-sw-queue bio merge as default .bio_merge

2017-05-24 Thread Christoph Hellwig
On Tue, May 23, 2017 at 07:47:36PM +0800, Ming Lei wrote: > Because what the per-sw-queue bio merge does is basically same with > scheduler's .bio_merge(), this patch makes per-sw-queue bio merge > as the default .bio_merge if no scheduler is used or io scheduler > doesn't provide .bio_merge(). >

Re: [block] question about potential null pointer dereference

2017-05-24 Thread Paolo Valente
> Il giorno 23 mag 2017, alle ore 22:52, Gustavo A. R. Silva > ha scritto: > > > Hello everybody, > Hi > While looking into Coverity ID 1408828 I ran into the following piece of code > at block/bfq-wf2q.c:542: > > 542static struct rb_node *bfq_find_deepest(struct

Re: [PATCH 09/31] block: Avoid that blk_exit_rl() triggers a use-after-free

2017-05-24 Thread Tejun Heo
On Tue, May 23, 2017 at 05:33:58PM -0700, Bart Van Assche wrote: > Since the introduction of the .init_rq_fn() and .exit_rq_fn() it > is essential that the memory allocated for struct request_queue > stays around until all blk_exit_rl() calls have finished. Hence > make blk_init_rl() take a

Re: [PATCH BUGFIX] block, bfq: access and cache blkg data only when safe

2017-05-24 Thread Paolo Valente
> Il giorno 24 mag 2017, alle ore 12:53, Paolo Valente > ha scritto: > >> >> Il giorno 23 mag 2017, alle ore 21:42, Tejun Heo ha >> scritto: >> >> Hello, Paolo. >> >> On Sat, May 20, 2017 at 09:27:33AM +0200, Paolo Valente wrote: >>> Consider a

Re: [PATCH 03/31] Protect SCSI device state changes with a mutex

2017-05-24 Thread Bart Van Assche
On Wed, 2017-05-24 at 07:51 +0200, Hannes Reinecke wrote: > On 05/24/2017 02:33 AM, Bart Van Assche wrote: > > Enable this mechanism for all scsi_target_*block() callers but not > > for the scsi_internal_device_unblock() calls from the mpt3sas driver > > because that driver can call

Re: [PATCH 02/15] scsi/osd: don't save block errors into req_results

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-18 at 15:17 +0200, Christoph Hellwig wrote: > We will only have sense data if the command exectured and got a SCSI > result, so this is pointless. > > Signed-off-by: Christoph Hellwig > --- > drivers/scsi/osd/osd_initiator.c | 2 +- > 1 file changed, 1 insertion(+),

Re: [PATCH 03/15] gfs2: remove the unused sd_log_error field

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-18 at 15:18 +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche

Re: [PATCH 06/15] fs: simplify dio_bio_complete

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-18 at 15:18 +0200, Christoph Hellwig wrote: > Only read bio->bi_error once in the common path. Reviewed-by: Bart Van Assche

Re: [PATCH BUGFIX] block, bfq: access and cache blkg data only when safe

2017-05-24 Thread Tejun Heo
Hello, On Wed, May 24, 2017 at 05:43:18PM +0100, Paolo Valente wrote: > > so none of the above objects can be destroyed before the request is > > done. > > ... the issue seems just to move to a more subtle position: cfq is ok, > because it protects itself with rq lock, but blk-mq schedulers

[PATCH 02/10] fs: Introduce filemap_range_has_page()

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues filemap_range_has_page() return true if the file's mapping has a page within the range mentioned. This function will be used to check if a write() call will cause a writeback of previous writes. Signed-off-by: Goldwyn Rodrigues

[PATCH 04/10] fs: Introduce RWF_NOWAIT

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues RWF_NOWAIT informs kernel to bail out if an AIO request will block for reasons such as file allocations, or a writeback triggered, or would block while allocating requests while performing direct I/O. RWF_NOWAIT is translated to IOCB_NOWAIT for

[PATCH 07/10] fs: return on congested block device

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues A new bio operation flag REQ_NOWAIT is introduced to identify bio's orignating from iocb with IOCB_NOWAIT. This flag indicates to return immediately if a request cannot be made instead of retrying. Stacked devices such as md (the ones with

Re: [PATCH 01/15] nvme-lightnvm: use blk_execute_rq in nvme_nvm_submit_user_cmd

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-18 at 15:17 +0200, Christoph Hellwig wrote: > Instead of reinventing it poorly. Reviewed-by: Bart Van Assche

Re: [PATCH 05/15] fs: remove the unused error argument to dio_end_io()

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-18 at 15:18 +0200, Christoph Hellwig wrote: > Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche

[PATCH 08/10] ext4: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Return EAGAIN if any of the following checks fail for direct I/O: + i_rwsem is lockable + Writing beyond end of file (will trigger allocation) + Blocks are not allocated at the write location Signed-off-by: Goldwyn Rodrigues

[PATCH 10/10] btrfs: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues Return EAGAIN if any of the following checks fail + i_rwsem is not lockable + NODATACOW or PREALLOC is not set + Cannot nocow at the desired location + Writing beyond end of file which is not allocated Signed-off-by: Goldwyn Rodrigues

[PATCH 09/10] xfs: nowait aio support

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues If IOCB_NOWAIT is set, bail if the i_rwsem is not lockable immediately. IF IOMAP_NOWAIT is set, return EAGAIN in xfs_file_iomap_begin if it needs allocation either due to file extension, writing to a hole, or COW or waiting for other DIOs to finish.

[PATCH 0/10 v9] No wait AIO

2017-05-24 Thread Goldwyn Rodrigues
Formerly known as non-blocking AIO. This series adds nonblocking feature to asynchronous I/O writes. io_submit() can be delayed because of a number of reason: - Block allocation for files - Data writebacks for direct I/O - Sleeping because of waiting to acquire i_rwsem - Congested block

[PATCH 06/10] fs: Introduce IOMAP_NOWAIT

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues IOCB_NOWAIT translates to IOMAP_NOWAIT for iomaps. This is used by XFS in the XFS patch. Signed-off-by: Goldwyn Rodrigues Reviewed-by: Christoph Hellwig --- fs/iomap.c| 2 ++ include/linux/iomap.h | 1 + 2

Re: [PATCH BUGFIX] block, bfq: access and cache blkg data only when safe

2017-05-24 Thread Paolo Valente
> Il giorno 24 mag 2017, alle ore 15:50, Tejun Heo ha scritto: > > Hello, Paolo. > > On Wed, May 24, 2017 at 12:53:26PM +0100, Paolo Valente wrote: >> Exact, but even after all blkgs, as well as the cfq_group and pd, are >> gone, the children cfq_queues of the gone cfq_group

[PATCH 03/10] fs: Use RWF_* flags for AIO operations

2017-05-24 Thread Goldwyn Rodrigues
From: Goldwyn Rodrigues aio_rw_flags is introduced in struct iocb (using aio_reserved1) which will carry the RWF_* flags. We cannot use aio_flags because they are not checked for validity which may break existing applications. Note, the only place RWF_HIPRI comes in effect is

Re: [PATCH 12/31] bsg: Check queue type before attaching to a queue

2017-05-24 Thread Martin K. Petersen
Bart, > Since BSG only supports request queues for which struct scsi_request > is the first member of their private request data, refuse to register > block layer queues for which struct scsi_request is not the first > member of their private data. > + > + if (!blk_queue_scsi_sup(rq)) { If

[PATCH 1/7] blk-mq: introduce blk_mq_unquiesce_queue

2017-05-24 Thread Ming Lei
blk_mq_unquiesce_queue() is introduced to for rewriting the current quiescing mechanism, which will be done in the following patches. Signed-off-by: Ming Lei --- block/blk-mq.c | 13 + include/linux/blkdev.h | 1 + 2 files changed, 14 insertions(+)

[PATCH 3/7] dm: use the introduced blk_mq_unquiesce_queue()

2017-05-24 Thread Ming Lei
blk_mq_unquiesce_queue() is used for unquiescing the queue. Signed-off-by: Ming Lei --- drivers/md/dm-rq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 2af27026aa2e..673fcf075077 100644 ---

[PATCH 5/7] scsi: use the introduced blk_mq_unquiesce_queue()

2017-05-24 Thread Ming Lei
blk_mq_unquiesce_queue() is used for unquiescing the queue. Signed-off-by: Ming Lei --- drivers/scsi/scsi_lib.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 814a4bd8405d..72b11f75719c 100644

[PATCH 2/7] block: introduce flag of QUEUE_FLAG_QUIESCED

2017-05-24 Thread Ming Lei
This flag is introduced for reimplementing the quiescing code. Signed-off-by: Ming Lei --- include/linux/blkdev.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 41291be82ac4..60967797f4f6 100644 ---

[PATCH 6/7] blk-mq: quiesce queue via percpu_ref

2017-05-24 Thread Ming Lei
One big problem of blk_mq_quiesce_queue() is that it can't prevent .queue_rq() in direct issue path from being run even though hw queues are stopped. It is observed that request double-free/use-after-free can be triggered easily when canceling NVMe requests via

[PATCH 4/7] nvme: use the introduced blk_mq_unquiesce_queue()

2017-05-24 Thread Ming Lei
blk_mq_unquiesce_queue() is used for unquiescing the queue. Signed-off-by: Ming Lei --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 04e115834702..231d36028afc 100644

[PATCH 7/7] blk-mq: update comments on blk_mq_quiesce_queue()

2017-05-24 Thread Ming Lei
Actually what we want to get from blk_mq_quiesce_queue() isn't only to wait for completion of all ongooing .queue_rq(). In the typical context of canceling requests, we need to make sure that the following is done in the dispatch path before starting to cancel requests: - failed

Re: [PATCH 0/7] blk-mq: fix queue quiescing

2017-05-24 Thread Bart Van Assche
On Thu, 2017-05-25 at 12:21 +0800, Ming Lei wrote: > One big problem of blk_mq_quiesce_queue() is that it > can't prevent .queue_rq() in direct issue path from > being run even though hw queues are stopped by > blk_mq_quiesce_queue(). That's wrong. All what's needed to prevent that

Re: [PATCH 00/31] SCSI patches for kernel v4.13.

2017-05-24 Thread Martin K. Petersen
Bart, > This patch series consists of the bug fixes I came up with during the > past two months. Please consider these patches for kernel v4.13. No major objections from me. Although you may have to slice and dice the series differently so we can get the block bits queued through Jens and then

Re: [PATCH 11/31] block: Introduce queue flag QUEUE_FLAG_SCSI_SUP

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > From the context where a SCSI command is submitted it is not always > possible to figure out whether or not the queue the command is > submitted to has struct scsi_request as the first member of its > private data. Hence introduce the flag

Re: [PATCH 18/31] block: Make scsi_req_init() calls implicit

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Instead of explicitly calling scsi_req_init(), let > blk_get_request() call that function from inside blk_rq_init(). > Add an .initialize_rq_fn() callback function to the block drivers > that need it. Merge the IDE .init_rq_fn() function into >

Re: [PATCH 19/31] scsi: Change argument type of scsi_req_init()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since scsi_req_init() works on a struct scsi_request, change the > argument type into struct scsi_request *. > > Signed-off-by: Bart Van Assche > Reviewed-by: Christoph Hellwig > Cc: Hannes Reinecke

Re: [PATCH 25/31] scsi-mq: Make behavior scsi_mq_prep_fn() closer to that of scsi_prep_fn()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Instead of clearing most of struct scsi_cmnd and reinitializing > it, rely on scsi_initialize_rq() for initialization of struct > scsi_cmnd. This patch fixes a bug, namely that it avoids that > jiffies_at_alloc gets overwritten if a request is

Re: [PATCH 14/31] cdrom: Check private request size before attaching to a queue

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since the cdrom driver only supports request queues for which > struct scsi_request is the first member of their private request > data, refuse to register block layer queues for which this is > not the case. > > References: commit 82ed4db499b8

Re: [PATCH 15/31] nfsd: Check private request size before submitting a SCSI request

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since using scsi_req() is only allowed against request queues for > which struct scsi_request is the first member of their private > request data, refuse to submit SCSI commands against a queue for > which this is not the case. > > References:

Re: [PATCH 13/31] pktcdvd: Check queue type before attaching to a queue

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since the pktcdvd driver only supports request queues for which > struct scsi_request is the first member of their private request > data, refuse to register block layer queues for which struct > scsi_request is not the first member of the private

Re: [PATCH 22/31] scsi: Inline scsi_init_command()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > The two drivers that use the per-device command list, namely aacraid > and dpt_i2o, expect that that list contains only SCSI commands and > no task management functions. Hence only call scsi_add_cmd_to_list() > from the block layer prep callback

Re: [PATCH 20/31] scsi: Only add commands to the device command list if required by the LLD

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Just like for the scsi-mq code path, in the single queue SCSI code > path only add commands to the per-device command list if required > by the SCSI LLD. This patch will make it easier to merge the > single-queue and multiqueue command

Re: [PATCH 21/31] scsi: Move most of scsi_init_command() into scsi_initialize_rq()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Move the initializations that only have to be performed once and > not every time a request is prepared from scsi_init_command() > into scsi_initialize_rq(). This patch also moves the > jiffies_at_alloc assignment such that it gets back the meaning

Re: [PATCH 17/31] block: Introduce request_queue.initialize_rq_fn()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Several block drivers need to initialize the driver-private data > after having called blk_get_request() and before .prep_rq_fn() is > called, e.g. when submitting a REQ_OP_SCSI_* request. Avoid that > that initialization code has to be repeated

Re: [PATCH 23/31] scsi: Move sense buffer pointer initialization into scsi_initialize_rq()

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > This patch is a preparation for the next patch that will zero > the struct scsi_request embedded in struct scsi_cmnd before > calling scsi_req_init(). > > Signed-off-by: Bart Van Assche > Reviewed-by: Christoph Hellwig

Re: [PATCH 24/31] scsi: Make scsi_initialize_rq() zero the entire struct scsi_cmnd

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > This simplifies the memset() call in scsi_initialize_rq() and avoids > that any stale data is left behind in struct scsi_request. > > Signed-off-by: Bart Van Assche > Reviewed-by: Christoph Hellwig > Cc:

Re: [PATCH 27/31] scsi: Consolidate more initialization code

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Initialize struct scsi_cmnd.request from inside scsi_initialize_rq() > instead of every time a request is prepared. Note: moving the tag > initialization into scsi_initialize_rq() is not possible because > the single-queue block layer only assigns a

Re: [PATCH 28/31] scsi_setup_fs_cmnd(): Call scsi_req_init() instead of open-coding it

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > The only functional change is that this patch causes scsi_setup_fs_cmnd() > to clear scsi_request.sense_len. > > Signed-off-by: Bart Van Assche > Reviewed-by: Christoph Hellwig > Cc: Hannes Reinecke

Re: [PATCH 29/31] scsi: snic: Remove code that zeroes driver-private command data

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since the SCSI core zeroes driver-private command data, remove > that code from the snic driver. > > Signed-off-by: Bart Van Assche > Cc: Narsimhulu Musini > Cc: Sesidhar Baddela

Re: [PATCH 31/31] xen/scsifront: Remove code that zeroes driver-private command data

2017-05-24 Thread Hannes Reinecke
On 05/24/2017 02:34 AM, Bart Van Assche wrote: > Since the SCSI core zeroes driver-private command data, remove > that code from the xen-scsifront driver. > > Signed-off-by: Bart Van Assche > Cc: Juergen Gross > Cc: xen-de...@lists.xenproject.org >

Re: [PATCH 1/2] block: Introduce blkdev_issue_flush_no_wait()

2017-05-24 Thread Anand Jain
The bdev->bd_disk, !bdev_get_queue and q->make_request_fn checks are all things you don't need, any blkdev_issue_flush should not either, although I'll need to look into the weird loop workaround again, which doesn't make much sense to me. I tried to confirm q->make_request_fn and got lost,

Re: [PATCH 31/31] xen/scsifront: Remove code that zeroes driver-private command data

2017-05-24 Thread Juergen Gross
On 24/05/17 02:34, Bart Van Assche wrote: > Since the SCSI core zeroes driver-private command data, remove > that code from the xen-scsifront driver. > > Signed-off-by: Bart Van Assche > Cc: Juergen Gross > Cc: xen-de...@lists.xenproject.org

Re: [PATCH 01/31] Split scsi_internal_device_block()

2017-05-24 Thread Johannes Thumshirn
On 05/24/2017 02:33 AM, Bart Van Assche wrote: > Instead of passing a "wait" argument to scsi_internal_device_block(), > split this function into a function that waits and a function that > doesn't wait. This will make it easier to serialize SCSI device state > changes through a mutex. > >

Re: [PATCH 02/31] Create two versions of scsi_internal_device_unblock()

2017-05-24 Thread Johannes Thumshirn
On 05/24/2017 02:33 AM, Bart Van Assche wrote: > This will make it easier to serialize SCSI device state changes > through a mutex. > > Signed-off-by: Bart Van Assche > Cc: Christoph Hellwig > Cc: Hannes Reinecke > Cc: Johannes Thumshirn

Re: [PATCH 08/31] sd, sr: Convert two assignments into warning statements

2017-05-24 Thread Johannes Thumshirn
On 05/24/2017 02:33 AM, Bart Van Assche wrote: > Before scsi_prep_fn() calls the ULP .init_command() callback > function it stores the SCSI command pointer in request.special. > This means that the SCpnt = rq->special assignments in the sd > and sr drivers assign a pointer to itself. Hence convert

[RFC PATCH 06/16] scatterlist: convert page_link to pfn_t

2017-05-24 Thread Logan Gunthorpe
This patch replaces the old page_link bits with the somewhat safer pfn_t. This change seems to have been planned for in the design of pfn_t by Dan. The conversion is surprisingly straightforward. sg_assign_pfn and sg_set_pfn helpers are added which are similar analogs to their page_link versions.

[RFC PATCH 09/16] bvec: introduce bvec_page and bvec_set_page accessors

2017-05-24 Thread Logan Gunthorpe
Introduce two accessor functions for bv_page: bvec_page to return the page and bvec_set_page. A follow on patch will mechanically convert all the individual uses within the kernel. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates ---

[RFC PATCH 15/16] dma-mapping: introduce and use unmappable safe sg_virt call

2017-05-24 Thread Logan Gunthorpe
Introduce sg_try_virt which is safe to call with a potentially unmappable sgl. sg_try_virt returns NULL in cases that the sgl doesn't have an accessible virtual address to return. Then, in dma_map_sg_attrs, we use the new function instead of sg_virt when marking memory as initialized.

[RFC PATCH 07/16] scatterlist: support unmappable memory in the scatterlist

2017-05-24 Thread Logan Gunthorpe
This patch introduces the PFN_MAYBE_UNMAPPABLE flag which indicates the sgl or pfn may point to unmappable memory. This flag would be set by a call to sg_init_unmappable_table which sets the flag for all entries in the table. Once set, any attempt to call sg_page, sg_virt, etc on the sgl will

[RFC PATCH 00/16] Unmappable memory in SGLs for p2p transfers

2017-05-24 Thread Logan Gunthorpe
Hi, This RFC patchset continues my work attempting to enforce iomem safety within scatterlists. This takes a bit of a different tack from my last series [1] which tried to introduce a common scatterlist mapping function. Instead, this series takes the approach of marking SGLs that may contain

[RFC PATCH 05/16] tile: provide default ioremap declaration

2017-05-24 Thread Logan Gunthorpe
Add a default ioremap function which was not provided in all circumstances. (Only when CONFIG_PCI and CONFIG_TILEGX was set). I have designs to use them in scatterlist.c where they'd likely never be called with this architecture, but it is needed to compile. Signed-off-by: Logan Gunthorpe

[RFC PATCH 04/16] um: add dummy ioremap and iounmap functions

2017-05-24 Thread Logan Gunthorpe
The user mode architecture does not provide ioremap or iounmap, and because of this, the arch won't build when the functions are used in some core libraries. I have designs to use these functions in scatterlist.c where they'd almost certainly never be called on the um architecture but it does

[RFC PATCH 14/16] block: bio: go straight from pfn_t to phys instead of through page

2017-05-24 Thread Logan Gunthorpe
Going straight from pfn_t to physical address is cheaper and avoids the potential BUG_ON in bvec_page for unmappable memory. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates --- include/linux/bio.h | 7 +-- 1 file changed, 5

[RFC PATCH 03/16] kfifo: Cleanup example to not use page_link

2017-05-24 Thread Logan Gunthorpe
This is a layering violation so we replace the uses with calls to sg_page(). This is a prep patch for replacing page_link and this is one of the very few uses outside of scatterlist.h. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates ---

[RFC PATCH 02/16] staging: ccree: Cleanup: remove references to page_link

2017-05-24 Thread Logan Gunthorpe
This is a layering violation so we replace it with calls to sg_page. This is a prep patch for replacing page_link and this is one of the very few uses outside of scatterlist.h. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates ---

[RFC PATCH 12/16] bvec: use sg_set_pfn when mapping a bio to an sgl

2017-05-24 Thread Logan Gunthorpe
Going through bvec_page and sg_set_page now implies a conversion to and then from a struct page as well as a potential unnecessary BUG_ON check. Instead we go directly from bv_pfn to sg_set_pfn. This is done easily with the following coccinelle patch: @@ expression sg; expression bv; expression

[RFC PATCH 16/16] nvmet: use unmappable sgl in rdma target

2017-05-24 Thread Logan Gunthorpe
This is incomplete but is given to test the unmappable sg page code. Further work would actually use p2p memory in the rdma target. (One should imagine something vaguely resembling our original p2pmem RFC[1] being on top of this.) We convert to using an unmappable sgl in the rdma nvme target

[RFC PATCH 01/16] dmaengine: ste_dma40, imx-dma: Cleanup scatterlist layering violations

2017-05-24 Thread Logan Gunthorpe
Two dma engine drivers directly accesses page_link assuming knowledge that should be contained only in scatterlist.h. We replace these with calls to sg_chain and sg_assign_page. Signed-off-by: Logan Gunthorpe Signed-off-by: Stephen Bates ---

[RFC PATCH 11/16] bvec: convert to using pfn_t internally

2017-05-24 Thread Logan Gunthorpe
With bv_page fenced off, we can now convert it to a pfn_t fairly simply. Everything should work the same with the exception of a BUG_ON for potentially unmappable pfns. A couple of initializers that assign {NULL} to a bio_vec had to also be changed to {} to prevent a warning seeing pfn_t is

[RFC PATCH 08/16] scatterlist: add iomem support to sg_miter and sg_copy_*

2017-05-24 Thread Logan Gunthorpe
IO memory support can be indicated by an iteratee with the SG_MITRE_SUPPORTS_IOMEM flag. If an unmappable sgl gets into a miter without this support, the kernel will BUGON. For supported cases, the sg_miter code will set the ioaddr pointer and leave addr NULL. sg_copy_buffer is changed to