Skip to content

Commit af28388

Browse files
bergwolfTrond Myklebust
authored andcommitted
pnfsblock: cleanup nfs4_blkdev_get
It is not needed at all and it is messing with return values... Reported-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 1fd937b commit af28388

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

fs/nfs/blocklayout/blocklayout.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ struct bl_msg_hdr {
173173
/* blocklayoutdev.c */
174174
ssize_t bl_pipe_downcall(struct file *, const char __user *, size_t);
175175
void bl_pipe_destroy_msg(struct rpc_pipe_msg *);
176-
struct block_device *nfs4_blkdev_get(dev_t dev);
177176
int nfs4_blkdev_put(struct block_device *bdev);
178177
struct pnfs_block_dev *nfs4_blk_decode_device(struct nfs_server *server,
179178
struct pnfs_device *dev);

fs/nfs/blocklayout/blocklayoutdev.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,6 @@ static int decode_sector_number(__be32 **rp, sector_t *sp)
5353
return 0;
5454
}
5555

56-
/* Open a block_device by device number. */
57-
struct block_device *nfs4_blkdev_get(dev_t dev)
58-
{
59-
struct block_device *bd;
60-
61-
dprintk("%s enter\n", __func__);
62-
bd = blkdev_get_by_dev(dev, FMODE_READ, NULL);
63-
if (IS_ERR(bd))
64-
goto fail;
65-
return bd;
66-
fail:
67-
dprintk("%s failed to open device : %ld\n",
68-
__func__, PTR_ERR(bd));
69-
return NULL;
70-
}
71-
7256
/*
7357
* Release the block device
7458
*/
@@ -172,11 +156,12 @@ nfs4_blk_decode_device(struct nfs_server *server,
172156
goto out;
173157
}
174158

175-
bd = nfs4_blkdev_get(MKDEV(reply->major, reply->minor));
159+
bd = blkdev_get_by_dev(MKDEV(reply->major, reply->minor),
160+
FMODE_READ, NULL);
176161
if (IS_ERR(bd)) {
177-
rc = PTR_ERR(bd);
178-
dprintk("%s failed to open device : %d\n", __func__, rc);
179-
rv = ERR_PTR(rc);
162+
dprintk("%s failed to open device : %ld\n", __func__,
163+
PTR_ERR(bd));
164+
rv = ERR_CAST(bd);
180165
goto out;
181166
}
182167

0 commit comments

Comments
 (0)