Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16568
b: refs/heads/master
c: 014236d
h: refs/heads/master
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jan 6, 2006
1 parent b513f71 commit d46bd2f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bf071bf50580380a8c3afe5eef8152a66be96c7
refs/heads/master: 014236d2b8ec6faea2a6134ab8e019d84d67b524
8 changes: 8 additions & 0 deletions trunk/Documentation/md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,14 @@ Each directory contains:
providing an ongoing count for arrays with metadata managed by
userspace.

slot
This gives the role that the device has in the array. It will
either be 'none' if the device is not active in the array
(i.e. is a spare or has failed) or an integer less than the
'raid_disks' number for the array indicating which possition
it currently fills. This can only be set while assembling an
array. A device for which this is set is assumed to be working.


An active md device will also contain and entry for each active device
in the array. These are named
Expand Down
35 changes: 35 additions & 0 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,10 +1630,45 @@ errors_store(mdk_rdev_t *rdev, const char *buf, size_t len)
static struct rdev_sysfs_entry rdev_errors =
__ATTR(errors, 0644, errors_show, errors_store);

static ssize_t
slot_show(mdk_rdev_t *rdev, char *page)
{
if (rdev->raid_disk < 0)
return sprintf(page, "none\n");
else
return sprintf(page, "%d\n", rdev->raid_disk);
}

static ssize_t
slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
{
char *e;
int slot = simple_strtoul(buf, &e, 10);
if (strncmp(buf, "none", 4)==0)
slot = -1;
else if (e==buf || (*e && *e!= '\n'))
return -EINVAL;
if (rdev->mddev->pers)
/* Cannot set slot in active array (yet) */
return -EBUSY;
if (slot >= rdev->mddev->raid_disks)
return -ENOSPC;
rdev->raid_disk = slot;
/* assume it is working */
rdev->flags = 0;
set_bit(In_sync, &rdev->flags);
return len;
}


static struct rdev_sysfs_entry rdev_slot =
__ATTR(slot, 0644, slot_show, slot_store);

static struct attribute *rdev_default_attrs[] = {
&rdev_state.attr,
&rdev_super.attr,
&rdev_errors.attr,
&rdev_slot.attr,
NULL,
};
static ssize_t
Expand Down

0 comments on commit d46bd2f

Please sign in to comment.