Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: fio@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Subject: [PATCH] Fix testing and setting set_options bitmap
Date: Thu, 25 Jun 2015 22:39:41 +0900	[thread overview]
Message-ID: <1435239581-6642-1-git-send-email-akinobu.mita@gmail.com> (raw)

set_options bitmap is an array of uint64_t.  But while testing and
setting a bit in the bitmap, the bit mask is calculated with an
unsigned long value.  For the systems which have 32-bit long type,
upper 32-bit cannot be set correctly.

Fix it by using (uint64_t)1 instead of 1UL to calculate correct bit
mask.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 options.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/options.c b/options.c
index 76146a7..ed5d37e 100644
--- a/options.c
+++ b/options.c
@@ -4365,7 +4365,7 @@ static int opt_is_set(struct thread_options *o, struct fio_option *opt)
 	opt_off = opt - &fio_options[0];
 	index = opt_off / (8 * sizeof(uint64_t));
 	offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
-	return (o->set_options[index] & (1UL << offset)) != 0;
+	return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
 }
 
 int __fio_option_is_set(struct thread_options *o, unsigned int off1)
@@ -4390,5 +4390,5 @@ void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
 	opt_off = opt - &fio_options[0];
 	index = opt_off / (8 * sizeof(uint64_t));
 	offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
-	o->set_options[index] |= 1UL << offset;
+	o->set_options[index] |= (uint64_t)1 << offset;
 }
-- 
1.9.1


             reply	other threads:[~2015-06-25 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 13:39 Akinobu Mita [this message]
2015-06-25 15:22 ` [PATCH] Fix testing and setting set_options bitmap Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435239581-6642-1-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox