• 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:lc

284 static int rw_header(struct log_c *lc, int rw)
286 lc->io_req.bi_rw = rw;
288 return dm_io(&lc->io_req, 1, &lc->header_location, NULL);
291 static int flush_header(struct log_c *lc)
294 .bdev = lc->header_location.bdev,
299 lc->io_req.bi_rw = WRITE_BARRIER;
301 return dm_io(&lc->io_req, 1, &null_location, NULL);
357 struct log_c *lc;
388 lc = kmalloc(sizeof(*lc), GFP_KERNEL);
389 if (!lc) {
394 lc->ti = ti;
395 lc->touched_dirtied = 0;
396 lc->touched_cleaned = 0;
397 lc->flush_failed = 0;
398 lc->region_size = region_size;
399 lc->region_count = region_count;
400 lc->sync = sync;
406 sizeof(*lc->clean_bits) << BYTE_SHIFT);
409 lc->bitset_uint32_count = bitset_size / sizeof(*lc->clean_bits);
415 lc->clean_bits = vmalloc(bitset_size);
416 if (!lc->clean_bits) {
418 kfree(lc);
421 lc->disk_header = NULL;
423 lc->log_dev = dev;
424 lc->log_dev_failed = 0;
425 lc->log_dev_flush_failed = 0;
426 lc->header_location.bdev = lc->log_dev->bdev;
427 lc->header_location.sector = 0;
434 bdev_logical_block_size(lc->header_location.
440 kfree(lc);
444 lc->header_location.count = buf_size >> SECTOR_SHIFT;
446 lc->io_req.mem.type = DM_IO_VMA;
447 lc->io_req.notify.fn = NULL;
448 lc->io_req.client = dm_io_client_create(dm_div_up(buf_size,
450 if (IS_ERR(lc->io_req.client)) {
451 r = PTR_ERR(lc->io_req.client);
453 kfree(lc);
457 lc->disk_header = vmalloc(buf_size);
458 if (!lc->disk_header) {
460 dm_io_client_destroy(lc->io_req.client);
461 kfree(lc);
465 lc->io_req.mem.ptr.vma = lc->disk_header;
466 lc->clean_bits = (void *)lc->disk_header +
470 memset(lc->clean_bits, -1, bitset_size);
472 lc->sync_bits = vmalloc(bitset_size);
473 if (!lc->sync_bits) {
476 vfree(lc->clean_bits);
478 dm_io_client_destroy(lc->io_req.client);
479 vfree(lc->disk_header);
480 kfree(lc);
483 memset(lc->sync_bits, (sync == NOSYNC) ? -1 : 0, bitset_size);
484 lc->sync_count = (sync == NOSYNC) ? region_count : 0;
486 lc->recovering_bits = vmalloc(bitset_size);
487 if (!lc->recovering_bits) {
489 vfree(lc->sync_bits);
491 vfree(lc->clean_bits);
493 dm_io_client_destroy(lc->io_req.client);
494 vfree(lc->disk_header);
495 kfree(lc);
498 memset(lc->recovering_bits, 0, bitset_size);
499 lc->sync_search = 0;
500 log->context = lc;
511 static void destroy_log_context(struct log_c *lc)
513 vfree(lc->sync_bits);
514 vfree(lc->recovering_bits);
515 kfree(lc);
520 struct log_c *lc = (struct log_c *) log->context;
522 vfree(lc->clean_bits);
523 destroy_log_context(lc);
557 struct log_c *lc = (struct log_c *) log->context;
559 dm_put_device(lc->ti, lc->log_dev);
560 vfree(lc->disk_header);
561 dm_io_client_destroy(lc->io_req.client);
562 destroy_log_context(lc);
575 static void fail_log_device(struct log_c *lc)
577 if (lc->log_dev_failed)
580 lc->log_dev_failed = 1;
581 dm_table_event(lc->ti->table);
588 struct log_c *lc = (struct log_c *) log->context;
589 size_t size = lc->bitset_uint32_count * sizeof(uint32_t);
592 r = read_header(lc);
595 lc->log_dev->name);
596 fail_log_device(lc);
604 lc->header.nr_regions = 0;
608 if (lc->sync == NOSYNC)
609 for (i = lc->header.nr_regions; i < lc->region_count; i++)
610 log_set_bit(lc, lc->clean_bits, i);
612 for (i = lc->header.nr_regions; i < lc->region_count; i++)
613 log_clear_bit(lc, lc->clean_bits, i);
616 for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++)
617 log_clear_bit(lc, lc->clean_bits, i);
620 memcpy(lc->sync_bits, lc->clean_bits, size);
621 lc->sync_count = count_bits32(lc->clean_bits, lc->bitset_uint32_count);
622 lc->sync_search = 0;
625 lc->header.nr_regions = lc->region_count;
627 header_to_disk(&lc->header, lc->disk_header);
630 r = rw_header(lc, WRITE);
632 r = flush_header(lc);
634 lc->log_dev_flush_failed = 1;
638 lc->log_dev->name);
639 fail_log_device(lc);
647 struct log_c *lc = (struct log_c *) log->context;
648 return lc->region_size;
653 struct log_c *lc = (struct log_c *) log->context;
654 lc->sync_search = 0;
660 struct log_c *lc = (struct log_c *) log->context;
661 return log_test_bit(lc->clean_bits, region);
666 struct log_c *lc = (struct log_c *) log->context;
667 return log_test_bit(lc->sync_bits, region);
679 struct log_c *lc = log->context;
682 if (!lc->touched_cleaned && !lc->touched_dirtied)
685 if (lc->touched_cleaned && log->flush_callback_fn &&
686 log->flush_callback_fn(lc->ti)) {
693 lc->flush_failed = 1;
694 for (i = 0; i < lc->region_count; i++)
695 log_clear_bit(lc, lc->clean_bits, i);
698 r = rw_header(lc, WRITE);
700 fail_log_device(lc);
702 if (lc->touched_dirtied) {
703 r = flush_header(lc);
705 lc->log_dev_flush_failed = 1;
706 fail_log_device(lc);
708 lc->touched_dirtied = 0;
710 lc->touched_cleaned = 0;
718 struct log_c *lc = (struct log_c *) log->context;
719 log_clear_bit(lc, lc->clean_bits, region);
724 struct log_c *lc = (struct log_c *) log->context;
725 if (likely(!lc->flush_failed))
726 log_set_bit(lc, lc->clean_bits, region);
731 struct log_c *lc = (struct log_c *) log->context;
733 if (lc->sync_search >= lc->region_count)
738 (unsigned long *) lc->sync_bits,
739 lc->region_count,
740 lc->sync_search);
741 lc->sync_search = *region + 1;
743 if (*region >= lc->region_count)
746 } while (log_test_bit(lc->recovering_bits, *region));
748 log_set_bit(lc, lc->recovering_bits, *region);
755 struct log_c *lc = (struct log_c *) log->context;
757 log_clear_bit(lc, lc->recovering_bits, region);
759 log_set_bit(lc, lc->sync_bits, region);
760 lc->sync_count++;
761 } else if (log_test_bit(lc->sync_bits, region)) {
762 lc->sync_count--;
763 log_clear_bit(lc, lc->sync_bits, region);
769 struct log_c *lc = (struct log_c *) log->context;
771 return lc->sync_count;
775 if (lc->sync != DEFAULTSYNC) \
776 DMEMIT("%ssync ", lc->sync == NOSYNC ? "no" : "")
782 struct log_c *lc = log->context;
791 lc->sync == DEFAULTSYNC ? 1 : 2, lc->region_size);
802 struct log_c *lc = log->context;
806 DMEMIT("3 %s %s %c", log->type->name, lc->log_dev->name,
807 lc->log_dev_flush_failed ? 'F' :
808 lc->log_dev_failed ? 'D' :
814 lc->sync == DEFAULTSYNC ? 2 : 3, lc->log_dev->name,
815 lc->region_size);