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 <dwagner@suse.de>
  • Loading branch information
igaw committed Dec 7, 2023
1 parent 44adf49 commit 1cbca2d
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 @@ -2478,7 +2478,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 @@ -2489,10 +2488,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 @@ -2505,7 +2500,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 1cbca2d

Please sign in to comment.