aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-integrity.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-06-27 03:12:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-07-03 07:21:15 -0400
commitb24498d477a14680fc3bb3ad884fa9fa76a2d237 (patch)
tree1ba2c9f24b3f22f45fa424ad904fb6dcc5d67790 /block/blk-integrity.c
parent06a452e5b95eb669b7ad414ccf587dfc2d91b217 (diff)
block: integrity flags can't use bit ops on unsigned short
Just use normal open coded bit operations instead, they need not be atomic. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-integrity.c')
-rw-r--r--block/blk-integrity.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 4ffa3814f6a9..3f1a8478cc38 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -217,17 +217,16 @@ static ssize_t integrity_read_store(struct blk_integrity *bi,
217 unsigned long val = simple_strtoul(p, &p, 10); 217 unsigned long val = simple_strtoul(p, &p, 10);
218 218
219 if (val) 219 if (val)
220 set_bit(INTEGRITY_FLAG_READ, &bi->flags); 220 bi->flags |= INTEGRITY_FLAG_READ;
221 else 221 else
222 clear_bit(INTEGRITY_FLAG_READ, &bi->flags); 222 bi->flags &= ~INTEGRITY_FLAG_READ;
223 223
224 return count; 224 return count;
225} 225}
226 226
227static ssize_t integrity_read_show(struct blk_integrity *bi, char *page) 227static ssize_t integrity_read_show(struct blk_integrity *bi, char *page)
228{ 228{
229 return sprintf(page, "%d\n", 229 return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_READ) != 0);
230 test_bit(INTEGRITY_FLAG_READ, &bi->flags) ? 1 : 0);
231} 230}
232 231
233static ssize_t integrity_write_store(struct blk_integrity *bi, 232static ssize_t integrity_write_store(struct blk_integrity *bi,
@@ -237,17 +236,16 @@ static ssize_t integrity_write_store(struct blk_integrity *bi,
237 unsigned long val = simple_strtoul(p, &p, 10); 236 unsigned long val = simple_strtoul(p, &p, 10);
238 237
239 if (val) 238 if (val)
240 set_bit(INTEGRITY_FLAG_WRITE, &bi->flags); 239 bi->flags |= INTEGRITY_FLAG_WRITE;
241 else 240 else
242 clear_bit(INTEGRITY_FLAG_WRITE, &bi->flags); 241 bi->flags &= ~INTEGRITY_FLAG_WRITE;
243 242
244 return count; 243 return count;
245} 244}
246 245
247static ssize_t integrity_write_show(struct blk_integrity *bi, char *page) 246static ssize_t integrity_write_show(struct blk_integrity *bi, char *page)
248{ 247{
249 return sprintf(page, "%d\n", 248 return sprintf(page, "%d\n", (bi->flags & INTEGRITY_FLAG_WRITE) != 0);
250 test_bit(INTEGRITY_FLAG_WRITE, &bi->flags) ? 1 : 0);
251} 249}
252 250
253static struct integrity_sysfs_entry integrity_format_entry = { 251static struct integrity_sysfs_entry integrity_format_entry = {
@@ -340,8 +338,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
340 338
341 kobject_uevent(&bi->kobj, KOBJ_ADD); 339 kobject_uevent(&bi->kobj, KOBJ_ADD);
342 340
343 set_bit(INTEGRITY_FLAG_READ, &bi->flags); 341 bi->flags |= INTEGRITY_FLAG_READ | INTEGRITY_FLAG_WRITE;
344 set_bit(INTEGRITY_FLAG_WRITE, &bi->flags);
345 bi->sector_size = disk->queue->hardsect_size; 342 bi->sector_size = disk->queue->hardsect_size;
346 disk->integrity = bi; 343 disk->integrity = bi;
347 } else 344 } else