Skip to content

Commit

Permalink
Change blocksize to 512
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yoe committed Nov 28, 2018
1 parent 8689a6a commit 128fd55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nbd-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ void usage(char* errmsg, ...) {
#if HAVE_GNUTLS && !defined(NOTLS)
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");
#endif
fprintf(stderr, "Default value for blocksize is 1024 (recommended for ethernet)\n");
fprintf(stderr, "Default value for blocksize is 512\n");
fprintf(stderr, "Allowed values for blocksize are 512,1024,2048,4096\n"); /* will be checked in kernel :) */
fprintf(stderr, "Note, that kernel 2.4.2 and older ones do not work correctly with\n");
fprintf(stderr, "blocksizes other than 1024 without patches\n");
Expand Down Expand Up @@ -941,7 +941,7 @@ static const char *short_opts = "-A:b:c:C:d:gH:hK:lnN:pSst:uVx";
int main(int argc, char *argv[]) {
char* port=NBD_DEFAULT_PORT;
int sock, nbd;
int blocksize=1024;
int blocksize=512;
char *hostname=NULL;
char *nbddev=NULL;
int swap=0;
Expand Down

0 comments on commit 128fd55

Please sign in to comment.