Skip to content

Commit

Permalink
tree: do not open blk device on default
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
igaw committed Dec 7, 2023
1 parent 9f1eddc commit 2c15282
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/nvme/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,6 @@ static void nvme_ns_set_generic_name(struct nvme_ns *n, const char *name)
static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
{
struct nvme_ns *n;
int fd;

n = calloc(1, sizeof(*n));
if (!n) {
Expand All @@ -2490,10 +2489,6 @@ static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
n->fd = -1;
n->name = strdup(name);

fd = nvme_ns_get_fd(n);
if (fd < 0)
goto free_ns;

nvme_ns_set_generic_name(n, name);

if (nvme_ns_init(sys_path, n) != 0)
Expand All @@ -2506,7 +2501,6 @@ static nvme_ns_t nvme_ns_open(const char *sys_path, const char *name)
return n;

free_ns:
nvme_ns_release_fd(n);
free(n->generic_name);
free(n->name);
free(n);
Expand Down

0 comments on commit 2c15282

Please sign in to comment.