Turn io_u filled variable into a flag
authorJens Axboe <jaxboe@fusionio.com>
Wed, 14 Jul 2010 06:42:03 +0000 (08:42 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Wed, 14 Jul 2010 06:42:03 +0000 (08:42 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
io_u.c
ioengine.h
verify.c

diff --git a/io_u.c b/io_u.c
index dc4473beab1737660f2ebeb2f1c91418b1a14da6..88b2b9f32a844aaffb11e5d4e5c2fc95951a4890 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -988,7 +988,7 @@ struct io_u *get_io_u(struct thread_data *td)
                         * Reset the buf_filled parameters so next time if the
                         * buffer is used for writes it is refilled.
                         */
-                       io_u->buf_filled = 0;
+                       io_u->flags &= ~IO_U_F_FILLED;
                        io_u->buf_filled_len = 0;
                }
        }
index b599b6152c591de806dda5f0d8b4dac5e9d331a2..343b06fb3601711ae190037c497c128ed9df93f7 100644 (file)
@@ -8,6 +8,7 @@ enum {
        IO_U_F_FLIGHT           = 1 << 1,
        IO_U_F_FREE_DEF         = 1 << 2,
        IO_U_F_IN_CUR_DEPTH     = 1 << 3,
+       IO_U_F_FILLED           = 1 << 4,
 };
 
 /*
@@ -42,13 +43,6 @@ struct io_u {
        unsigned long buflen;
        unsigned long long offset;
 
-       /*
-        * Parameters related to pre-filled buffers and
-        * their size to handle variable block sizes.
-        */
-       int buf_filled;
-       unsigned long buf_filled_len;
-
        /*
         * IO engine state, may be different from above when we get
         * partial transfers / residual data counts
@@ -56,6 +50,12 @@ struct io_u {
        void *xfer_buf;
        unsigned long xfer_buflen;
 
+       /*
+        * Parameter related to pre-filled buffers and
+        * their size to handle variable block sizes.
+        */
+       unsigned long buf_filled_len;
+
        unsigned int resid;
        unsigned int error;
 
index 73c1262946f5c93a7deb5b28b898b2f4a6720c56..098c19bcafc38d7f5e994ac80acec566245b660d 100644 (file)
--- a/verify.c
+++ b/verify.c
@@ -30,20 +30,22 @@ void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u
                fill_random_buf(p, len);
                break;
        case 1:
-               if (io_u->buf_filled && io_u->buf_filled_len >= len) {
+               if ((io_u->flags & IO_U_F_FILLED) &&
+                    io_u->buf_filled_len >= len) {
                        dprint(FD_VERIFY, "using already filled verify pattern b=0 len=%u\n", len);
                        return;
                }
                dprint(FD_VERIFY, "fill verify pattern b=0 len=%u\n", len);
                memset(p, td->o.verify_pattern[0], len);
-               io_u->buf_filled = 1;
+               io_u->flags |= IO_U_F_FILLED;
                io_u->buf_filled_len = len;
                break;
        default: {
                unsigned int i = 0, size = 0;
                unsigned char *b = p;
 
-               if (io_u->buf_filled && io_u->buf_filled_len >= len) {
+               if ((io_u->flags & IO_U_F_FILLED) &&
+                    io_u->buf_filled_len >= len) {
                        dprint(FD_VERIFY, "using already filled verify pattern b=%d len=%u\n",
                                        td->o.verify_pattern_bytes, len);
                        return;
@@ -58,7 +60,7 @@ void fill_pattern(struct thread_data *td, void *p, unsigned int len, struct io_u
                        memcpy(b+i, td->o.verify_pattern, size);
                        i += size;
                }
-               io_u->buf_filled = 1;
+               io_u->flags |= IO_U_F_FILLED;
                io_u->buf_filled_len = len;
                break;
                }