mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
bcacheadm fixes
Change-Id: I3f6024d54aee263ef843705a0e9a02869e2a53e9
This commit is contained in:
parent
7763a86ca8
commit
7916b2eb3b
19
Makefile
19
Makefile
@ -3,15 +3,16 @@ PREFIX=/usr
|
||||
UDEVLIBDIR=/lib/udev
|
||||
DRACUTLIBDIR=/lib/dracut
|
||||
INSTALL=install
|
||||
CFLAGS+=-O2 -Wall -Werror -g
|
||||
CFLAGS+=-O2 -Wall -Werror -g -I.
|
||||
|
||||
all: make-bcache probe-bcache bcache-super-show bcachectl
|
||||
all: bcacheadm make-bcache probe-bcache bcachectl
|
||||
|
||||
install: make-bcache probe-bcache bcache-super-show
|
||||
$(INSTALL) -m0755 make-bcache bcache-super-show bcachectl $(DESTDIR)${PREFIX}/sbin/
|
||||
install: bcacheadm make-bcache probe-bcache
|
||||
$(INSTALL) -m0755 bcacheadm bcachectl $(DESTDIR)${PREFIX}/sbin/
|
||||
$(INSTALL) -m0755 make-bcache bcachectl $(DESTDIR)${PREFIX}/sbin/
|
||||
$(INSTALL) -m0755 probe-bcache bcache-register $(DESTDIR)$(UDEVLIBDIR)/
|
||||
$(INSTALL) -m0644 69-bcache.rules $(DESTDIR)$(UDEVLIBDIR)/rules.d/
|
||||
-$(INSTALL) -T -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
|
||||
#-$(INSTALL) -T -m0755 initramfs/hook $(DESTDIR)/usr/share/initramfs-tools/hooks/bcache
|
||||
if [ -d $(DESTDIR)$(DRACUTLIBDIR)/modules.d ]; \
|
||||
then $(INSTALL) -D -m0755 dracut/module-setup.sh $(DESTDIR)$(DRACUTLIBDIR)/modules.d/90bcache/module-setup.sh; \
|
||||
fi
|
||||
@ -22,12 +23,20 @@ clean:
|
||||
$(RM) -f make-bcache probe-bcache bcache-super-show bcache-test bcachectl *.o
|
||||
|
||||
bcache-test: LDLIBS += `pkg-config --libs openssl`
|
||||
|
||||
bcacheadm: LDLIBS += `pkg-config --libs uuid blkid libnih`
|
||||
bcacheadm: CFLAGS += `pkg-config --cflags uuid blkid libnih`
|
||||
bcacheadm: bcache.o
|
||||
|
||||
make-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
||||
make-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
||||
make-bcache: bcache.o
|
||||
|
||||
probe-bcache: LDLIBS += `pkg-config --libs uuid blkid`
|
||||
probe-bcache: CFLAGS += `pkg-config --cflags uuid blkid`
|
||||
|
||||
bcache-super-show: LDLIBS += `pkg-config --libs uuid`
|
||||
bcache-super-show: CFLAGS += -std=gnu99
|
||||
bcache-super-show: bcache.o
|
||||
|
||||
bcachectl: bcachectl.o
|
||||
|
1
bcache.c
1
bcache.c
@ -1042,7 +1042,6 @@ char *list_cachesets(char *cset_dir, bool list_devs)
|
||||
while ((ent = readdir(dir)) != NULL) {
|
||||
struct stat statbuf;
|
||||
char entry[MAX_PATH];
|
||||
struct dirent *cache_ent;
|
||||
|
||||
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
|
||||
continue;
|
||||
|
14
bcacheadm.c
14
bcacheadm.c
@ -125,6 +125,8 @@ static int set_cache(NihOption *option, const char *arg)
|
||||
|
||||
devs++;
|
||||
nr_cache_devices++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_bdev(NihOption *option, const char *arg)
|
||||
@ -404,6 +406,8 @@ int bcache_query_devs(NihCommand *command, char *const *args)
|
||||
if(uuid_only)
|
||||
printf("%s\n", dev_uuid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bcache_status(NihCommand *command, char *const *args)
|
||||
@ -418,19 +422,23 @@ int bcache_status(NihCommand *command, char *const *args)
|
||||
sb->nr_this_dev;
|
||||
long long unsigned cache_tier = CACHE_TIER(m);
|
||||
|
||||
if (!cache_tier)
|
||||
if (!cache_tier) {
|
||||
if (!sb_tier0 || sb->seq > sb_tier0->seq) {
|
||||
sb_tier0 = sb;
|
||||
dev0 = args[i];
|
||||
}
|
||||
else if (cache_tier == 1)
|
||||
} else if (cache_tier == 1) {
|
||||
if (!sb_tier1 || sb->seq > sb_tier1->seq) {
|
||||
sb_tier1 = sb;
|
||||
dev1 = args[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sb_tier0) sb_state(sb_tier0, dev0);
|
||||
if (sb_tier1) sb_state(sb_tier1, dev1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *stats_subdir(char* stats_dir)
|
||||
@ -562,4 +570,6 @@ int main(int argc, char *argv[])
|
||||
exit (1);
|
||||
|
||||
nih_signal_reset();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user