Skip to content

Commit 128fd55

Browse files
committed
Change blocksize to 512
1024 bytes was originally chosen as fitting nicely inside an ethernet frame. That didn't really make much sense, but the issue was masked by the kernel actually ignoring block sizes due to a bug. Now that the kernel bug is fixed, the result is that partitions are parsed incorrectly, resulting in confusing behaviour. Fix by defaulting to 512. For the rare case where 1024 bytes still makes sense, the -b parameter still exists.
1 parent 8689a6a commit 128fd55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nbd-client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ void usage(char* errmsg, ...) {
910910
#if HAVE_GNUTLS && !defined(NOTLS)
911911
fprintf(stderr, "All commands that connect to a host also take:\n\t[-F|-certfile certfile] [-K|-keyfile keyfile]\n\t[-A|-cacertfile cacertfile] [-H|-tlshostname hostname] [-x|-enable-tls]\n");
912912
#endif
913-
fprintf(stderr, "Default value for blocksize is 1024 (recommended for ethernet)\n");
913+
fprintf(stderr, "Default value for blocksize is 512\n");
914914
fprintf(stderr, "Allowed values for blocksize are 512,1024,2048,4096\n"); /* will be checked in kernel :) */
915915
fprintf(stderr, "Note, that kernel 2.4.2 and older ones do not work correctly with\n");
916916
fprintf(stderr, "blocksizes other than 1024 without patches\n");
@@ -941,7 +941,7 @@ static const char *short_opts = "-A:b:c:C:d:gH:hK:lnN:pSst:uVx";
941941
int main(int argc, char *argv[]) {
942942
char* port=NBD_DEFAULT_PORT;
943943
int sock, nbd;
944-
int blocksize=1024;
944+
int blocksize=512;
945945
char *hostname=NULL;
946946
char *nbddev=NULL;
947947
int swap=0;

0 commit comments

Comments
 (0)