linux-um archives
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: anton.ivanov@cambridgegreys.com, linux-um@lists.infradead.org
Cc: richard@nod.at, hch@lst.de
Subject: Re: [PATCH 1/3] um: Switch to block-mq constants in the UML UBD driver
Date: Mon, 12 Nov 2018 10:48:57 -0700	[thread overview]
Message-ID: <75a2f8a9-ffd8-5d6a-ffb5-a4ab280337fb@kernel.dk> (raw)
In-Reply-To: <20181112174201.12290-2-anton.ivanov@cambridgegreys.com>

On 11/12/18 10:41 AM, anton.ivanov@cambridgegreys.com wrote:
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index 28c40624bcb6..76cd21baac2b 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -43,11 +43,13 @@
>  #include <os.h>
>  #include "cow.h"
>  
> -enum ubd_req { UBD_READ, UBD_WRITE, UBD_FLUSH };
> +#define UBD_SECTOR_SIZE (1 << 9)
> +/* Max request size is determined by sector mask - 32K */
> +#define UBD_MAX_REQUEST (8 * sizeof(long))
>  
>  struct io_thread_req {
>  	struct request *req;
> -	enum ubd_req op;
> +	int op;

You're still adding an op field, even though you did take the suggestion
to use req_op(io_req->req) instead?

> @@ -511,16 +513,13 @@ static void ubd_handler(void)
>  		}
>  		for (count = 0; count < n/sizeof(struct io_thread_req *); count++) {
>  			struct io_thread_req *io_req = (*irq_req_buffer)[count];
> -			int err = io_req->error ? BLK_STS_IOERR : BLK_STS_OK;
>  
> -			if (!blk_update_request(io_req->req, err, io_req->length))
> -				__blk_mq_end_request(io_req->req, err);
> +			if (!blk_update_request(io_req->req, io_req->error, io_req->length))
> +				__blk_mq_end_request(io_req->req, io_req->error);
>  
>  			kfree(io_req);
>  		}
>  	}
> -
> -	reactivate_fd(thread_fd, UBD_IRQ);
>  }

That last change looks unrelated. It may make sense, but it should not be
mixed in with this patch.

> @@ -1413,22 +1410,37 @@ static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
>  	return -EINVAL;
>  }
>  
> +static int map_error(int error_code)
> +{
> +	switch (error_code) {
> +	case 0:
> +		return BLK_STS_OK;
> +	case EOPNOTSUPP:
> +		return BLK_STS_NOTSUPP;
> +	case EPERM:
> +		return BLK_STS_PROTECTION;
> +	case ENOSPC:
> +		return BLK_STS_NOSPC;
> +	}
> +	return BLK_STS_IOERR;
> +}
> +

BLK_STS_PROTECTION is not the right one to use here, that's for data
integrity issues related to DIF/DIX.


-- 
Jens Axboe


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


  reply	other threads:[~2018-11-12 17:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 17:41 New Patch series for the UBD Driver anton.ivanov
2018-11-12 17:41 ` [PATCH 1/3] um: Switch to block-mq constants in the UML UBD driver anton.ivanov
2018-11-12 17:48   ` Jens Axboe [this message]
2018-11-12 17:52     ` Anton Ivanov
2018-11-12 17:42 ` [PATCH 2/3] um: Clean-up command processing in " anton.ivanov
2018-11-12 17:42 ` [PATCH 3/3] um: Add support for DISCARD in the UBD Driver anton.ivanov
2018-11-12 17:50 ` New Patch series for " Jens Axboe
2018-11-12 18:00   ` Anton Ivanov
2018-11-12 18:04     ` Jens Axboe
2018-11-12 18:12       ` Anton Ivanov
2018-11-12 18:14         ` Jens Axboe
2018-11-12 18:23           ` Anton Ivanov
2018-11-12 18:24             ` Anton Ivanov
2018-11-12 18:28             ` Jens Axboe
2018-11-12 18:41               ` Anton Ivanov
2018-11-12 19:11                 ` Jens Axboe
2018-11-12 19:26                   ` Jens Axboe
2018-11-13  8:42                     ` Anton Ivanov
2018-11-13 10:15                       ` Anton Ivanov
2018-11-13 10:20                         ` Anton Ivanov
2018-11-13 13:30                         ` Jens Axboe
2018-11-13 13:56                           ` Anton Ivanov
2018-11-13 15:14                             ` Jens Axboe
2018-11-13 15:24                               ` Anton Ivanov
2018-11-13 15:29                                 ` Jens Axboe

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=75a2f8a9-ffd8-5d6a-ffb5-a4ab280337fb@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=hch@lst.de \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox