Skip to content

Commit 5224243

Browse files
dwsuseigaw
authored andcommitted
tree: do not open blk device on default
The fd is not needed anymore if the kernel exposes all necessary sysfs entries to fully scan the nvme subsystem. Thus do not alwyas open the blk device and do it only when necessary. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 7959f52 commit 5224243

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

src/nvme/tree.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,6 @@ static void nvme_ns_set_generic_name(struct nvme_ns *n, const char *name)
25012501
static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
25022502
{
25032503
struct nvme_ns *n;
2504-
int fd;
25052504

25062505
n = calloc(1, sizeof(*n));
25072506
if (!n) {
@@ -2512,10 +2511,6 @@ static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
25122511
n->fd = -1;
25132512
n->name = strdup(name);
25142513

2515-
fd = nvme_ns_get_fd(n);
2516-
if (fd < 0)
2517-
goto free_ns;
2518-
25192514
nvme_ns_set_generic_name(n, name);
25202515

25212516
if (nvme_ns_init(sys_path, n) != 0)
@@ -2528,7 +2523,6 @@ static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
25282523
return n;
25292524

25302525
free_ns:
2531-
nvme_ns_release_fd(n);
25322526
free(n->generic_name);
25332527
free(n->name);
25342528
free(n);

0 commit comments

Comments
 (0)