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

« back to all changes in this revision

Viewing changes to fs/btrfs/extent-tree.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:
4308
4308
        spin_lock(&sinfo->lock);
4309
4309
        spin_lock(&block_rsv->lock);
4310
4310
 
4311
 
        block_rsv->size = num_bytes;
 
4311
        block_rsv->size = min_t(u64, num_bytes, 512 * 1024 * 1024);
4312
4312
 
4313
4313
        num_bytes = sinfo->bytes_used + sinfo->bytes_pinned +
4314
4314
                    sinfo->bytes_reserved + sinfo->bytes_readonly +
4601
4601
                 * If the inodes csum_bytes is the same as the original
4602
4602
                 * csum_bytes then we know we haven't raced with any free()ers
4603
4603
                 * so we can just reduce our inodes csum bytes and carry on.
4604
 
                 * Otherwise we have to do the normal free thing to account for
4605
 
                 * the case that the free side didn't free up its reserve
4606
 
                 * because of this outstanding reservation.
4607
4604
                 */
4608
 
                if (BTRFS_I(inode)->csum_bytes == csum_bytes)
 
4605
                if (BTRFS_I(inode)->csum_bytes == csum_bytes) {
4609
4606
                        calc_csum_metadata_size(inode, num_bytes, 0);
4610
 
                else
4611
 
                        to_free = calc_csum_metadata_size(inode, num_bytes, 0);
 
4607
                } else {
 
4608
                        u64 orig_csum_bytes = BTRFS_I(inode)->csum_bytes;
 
4609
                        u64 bytes;
 
4610
 
 
4611
                        /*
 
4612
                         * This is tricky, but first we need to figure out how much we
 
4613
                         * free'd from any free-ers that occured during this
 
4614
                         * reservation, so we reset ->csum_bytes to the csum_bytes
 
4615
                         * before we dropped our lock, and then call the free for the
 
4616
                         * number of bytes that were freed while we were trying our
 
4617
                         * reservation.
 
4618
                         */
 
4619
                        bytes = csum_bytes - BTRFS_I(inode)->csum_bytes;
 
4620
                        BTRFS_I(inode)->csum_bytes = csum_bytes;
 
4621
                        to_free = calc_csum_metadata_size(inode, bytes, 0);
 
4622
 
 
4623
 
 
4624
                        /*
 
4625
                         * Now we need to see how much we would have freed had we not
 
4626
                         * been making this reservation and our ->csum_bytes were not
 
4627
                         * artificially inflated.
 
4628
                         */
 
4629
                        BTRFS_I(inode)->csum_bytes = csum_bytes - num_bytes;
 
4630
                        bytes = csum_bytes - orig_csum_bytes;
 
4631
                        bytes = calc_csum_metadata_size(inode, bytes, 0);
 
4632
 
 
4633
                        /*
 
4634
                         * Now reset ->csum_bytes to what it should be.  If bytes is
 
4635
                         * more than to_free then we would have free'd more space had we
 
4636
                         * not had an artificially high ->csum_bytes, so we need to free
 
4637
                         * the remainder.  If bytes is the same or less then we don't
 
4638
                         * need to do anything, the other free-ers did the correct
 
4639
                         * thing.
 
4640
                         */
 
4641
                        BTRFS_I(inode)->csum_bytes = orig_csum_bytes - num_bytes;
 
4642
                        if (bytes > to_free)
 
4643
                                to_free = bytes - to_free;
 
4644
                        else
 
4645
                                to_free = 0;
 
4646
                }
4612
4647
                spin_unlock(&BTRFS_I(inode)->lock);
4613
4648
                if (dropped)
4614
4649
                        to_free += btrfs_calc_trans_metadata_size(root, dropped);