~ubuntu-branches/ubuntu/saucy/linux-ppc/saucy

« back to all changes in this revision

Viewing changes to drivers/block/xen-blkfront.c

  • Committer: Package Import Robot
  • Author(s): Ben Collins, Ubuntu: 3.8.0-17.27
  • Date: 2013-04-08 18:16:48 UTC
  • mfrom: (16.1.9 raring)
  • Revision ID: package-import@ubuntu.com-20130408181648-z7suubhgtq6k6zke
Tags: 3.8.0-8.14
[ Ubuntu: 3.8.0-17.27 ]

* SAUCE: (no-up) Bluetooth: Add support for 04ca:2007
  - LP: #1153448
* SAUCE: (no-up) Bluetooth: Add support for 105b:e065
  - LP: #1161261
* SAUCE: (no-up) tools/power turbostat: additional Haswell CPU-id
  - LP: #1083993
* Revert "SAUCE: (no-up) seccomp: forcing auditing of kill condition"
  Replaced by upstream patch.
* Release Tracking Bug
  - LP: #1165746
* rebase to v3.8.6
* Revert "brcmsmac: support 4313iPA"
  - LP: #1157190
* tools/power turbostat: support Haswell
  - LP: #1083993
* net: calxedaxgmac: fix rx ring handling when OOM
* cpufreq: check OF node /cpus presence before dereferencing it
* Input: cypress_ps2 - fix trackpadi found in Dell XPS12
  - LP: #1103594
* ARM: OMAP2+: Limit omap initcalls to omap only on multiplatform kernels
* ARM: OMAP2+: Use omap initcalls
* ARM: OMAP: Fix i2c cmdline initcall for multiplatform
* ARM: OMAP: Fix dmaengine init for multiplatform
* ARM: OMAP2+: Add multiplatform debug_ll support
* ARM: OMAP2+: Disable code that currently does not work with
  multiplaform
* ARM: OMAP2+: Enable ARCH_MULTIPLATFORM support
* ARM: OMAP2+: Add minimal support for booting vexpress
* ARM: OMAP2+: Remove now obsolete uncompress.h and debug-macro.S
* davinci: do not include mach/hardware.h
* clk: export __clk_get_name for re-use in imx-ipu-v3 and others
* [SCSI] storvsc: avoid usage of WRITE_SAME
  - LP: #1157952
* ACPICA: Fix possible memory leak in dispatcher error path.
* KVM: x86: fix for buffer overflow in handling of MSR_KVM_SYSTEM_TIME (CVE-2013-1796)
  - LP: #1158254
  - CVE-2013-1796
* SAUCE: (no-up) Bluetooth: Add a load_firmware callback to struct hci_dev
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Implement broadcom patchram firmware loader
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Add support for 13d3:3388 and 13d3:3389
  - LP: #1065400

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include <linux/mutex.h>
45
45
#include <linux/scatterlist.h>
46
46
#include <linux/bitmap.h>
47
 
#include <linux/llist.h>
 
47
#include <linux/list.h>
48
48
 
49
49
#include <xen/xen.h>
50
50
#include <xen/xenbus.h>
68
68
struct grant {
69
69
        grant_ref_t gref;
70
70
        unsigned long pfn;
71
 
        struct llist_node node;
 
71
        struct list_head node;
72
72
};
73
73
 
74
74
struct blk_shadow {
105
105
        struct work_struct work;
106
106
        struct gnttab_free_callback callback;
107
107
        struct blk_shadow shadow[BLK_RING_SIZE];
108
 
        struct llist_head persistent_gnts;
 
108
        struct list_head persistent_gnts;
109
109
        unsigned int persistent_gnts_c;
110
110
        unsigned long shadow_free;
111
111
        unsigned int feature_flush;
371
371
                        lsect = fsect + (sg->length >> 9) - 1;
372
372
 
373
373
                        if (info->persistent_gnts_c) {
374
 
                                BUG_ON(llist_empty(&info->persistent_gnts));
375
 
                                gnt_list_entry = llist_entry(
376
 
                                        llist_del_first(&info->persistent_gnts),
377
 
                                        struct grant, node);
 
374
                                BUG_ON(list_empty(&info->persistent_gnts));
 
375
                                gnt_list_entry = list_first_entry(
 
376
                                                      &info->persistent_gnts,
 
377
                                                      struct grant, node);
 
378
                                list_del(&gnt_list_entry->node);
378
379
 
379
380
                                ref = gnt_list_entry->gref;
380
381
                                buffer_mfn = pfn_to_mfn(gnt_list_entry->pfn);
790
791
 
791
792
static void blkif_free(struct blkfront_info *info, int suspend)
792
793
{
793
 
        struct llist_node *all_gnts;
794
 
        struct grant *persistent_gnt, *tmp;
795
 
        struct llist_node *n;
 
794
        struct grant *persistent_gnt;
 
795
        struct grant *n;
796
796
 
797
797
        /* Prevent new requests being issued until we fix things up. */
798
798
        spin_lock_irq(&info->io_lock);
804
804
 
805
805
        /* Remove all persistent grants */
806
806
        if (info->persistent_gnts_c) {
807
 
                all_gnts = llist_del_all(&info->persistent_gnts);
808
 
                persistent_gnt = llist_entry(all_gnts, typeof(*(persistent_gnt)), node);
809
 
                while (persistent_gnt) {
 
807
                list_for_each_entry_safe(persistent_gnt, n,
 
808
                                         &info->persistent_gnts, node) {
 
809
                        list_del(&persistent_gnt->node);
810
810
                        gnttab_end_foreign_access(persistent_gnt->gref, 0, 0UL);
811
811
                        __free_page(pfn_to_page(persistent_gnt->pfn));
812
 
                        tmp = persistent_gnt;
813
 
                        n = persistent_gnt->node.next;
814
 
                        if (n)
815
 
                                persistent_gnt = llist_entry(n, typeof(*(persistent_gnt)), node);
816
 
                        else
817
 
                                persistent_gnt = NULL;
818
 
                        kfree(tmp);
 
812
                        kfree(persistent_gnt);
 
813
                        info->persistent_gnts_c--;
819
814
                }
820
 
                info->persistent_gnts_c = 0;
 
815
                BUG_ON(info->persistent_gnts_c != 0);
821
816
        }
822
817
 
823
818
        /* No more gnttab callback work. */
875
870
        }
876
871
        /* Add the persistent grant into the list of free grants */
877
872
        for (i = 0; i < s->req.u.rw.nr_segments; i++) {
878
 
                llist_add(&s->grants_used[i]->node, &info->persistent_gnts);
 
873
                list_add(&s->grants_used[i]->node, &info->persistent_gnts);
879
874
                info->persistent_gnts_c++;
880
875
        }
881
876
}
1171
1166
        spin_lock_init(&info->io_lock);
1172
1167
        info->xbdev = dev;
1173
1168
        info->vdevice = vdevice;
1174
 
        init_llist_head(&info->persistent_gnts);
 
1169
        INIT_LIST_HEAD(&info->persistent_gnts);
1175
1170
        info->persistent_gnts_c = 0;
1176
1171
        info->connected = BLKIF_STATE_DISCONNECTED;
1177
1172
        INIT_WORK(&info->work, blkif_restart_queue);