Re: [PATCH v2 4/6] block: loop: say goodby to bio

2014-08-31 Thread Ming Lei
On Sun, Aug 31, 2014 at 6:14 AM, Elliott, Robert (Server Storage)
 wrote:
>
>
>> -Original Message-
>> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
>> ow...@vger.kernel.org] On Behalf Of Ming Lei
>> Sent: Saturday, 30 August, 2014 11:08 AM
>> To: Jens Axboe; linux-kernel@vger.kernel.org; Dave Kleikamp
>> Cc: Zach Brown; Christoph Hellwig; Maxim Patlasov; Ming Lei
>> Subject: [PATCH v2 4/6] block: loop: say goodby to bio
> ...
>> -static int do_bio_filebacked(struct loop_device *lo, struct bio
>> *bio)
>> +static int do_req_filebacked(struct loop_device *lo, struct request
>> *rq)
>>  {
>>   loff_t pos;
>>   int ret;
>>
>> - pos = ((loff_t) bio->bi_iter.bi_sector << 9) + lo->lo_offset;
>> + pos = ((loff_t) blk_rq_pos(rq) << 9) + lo->lo_offset;
>>
>> - if (bio_rw(bio) == WRITE) {
>> + if (rq->cmd_flags & REQ_WRITE) {
>>   struct file *file = lo->lo_backing_file;
>>
>> - if (bio->bi_rw & REQ_FLUSH) {
>> + if (rq->cmd_flags & REQ_FLUSH) {
>>   ret = vfs_fsync(file, 0);
>>   if (unlikely(ret && ret != -EINVAL)) {
>>   ret = -EIO;
>> @@ -436,7 +439,7 @@ static int do_bio_filebacked(struct loop_device
>> *lo, struct bio *bio)
>>* encryption is enabled, because it may give an attacker
>>* useful information.
>>*/
>> - if (bio->bi_rw & REQ_DISCARD) {
>> + if (rq->cmd_flags & REQ_DISCARD) {
>>   struct file *file = lo->lo_backing_file;
>>   int mode = FALLOC_FL_PUNCH_HOLE |
>> FALLOC_FL_KEEP_SIZE;
>
> Can a REQ_WRITE_SAME make it through to here?

It can't because loop doesn't support WRITE_SAME.


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH v2 4/6] block: loop: say goodby to bio

2014-08-30 Thread Elliott, Robert (Server Storage)


> -Original Message-
> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
> ow...@vger.kernel.org] On Behalf Of Ming Lei
> Sent: Saturday, 30 August, 2014 11:08 AM
> To: Jens Axboe; linux-kernel@vger.kernel.org; Dave Kleikamp
> Cc: Zach Brown; Christoph Hellwig; Maxim Patlasov; Ming Lei
> Subject: [PATCH v2 4/6] block: loop: say goodby to bio
...
> -static int do_bio_filebacked(struct loop_device *lo, struct bio
> *bio)
> +static int do_req_filebacked(struct loop_device *lo, struct request
> *rq)
>  {
>   loff_t pos;
>   int ret;
> 
> - pos = ((loff_t) bio->bi_iter.bi_sector << 9) + lo->lo_offset;
> + pos = ((loff_t) blk_rq_pos(rq) << 9) + lo->lo_offset;
> 
> - if (bio_rw(bio) == WRITE) {
> + if (rq->cmd_flags & REQ_WRITE) {
>   struct file *file = lo->lo_backing_file;
> 
> - if (bio->bi_rw & REQ_FLUSH) {
> + if (rq->cmd_flags & REQ_FLUSH) {
>   ret = vfs_fsync(file, 0);
>   if (unlikely(ret && ret != -EINVAL)) {
>   ret = -EIO;
> @@ -436,7 +439,7 @@ static int do_bio_filebacked(struct loop_device
> *lo, struct bio *bio)
>* encryption is enabled, because it may give an attacker
>* useful information.
>*/
> - if (bio->bi_rw & REQ_DISCARD) {
> + if (rq->cmd_flags & REQ_DISCARD) {
>   struct file *file = lo->lo_backing_file;
>   int mode = FALLOC_FL_PUNCH_HOLE |
> FALLOC_FL_KEEP_SIZE;

Can a REQ_WRITE_SAME make it through to here?


---
Rob ElliottHP Server Storage



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/