• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/md/

Lines Matching refs:mddev

64 	return bitmap->mddev ? mdname(bitmap->mddev) : "mdX";
191 static struct page *read_sb_page(mddev_t *mddev, loff_t offset,
208 list_for_each_entry(rdev, &mddev->disks, same_set) {
230 static mdk_rdev_t *next_active_rdev(mdk_rdev_t *rdev, mddev_t *mddev)
232 /* Iterate the disks of an mddev, using rcu to protect access to the
244 pos = &mddev->disks;
247 rdev_dec_pending(rdev, mddev);
250 list_for_each_continue_rcu(pos, &mddev->disks) {
267 mddev_t *mddev = bitmap->mddev;
269 while ((rdev = next_active_rdev(rdev, mddev)) != NULL) {
271 loff_t offset = mddev->bitmap_info.offset;
278 if (mddev->external) {
285 < (rdev->data_offset + mddev->dev_sectors
295 if (rdev->data_offset + mddev->dev_sectors
310 md_super_write(mddev, rdev,
318 md_super_wait(mddev);
480 if (!bitmap || !bitmap->mddev) /* no bitmap for this array */
482 if (bitmap->mddev->bitmap_info.external)
491 sb->events = cpu_to_le64(bitmap->mddev->events);
492 if (bitmap->mddev->events < bitmap->events_cleared) {
494 bitmap->events_cleared = bitmap->mddev->events;
498 sb->daemon_sleep = cpu_to_le32(bitmap->mddev->bitmap_info.daemon_sleep/HZ);
499 sb->write_behind = cpu_to_le32(bitmap->mddev->bitmap_info.max_write_behind);
549 bitmap->sb_page = read_sb_page(bitmap->mddev,
550 bitmap->mddev->bitmap_info.offset,
587 sb->sync_size = cpu_to_le64(bitmap->mddev->resync_max_sectors);
589 if (!bitmap->mddev->persistent)
594 * bitmap's UUID and event counter to the mddev's
596 if (memcmp(sb->uuid, bitmap->mddev->uuid, 16)) {
602 if (events < bitmap->mddev->events) {
605 (unsigned long long) bitmap->mddev->events);
610 bitmap->mddev->bitmap_info.chunksize = chunksize;
611 bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep;
612 bitmap->mddev->bitmap_info.max_write_behind = write_behind;
618 bitmap->events_cleared = bitmap->mddev->events;
675 if (!bitmap->mddev->bitmap_info.external)
683 if (!bitmap->mddev->bitmap_info.external)
838 struct dm_dirty_log *log = bitmap->mddev->bitmap_info.log;
875 struct dm_dirty_log *log = bitmap->mddev->bitmap_info.log;
909 md_super_wait(bitmap->mddev);
943 BUG_ON(!file && !bitmap->mddev->bitmap_info.offset);
955 if (!bitmap->mddev->bitmap_info.external)
1004 bitmap->mddev,
1005 bitmap->mddev->bitmap_info.offset,
1012 page = read_sb_page(bitmap->mddev,
1013 bitmap->mddev->bitmap_info.offset,
1068 set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery);
1069 md_wakeup_thread(bitmap->mddev->thread);
1112 void bitmap_daemon_work(mddev_t *mddev)
1120 struct dm_dirty_log *log = mddev->bitmap_info.log;
1125 mutex_lock(&mddev->bitmap_info.mutex);
1126 bitmap = mddev->bitmap;
1128 mutex_unlock(&mddev->bitmap_info.mutex);
1132 + bitmap->mddev->bitmap_info.daemon_sleep))
1137 bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1188 bitmap->mddev->bitmap_info.external == 0) {
1255 bitmap->mddev->thread->timeout =
1256 bitmap->mddev->bitmap_info.daemon_sleep;
1257 mutex_unlock(&mddev->bitmap_info.mutex);
1338 md_unplug(bitmap->mddev);
1379 if (bitmap->mddev->degraded)
1396 bitmap->events_cleared < bitmap->mddev->events) {
1397 bitmap->events_cleared = bitmap->mddev->events;
1521 while (sector < bitmap->mddev->resync_max_sectors) {
1540 + bitmap->mddev->bitmap_info.daemon_sleep)))
1542 wait_event(bitmap->mddev->recovery_wait,
1543 atomic_read(&bitmap->mddev->recovery_active) == 0);
1545 bitmap->mddev->curr_resync_completed = bitmap->mddev->curr_resync;
1546 set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags);
1549 while (s < sector && s < bitmap->mddev->resync_max_sectors) {
1554 sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed");
1593 if (sec < bitmap->mddev->recovery_cp)
1598 bitmap->mddev->recovery_cp = sec;
1605 void bitmap_flush(mddev_t *mddev)
1607 struct bitmap *bitmap = mddev->bitmap;
1616 sleep = mddev->bitmap_info.daemon_sleep * 2;
1618 bitmap_daemon_work(mddev);
1620 bitmap_daemon_work(mddev);
1622 bitmap_daemon_work(mddev);
1653 void bitmap_destroy(mddev_t *mddev)
1655 struct bitmap *bitmap = mddev->bitmap;
1660 mutex_lock(&mddev->bitmap_info.mutex);
1661 mddev->bitmap = NULL; /* disconnect from the md device */
1662 mutex_unlock(&mddev->bitmap_info.mutex);
1663 if (mddev->thread)
1664 mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
1676 int bitmap_create(mddev_t *mddev)
1679 sector_t blocks = mddev->resync_max_sectors;
1682 struct file *file = mddev->bitmap_info.file;
1689 && !mddev->bitmap_info.offset
1690 && !mddev->bitmap_info.log) /* bitmap disabled, nothing to do */
1693 BUG_ON(file && mddev->bitmap_info.offset);
1694 BUG_ON(mddev->bitmap_info.offset && mddev->bitmap_info.log);
1706 bitmap->mddev = mddev;
1708 if (mddev->kobj.sd)
1709 bm = sysfs_get_dirent(mddev->kobj.sd, NULL, "bitmap");
1725 /* read superblock from bitmap file (this sets mddev->bitmap_info.chunksize) */
1726 if (!mddev->bitmap_info.external)
1730 if (mddev->bitmap_info.chunksize == 0 ||
1731 mddev->bitmap_info.daemon_sleep == 0)
1740 bitmap->chunkshift = ffz(~mddev->bitmap_info.chunksize);
1768 mddev->bitmap = bitmap;
1778 int bitmap_load(mddev_t *mddev)
1782 struct bitmap *bitmap = mddev->bitmap;
1792 while (sector < mddev->resync_max_sectors) {
1799 if (mddev->bitmap_info.log) {
1801 struct dm_dirty_log *log = mddev->bitmap_info.log;
1809 if (mddev->degraded == 0
1810 || bitmap->events_cleared == mddev->events)
1813 start = mddev->recovery_cp;
1820 mddev->thread->timeout = mddev->bitmap_info.daemon_sleep;
1821 md_wakeup_thread(mddev->thread);
1833 location_show(mddev_t *mddev, char *page)
1836 if (mddev->bitmap_info.file)
1838 else if (mddev->bitmap_info.offset)
1839 len = sprintf(page, "%+lld", (long long)mddev->bitmap_info.offset);
1847 location_store(mddev_t *mddev, const char *buf, size_t len)
1850 if (mddev->pers) {
1851 if (!mddev->pers->quiesce)
1853 if (mddev->recovery || mddev->sync_thread)
1857 if (mddev->bitmap || mddev->bitmap_info.file ||
1858 mddev->bitmap_info.offset) {
1862 if (mddev->pers) {
1863 mddev->pers->quiesce(mddev, 1);
1864 bitmap_destroy(mddev);
1865 mddev->pers->quiesce(mddev, 0);
1867 mddev->bitmap_info.offset = 0;
1868 if (mddev->bitmap_info.file) {
1869 struct file *f = mddev->bitmap_info.file;
1870 mddev->bitmap_info.file = NULL;
1892 if (mddev->bitmap_info.external == 0 &&
1893 mddev->major_version == 0 &&
1894 offset != mddev->bitmap_info.default_offset)
1896 mddev->bitmap_info.offset = offset;
1897 if (mddev->pers) {
1898 mddev->pers->quiesce(mddev, 1);
1899 rv = bitmap_create(mddev);
1901 bitmap_destroy(mddev);
1902 mddev->bitmap_info.offset = 0;
1904 mddev->pers->quiesce(mddev, 0);
1910 if (!mddev->external) {
1914 set_bit(MD_CHANGE_DEVS, &mddev->flags);
1915 md_wakeup_thread(mddev->thread);
1924 timeout_show(mddev_t *mddev, char *page)
1927 unsigned long secs = mddev->bitmap_info.daemon_sleep / HZ;
1928 unsigned long jifs = mddev->bitmap_info.daemon_sleep % HZ;
1938 timeout_store(mddev_t *mddev, const char *buf, size_t len)
1956 mddev->bitmap_info.daemon_sleep = timeout;
1957 if (mddev->thread) {
1962 if (mddev->thread->timeout < MAX_SCHEDULE_TIMEOUT) {
1963 mddev->thread->timeout = timeout;
1964 md_wakeup_thread(mddev->thread);
1974 backlog_show(mddev_t *mddev, char *page)
1976 return sprintf(page, "%lu\n", mddev->bitmap_info.max_write_behind);
1980 backlog_store(mddev_t *mddev, const char *buf, size_t len)
1988 mddev->bitmap_info.max_write_behind = backlog;
1996 chunksize_show(mddev_t *mddev, char *page)
1998 return sprintf(page, "%lu\n", mddev->bitmap_info.chunksize);
2002 chunksize_store(mddev_t *mddev, const char *buf, size_t len)
2007 if (mddev->bitmap)
2015 mddev->bitmap_info.chunksize = csize;
2022 static ssize_t metadata_show(mddev_t *mddev, char *page)
2024 return sprintf(page, "%s\n", (mddev->bitmap_info.external
2028 static ssize_t metadata_store(mddev_t *mddev, const char *buf, size_t len)
2030 if (mddev->bitmap ||
2031 mddev->bitmap_info.file ||
2032 mddev->bitmap_info.offset)
2035 mddev->bitmap_info.external = 1;
2037 mddev->bitmap_info.external = 0;
2046 static ssize_t can_clear_show(mddev_t *mddev, char *page)
2049 if (mddev->bitmap)
2050 len = sprintf(page, "%s\n", (mddev->bitmap->need_sync ?
2057 static ssize_t can_clear_store(mddev_t *mddev, const char *buf, size_t len)
2059 if (mddev->bitmap == NULL)
2062 mddev->bitmap->need_sync = 1;
2064 if (mddev->degraded)
2066 mddev->bitmap->need_sync = 0;
2076 behind_writes_used_show(mddev_t *mddev, char *page)
2078 if (mddev->bitmap == NULL)
2081 mddev->bitmap->behind_writes_used);
2085 behind_writes_used_reset(mddev_t *mddev, const char *buf, size_t len)
2087 if (mddev->bitmap)
2088 mddev->bitmap->behind_writes_used = 0;