Lines Matching refs:ds

257 static void btrfsic_dev_state_init(struct btrfsic_dev_state *ds);
259 static void btrfsic_dev_state_free(struct btrfsic_dev_state *ds);
283 struct btrfsic_dev_state *ds,
285 static void btrfsic_dev_state_hashtable_remove(struct btrfsic_dev_state *ds);
457 static void btrfsic_dev_state_init(struct btrfsic_dev_state *ds) in btrfsic_dev_state_init() argument
459 ds->magic_num = BTRFSIC_DEV2STATE_MAGIC_NUMBER; in btrfsic_dev_state_init()
460 ds->bdev = NULL; in btrfsic_dev_state_init()
461 ds->state = NULL; in btrfsic_dev_state_init()
462 ds->name[0] = '\0'; in btrfsic_dev_state_init()
463 INIT_LIST_HEAD(&ds->collision_resolving_node); in btrfsic_dev_state_init()
464 ds->last_flush_gen = 0; in btrfsic_dev_state_init()
465 btrfsic_block_init(&ds->dummy_block_for_bio_bh_flush); in btrfsic_dev_state_init()
466 ds->dummy_block_for_bio_bh_flush.is_iodone = 1; in btrfsic_dev_state_init()
467 ds->dummy_block_for_bio_bh_flush.dev_state = ds; in btrfsic_dev_state_init()
472 struct btrfsic_dev_state *ds; in btrfsic_dev_state_alloc() local
474 ds = kzalloc(sizeof(*ds), GFP_NOFS); in btrfsic_dev_state_alloc()
475 if (NULL != ds) in btrfsic_dev_state_alloc()
476 btrfsic_dev_state_init(ds); in btrfsic_dev_state_alloc()
478 return ds; in btrfsic_dev_state_alloc()
481 static void btrfsic_dev_state_free(struct btrfsic_dev_state *ds) in btrfsic_dev_state_free() argument
483 BUG_ON(!(NULL == ds || in btrfsic_dev_state_free()
484 BTRFSIC_DEV2STATE_MAGIC_NUMBER == ds->magic_num)); in btrfsic_dev_state_free()
485 kfree(ds); in btrfsic_dev_state_free()
599 struct btrfsic_dev_state *ds, in btrfsic_dev_state_hashtable_add() argument
603 (((unsigned int)((uintptr_t)ds->bdev->bd_dev)) & in btrfsic_dev_state_hashtable_add()
606 list_add(&ds->collision_resolving_node, h->table + hashval); in btrfsic_dev_state_hashtable_add()
609 static void btrfsic_dev_state_hashtable_remove(struct btrfsic_dev_state *ds) in btrfsic_dev_state_hashtable_remove() argument
611 list_del(&ds->collision_resolving_node); in btrfsic_dev_state_hashtable_remove()
619 struct btrfsic_dev_state *ds; in btrfsic_dev_state_hashtable_lookup() local
621 list_for_each_entry(ds, h->table + hashval, collision_resolving_node) { in btrfsic_dev_state_hashtable_lookup()
622 if (ds->bdev->bd_dev == dev) in btrfsic_dev_state_hashtable_lookup()
623 return ds; in btrfsic_dev_state_hashtable_lookup()
2929 struct btrfsic_dev_state *ds; in btrfsic_mount() local
2935 ds = btrfsic_dev_state_alloc(); in btrfsic_mount()
2936 if (NULL == ds) { in btrfsic_mount()
2941 ds->bdev = device->bdev; in btrfsic_mount()
2942 ds->state = state; in btrfsic_mount()
2943 bdevname(ds->bdev, ds->name); in btrfsic_mount()
2944 ds->name[BDEVNAME_SIZE - 1] = '\0'; in btrfsic_mount()
2945 p = kbasename(ds->name); in btrfsic_mount()
2946 strlcpy(ds->name, p, sizeof(ds->name)); in btrfsic_mount()
2947 btrfsic_dev_state_hashtable_add(ds, in btrfsic_mount()
2981 struct btrfsic_dev_state *ds; in btrfsic_unmount() local
2986 ds = btrfsic_dev_state_hashtable_lookup( in btrfsic_unmount()
2989 if (NULL != ds) { in btrfsic_unmount()
2990 state = ds->state; in btrfsic_unmount()
2991 btrfsic_dev_state_hashtable_remove(ds); in btrfsic_unmount()
2992 btrfsic_dev_state_free(ds); in btrfsic_unmount()