Skip to content

Commit 8459283

Browse files
keithbuschaxboe
authored andcommitted
null_blk: consistently use blk_status_t
No need to mix errno and blk_status_t error types. Just use the standard block layer type. Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Tested-by: Hans Holmberg <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 1165d20 commit 8459283

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

drivers/block/null_blk/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ static int null_make_cache_space(struct nullb *nullb, unsigned long n)
11291129
return 0;
11301130
}
11311131

1132-
static int copy_to_nullb(struct nullb *nullb, struct page *source,
1132+
static blk_status_t copy_to_nullb(struct nullb *nullb, struct page *source,
11331133
unsigned int off, sector_t sector, size_t n, bool is_fua)
11341134
{
11351135
size_t temp, count = 0;
@@ -1146,7 +1146,7 @@ static int copy_to_nullb(struct nullb *nullb, struct page *source,
11461146
t_page = null_insert_page(nullb, sector,
11471147
!null_cache_active(nullb) || is_fua);
11481148
if (!t_page)
1149-
return -ENOSPC;
1149+
return BLK_STS_NOSPC;
11501150

11511151
memcpy_page(t_page->page, offset, source, off + count, temp);
11521152

@@ -1158,7 +1158,7 @@ static int copy_to_nullb(struct nullb *nullb, struct page *source,
11581158
count += temp;
11591159
sector += temp >> SECTOR_SHIFT;
11601160
}
1161-
return 0;
1161+
return BLK_STS_OK;
11621162
}
11631163

11641164
static void copy_from_nullb(struct nullb *nullb, struct page *dest,
@@ -1233,13 +1233,13 @@ static blk_status_t null_handle_flush(struct nullb *nullb)
12331233
return errno_to_blk_status(err);
12341234
}
12351235

1236-
static int null_transfer(struct nullb *nullb, struct page *page,
1236+
static blk_status_t null_transfer(struct nullb *nullb, struct page *page,
12371237
unsigned int len, unsigned int off, bool is_write, sector_t sector,
12381238
bool is_fua)
12391239
{
12401240
struct nullb_device *dev = nullb->dev;
1241+
blk_status_t err = BLK_STS_OK;
12411242
unsigned int valid_len = len;
1242-
int err = 0;
12431243

12441244
if (!is_write) {
12451245
if (dev->zoned)
@@ -1273,7 +1273,7 @@ static blk_status_t null_handle_data_transfer(struct nullb_cmd *cmd,
12731273
{
12741274
struct request *rq = blk_mq_rq_from_pdu(cmd);
12751275
struct nullb *nullb = cmd->nq->dev->nullb;
1276-
int err = 0;
1276+
blk_status_t err = BLK_STS_OK;
12771277
unsigned int len;
12781278
sector_t sector = blk_rq_pos(rq);
12791279
unsigned int max_bytes = nr_sectors << SECTOR_SHIFT;
@@ -1298,7 +1298,7 @@ static blk_status_t null_handle_data_transfer(struct nullb_cmd *cmd,
12981298
}
12991299
spin_unlock_irq(&nullb->lock);
13001300

1301-
return errno_to_blk_status(err);
1301+
return err;
13021302
}
13031303

13041304
static inline blk_status_t null_handle_throttled(struct nullb_cmd *cmd)

0 commit comments

Comments
 (0)