Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98904
b: refs/heads/master
c: b24498d
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe committed Jul 3, 2008
1 parent e80f01e commit f655954
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06a452e5b95eb669b7ad414ccf587dfc2d91b217
refs/heads/master: b24498d477a14680fc3bb3ad884fa9fa76a2d237
17 changes: 7 additions & 10 deletions trunk/block/blk-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f655954

Please sign in to comment.