diff mbox

[5/5] btrfs-progs: add warning when we fail to read sysfs or version

Message ID 1448283378-10579-6-git-send-email-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Nov. 23, 2015, 12:56 p.m. UTC
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 btrfs-convert.c | 10 +++++++++-
 mkfs.c          |  8 +++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/btrfs-convert.c b/btrfs-convert.c
index 52ea12a..b0a998b 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -2898,14 +2898,22 @@  int main(int argc, char *argv[])
 	char fslabel[BTRFS_LABEL_SIZE];
 	u64 features;
 
-	if (btrfs_features_allowed_by_sysfs(&features))
+	if (btrfs_features_allowed_by_sysfs(&features)) {
+		fprintf(stderr,
+		"Warning: Failed/Unsupported to obtain feature list from sysfs\n");
+
 		features = btrfs_features_allowed_by_kernel();
+		if (!features)
+			fprintf(stderr,
+		"Warning: Failed/Unsupported to get running kernel version\n");
+	}
 
 	if (features)
 		features &= BTRFS_MKFS_DEFAULT_FEATURES;
 	else
 		features = BTRFS_MKFS_DEFAULT_FEATURES;
 
+
 	while(1) {
 		enum { GETOPT_VAL_NO_PROGRESS = 256 };
 		static const struct option long_options[] = {
diff --git a/mkfs.c b/mkfs.c
index 4f46ad9..6cb998b 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1367,8 +1367,14 @@  int main(int ac, char **av)
 	 * fails then default to the progs default, which is set as per
 	 * BTRFS_MKFS_DEFAULT_FEATURES
 	 */
-	if (btrfs_features_allowed_by_sysfs(&features))
+	if (btrfs_features_allowed_by_sysfs(&features)) {
+		fprintf(stderr,
+		"Warning: Failed/Unsupported to obtain feature list from sysfs\n");
 		features = btrfs_features_allowed_by_kernel();
+		if (!features)
+			fprintf(stderr,
+		"Warning: Failed/Unsupported to get running kernel version\n");
+	}
 
 	if (features)
 		features &= BTRFS_MKFS_DEFAULT_FEATURES;