Skip to content

Commit

Permalink
test/librbd/fsx.cc: reduce scope of variables
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
(cherry picked from commit af14437)
  • Loading branch information
dalgaaf authored and smithfarm committed Feb 2, 2017
1 parent 83af8cd commit 1ca56f4
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/test/librbd/fsx.cc
Expand Up @@ -627,8 +627,6 @@ krbd_write(struct rbd_ctx *ctx, uint64_t off, size_t len, const char *buf)
int
__krbd_flush(struct rbd_ctx *ctx)
{
int ret;

if (o_direct)
return 0;

Expand All @@ -638,7 +636,7 @@ __krbd_flush(struct rbd_ctx *ctx)
* lifetime of the block device and write directly to it.
*/
if (fsync(ctx->krbd_fd) < 0) {
ret = -errno;
int ret = -errno;
prt("fsync failed\n");
return ret;
}
Expand Down Expand Up @@ -676,10 +674,9 @@ int
krbd_get_size(struct rbd_ctx *ctx, uint64_t *size)
{
uint64_t bytes;
int ret;

if (ioctl(ctx->krbd_fd, BLKGETSIZE64, &bytes) < 0) {
ret = -errno;
int ret = -errno;
prt("BLKGETSIZE64 failed\n");
return ret;
}
Expand Down Expand Up @@ -950,25 +947,22 @@ report_failure(int status)
void
check_buffers(char *good_buf, char *temp_buf, unsigned offset, unsigned size)
{
unsigned char c, t;
unsigned i = 0;
unsigned n = 0;
unsigned op = 0;
unsigned bad = 0;

if (memcmp(good_buf + offset, temp_buf, size) != 0) {
unsigned i = 0;
unsigned n = 0;

prt("READ BAD DATA: offset = 0x%x, size = 0x%x, fname = %s\n",
offset, size, iname);
prt("OFFSET\tGOOD\tBAD\tRANGE\n");
while (size > 0) {
c = good_buf[offset];
t = temp_buf[i];
unsigned char c = good_buf[offset];
unsigned char t = temp_buf[i];
if (c != t) {
if (n < 16) {
bad = short_at(&temp_buf[i]);
unsigned bad = short_at(&temp_buf[i]);
prt("0x%5x\t0x%04x\t0x%04x", offset,
short_at(&good_buf[offset]), bad);
op = temp_buf[offset & 1 ? i+1 : i];
unsigned op = temp_buf[offset & 1 ? i+1 : i];
prt("\t0x%5x\n", n);
if (op)
prt("operation# (mod 256) for "
Expand Down

0 comments on commit 1ca56f4

Please sign in to comment.