]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
block: integrity flags can't use bit ops on unsigned short
authorJens Axboe <jens.axboe@oracle.com>
Fri, 27 Jun 2008 07:12:09 +0000 (09:12 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 3 Jul 2008 11:21:15 +0000 (13:21 +0200)
Just use normal open coded bit operations instead, they need not be
atomic.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk-integrity.c
include/linux/blkdev.h

index 4ffa3814f6a997fde4a34d68749728f7c79f52ba..3f1a8478cc384b041c8ef8c66f633eb85e10b36d 100644 (file)
@@ -217,17 +217,16 @@ static ssize_t integrity_read_store(struct blk_integrity *bi,
        unsigned long val = simple_strtoul(p, &p, 10);
 
        if (val)
-               set_bit(INTEGRITY_FLAG_READ, &bi->flags);
+               bi->flags |= INTEGRITY_FLAG_READ;
        else
-               clear_bit(INTEGRITY_FLAG_READ, &bi->flags);
+               bi->flags &= ~INTEGRITY_FLAG_READ;
 
        return count;
 }
 
 static ssize_t integrity_read_show(struct blk_integrity *bi, char *page)
 {
-       return sprintf(page, "%d\n",
-                      test_bit(INTEGRITY_FLAG_READ, &bi->flags) ? 1 : 0);
+       return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_READ) != 0);
 }
 
 static ssize_t integrity_write_store(struct blk_integrity *bi,
@@ -237,17 +236,16 @@ static ssize_t integrity_write_store(struct blk_integrity *bi,
        unsigned long val = simple_strtoul(p, &p, 10);
 
        if (val)
-               set_bit(INTEGRITY_FLAG_WRITE, &bi->flags);
+               bi->flags |= INTEGRITY_FLAG_WRITE;
        else
-               clear_bit(INTEGRITY_FLAG_WRITE, &bi->flags);
+               bi->flags &= ~INTEGRITY_FLAG_WRITE;
 
        return count;
 }
 
 static ssize_t integrity_write_show(struct blk_integrity *bi, char *page)
 {
-       return sprintf(page, "%d\n",
-                      test_bit(INTEGRITY_FLAG_WRITE, &bi->flags) ? 1 : 0);
+       return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_WRITE) != 0);
 }
 
 static struct integrity_sysfs_entry integrity_format_entry = {
@@ -340,8 +338,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
 
                kobject_uevent(&bi->kobj, KOBJ_ADD);
 
-               set_bit(INTEGRITY_FLAG_READ, &bi->flags);
-               set_bit(INTEGRITY_FLAG_WRITE, &bi->flags);
+               bi->flags |= INTEGRITY_FLAG_READ | INTEGRITY_FLAG_WRITE;
                bi->sector_size = disk->queue->hardsect_size;
                disk->integrity = bi;
        } else
index a842b776d0990e1cb9db385825ae57894bb3c7bc..7ab8acad5b6e7980c0a721458dc5d773598cca34 100644 (file)
@@ -870,8 +870,8 @@ void kblockd_flush_work(struct work_struct *work);
 
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
 
-#define INTEGRITY_FLAG_READ    1       /* verify data integrity on read */
-#define INTEGRITY_FLAG_WRITE   2       /* generate data integrity on write */
+#define INTEGRITY_FLAG_READ    2       /* verify data integrity on read */
+#define INTEGRITY_FLAG_WRITE   4       /* generate data integrity on write */
 
 struct blk_integrity_exchg {
        void                    *prot_buf;
@@ -940,11 +940,11 @@ static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
                return 0;
 
        if (rw == READ && bi->verify_fn != NULL &&
-           test_bit(INTEGRITY_FLAG_READ, &bi->flags))
+           (bi->flags & INTEGRITY_FLAG_READ))
                return 1;
 
        if (rw == WRITE && bi->generate_fn != NULL &&
-           test_bit(INTEGRITY_FLAG_WRITE, &bi->flags))
+           (bi->flags & INTEGRITY_FLAG_WRITE))
                return 1;
 
        return 0;