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]>
igaw committed Dec 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7959f52 commit 5224243
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
@@ -2501,7 +2501,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) {
@@ -2512,10 +2511,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)
@@ -2528,7 +2523,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);

0 comments on commit 5224243

Please sign in to comment.