~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/md/dm-thin-metadata.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Upstream Kernel Changes
  • Date: 2012-03-27 17:01:30 UTC
  • Revision ID: package-import@ubuntu.com-20120327170130-qrvi60snnxty6ibi
Tags: 3.2.0-1411.14
[ Paolo Pisati ]

* Revert to Ubuntu-3.2.0-1409.12 until we figure out what's wrong with hdmi
  - LP: #963512

[ Upstream Kernel Changes ]

* Revert "Reapply upleveled PMU interrupt patch"
* KBuild: Allow scripts/* to be cross compiled
* LINARO: Use KBUILD_SCRIPTROOT to cross build scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
385
385
                data_sm = dm_sm_disk_create(tm, nr_blocks);
386
386
                if (IS_ERR(data_sm)) {
387
387
                        DMERR("sm_disk_create failed");
388
 
                        dm_tm_unlock(tm, sblock);
389
388
                        r = PTR_ERR(data_sm);
390
389
                        goto bad;
391
390
                }
790
789
        return 0;
791
790
}
792
791
 
793
 
/*
794
 
 * __open_device: Returns @td corresponding to device with id @dev,
795
 
 * creating it if @create is set and incrementing @td->open_count.
796
 
 * On failure, @td is undefined.
797
 
 */
798
792
static int __open_device(struct dm_pool_metadata *pmd,
799
793
                         dm_thin_id dev, int create,
800
794
                         struct dm_thin_device **td)
805
799
        struct disk_device_details details_le;
806
800
 
807
801
        /*
808
 
         * If the device is already open, return it.
 
802
         * Check the device isn't already open.
809
803
         */
810
804
        list_for_each_entry(td2, &pmd->thin_devices, list)
811
805
                if (td2->id == dev) {
812
 
                        /*
813
 
                         * May not create an already-open device.
814
 
                         */
815
 
                        if (create)
816
 
                                return -EEXIST;
817
 
 
818
806
                        td2->open_count++;
819
807
                        *td = td2;
820
808
                        return 0;
829
817
                if (r != -ENODATA || !create)
830
818
                        return r;
831
819
 
832
 
                /*
833
 
                 * Create new device.
834
 
                 */
835
820
                changed = 1;
836
821
                details_le.mapped_blocks = 0;
837
822
                details_le.transaction_id = cpu_to_le64(pmd->trans_id);
897
882
 
898
883
        r = __open_device(pmd, dev, 1, &td);
899
884
        if (r) {
 
885
                __close_device(td);
900
886
                dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root);
901
887
                dm_btree_del(&pmd->bl_info, dev_root);
902
888
                return r;
903
889
        }
 
890
        td->changed = 1;
904
891
        __close_device(td);
905
892
 
906
893
        return r;
980
967
                goto bad;
981
968
 
982
969
        r = __set_snapshot_details(pmd, td, origin, pmd->time);
983
 
        __close_device(td);
984
 
 
985
970
        if (r)
986
971
                goto bad;
987
972
 
 
973
        __close_device(td);
988
974
        return 0;
989
975
 
990
976
bad:
 
977
        __close_device(td);
991
978
        dm_btree_remove(&pmd->tl_info, pmd->root, &key, &pmd->root);
992
979
        dm_btree_remove(&pmd->details_info, pmd->details_root,
993
980
                        &key, &pmd->details_root);
1224
1211
        if (r)
1225
1212
                return r;
1226
1213
 
1227
 
        td->mapped_blocks--;
1228
 
        td->changed = 1;
1229
1214
        pmd->need_commit = 1;
1230
1215
 
1231
1216
        return 0;