@@ -479,6 +479,11 @@ static int btrfs_scan_kernel(void *search, unsigned unit_mode)
479479
480480 fd = open (mnt -> mnt_dir , O_RDONLY );
481481 if ((fd != -1 ) && !get_df (fd , & space_info_arg )) {
482+ /* put spacing between filesystem entries for readability */
483+ if (found != 0 ) {
484+ pr_verbose (LOG_DEFAULT , "\n" );
485+ }
486+
482487 print_one_fs (& fs_info_arg , dev_info_arg ,
483488 space_info_arg , label , unit_mode );
484489 free (space_info_arg );
@@ -755,6 +760,7 @@ static int cmd_filesystem_show(const struct cmd_struct *cmd,
755760 char uuid_buf [BTRFS_UUID_UNPARSED_SIZE ];
756761 unsigned unit_mode ;
757762 int found = 0 ;
763+ int needs_newline = 0 ;
758764
759765 unit_mode = get_unit_mode_from_arg (& argc , argv , 0 );
760766
@@ -843,6 +849,9 @@ static int cmd_filesystem_show(const struct cmd_struct *cmd,
843849 goto out ;
844850 }
845851
852+ /* the above call will return 0 if it found anything, in those cases we need an extra newline below */
853+ needs_newline = !ret ;
854+
846855 /* shows mounted only */
847856 if (where == BTRFS_SCAN_MOUNTED )
848857 goto out ;
@@ -880,8 +889,14 @@ static int cmd_filesystem_show(const struct cmd_struct *cmd,
880889 goto out ;
881890 }
882891
883- list_for_each_entry (fs_devices , & all_uuids , fs_list )
892+ list_for_each_entry (fs_devices , & all_uuids , fs_list ) {
893+ /* put spacing between filesystem entries for readability */
894+ if (needs_newline ) {
895+ pr_verbose (LOG_DEFAULT , "\n" );
896+ }
884897 print_one_uuid (fs_devices , unit_mode );
898+ needs_newline = true;
899+ }
885900
886901 if (search && !found ) {
887902 error ("not a valid btrfs filesystem: %s" , search );
0 commit comments