dm.c (b9a785d2dc6567b2fd9fc60057a6a945a276927a) dm.c (7b5865831c1003122f737df5e16adaa583f1a595)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm-core.h"

--- 760 unchanged lines hidden (view full) ---

769 return ERR_PTR(r);
770}
771
772/*
773 * Close a table device that we've been using.
774 */
775static void close_table_device(struct table_device *td, struct mapped_device *md)
776{
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm-core.h"

--- 760 unchanged lines hidden (view full) ---

769 return ERR_PTR(r);
770}
771
772/*
773 * Close a table device that we've been using.
774 */
775static void close_table_device(struct table_device *td, struct mapped_device *md)
776{
777 if (!td->dm_dev.bdev)
778 return;
779
780 bd_unlink_disk_holder(td->dm_dev.bdev, dm_disk(md));
781 blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL);
782 put_dax(td->dm_dev.dax_dev);
777 bd_unlink_disk_holder(td->dm_dev.bdev, dm_disk(md));
778 blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL);
779 put_dax(td->dm_dev.dax_dev);
783 td->dm_dev.bdev = NULL;
784 td->dm_dev.dax_dev = NULL;
780 list_del(&td->list);
781 kfree(td);
785}
786
787static struct table_device *find_table_device(struct list_head *l, dev_t dev,
788 fmode_t mode)
789{
790 struct table_device *td;
791
792 list_for_each_entry(td, l, list)

--- 25 unchanged lines hidden (view full) ---

818 return 0;
819}
820
821void dm_put_table_device(struct mapped_device *md, struct dm_dev *d)
822{
823 struct table_device *td = container_of(d, struct table_device, dm_dev);
824
825 mutex_lock(&md->table_devices_lock);
782}
783
784static struct table_device *find_table_device(struct list_head *l, dev_t dev,
785 fmode_t mode)
786{
787 struct table_device *td;
788
789 list_for_each_entry(td, l, list)

--- 25 unchanged lines hidden (view full) ---

815 return 0;
816}
817
818void dm_put_table_device(struct mapped_device *md, struct dm_dev *d)
819{
820 struct table_device *td = container_of(d, struct table_device, dm_dev);
821
822 mutex_lock(&md->table_devices_lock);
826 if (refcount_dec_and_test(&td->count)) {
823 if (refcount_dec_and_test(&td->count))
827 close_table_device(td, md);
824 close_table_device(td, md);
828 list_del(&td->list);
829 kfree(td);
830 }
831 mutex_unlock(&md->table_devices_lock);
832}
833
834/*
835 * Get the geometry associated with a dm device
836 */
837int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo)
838{

--- 2517 unchanged lines hidden ---
825 mutex_unlock(&md->table_devices_lock);
826}
827
828/*
829 * Get the geometry associated with a dm device
830 */
831int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo)
832{

--- 2517 unchanged lines hidden ---