~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to fs/ext3/balloc.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
590
590
                                BUFFER_TRACE(debug_bh, "Deleted!");
591
591
                                if (!bh2jh(bitmap_bh)->b_committed_data)
592
592
                                        BUFFER_TRACE(debug_bh,
593
 
                                                "No commited data in bitmap");
 
593
                                                "No committed data in bitmap");
594
594
                                BUFFER_TRACE2(debug_bh, bitmap_bh, "bitmap");
595
595
                                __brelse(debug_bh);
596
596
                        }
1063
1063
                rsv_window_remove(sb, my_rsv);
1064
1064
 
1065
1065
        /*
1066
 
         * Let's book the whole avaliable window for now.  We will check the
 
1066
         * Let's book the whole available window for now.  We will check the
1067
1067
         * disk bitmap later and then, if there are free blocks then we adjust
1068
1068
         * the window size if it's larger than requested.
1069
1069
         * Otherwise, we will remove this node from the tree next time
1456
1456
 *
1457
1457
 * ext3_should_retry_alloc() is called when ENOSPC is returned, and if
1458
1458
 * it is profitable to retry the operation, this function will wait
1459
 
 * for the current or commiting transaction to complete, and then
 
1459
 * for the current or committing transaction to complete, and then
1460
1460
 * return TRUE.
1461
1461
 *
1462
1462
 * if the total number of retries exceed three times, return FALSE.
1632
1632
                        goto allocated;
1633
1633
        }
1634
1634
        /*
1635
 
         * We may end up a bogus ealier ENOSPC error due to
 
1635
         * We may end up a bogus earlier ENOSPC error due to
1636
1636
         * filesystem is "full" of reservations, but
1637
 
         * there maybe indeed free blocks avaliable on disk
 
1637
         * there maybe indeed free blocks available on disk
1638
1638
         * In this case, we just forget about the reservations
1639
1639
         * just do block allocation as without reservations.
1640
1640
         */
1991
1991
                spin_unlock(sb_bgl_lock(sbi, group));
1992
1992
                percpu_counter_sub(&sbi->s_freeblocks_counter, next - start);
1993
1993
 
 
1994
                free_blocks -= next - start;
1994
1995
                /* Do not issue a TRIM on extents smaller than minblocks */
1995
1996
                if ((next - start) < minblocks)
1996
1997
                        goto free_extent;
2040
2041
                cond_resched();
2041
2042
 
2042
2043
                /* No more suitable extents */
2043
 
                if ((free_blocks - count) < minblocks)
 
2044
                if (free_blocks < minblocks)
2044
2045
                        break;
2045
2046
        }
2046
2047
 
2090
2091
        ext3_fsblk_t max_blks = le32_to_cpu(es->s_blocks_count);
2091
2092
        int ret = 0;
2092
2093
 
2093
 
        start = range->start >> sb->s_blocksize_bits;
 
2094
        start = (range->start >> sb->s_blocksize_bits) +
 
2095
                le32_to_cpu(es->s_first_data_block);
2094
2096
        len = range->len >> sb->s_blocksize_bits;
2095
2097
        minlen = range->minlen >> sb->s_blocksize_bits;
2096
2098
        trimmed = 0;
2099
2101
                return -EINVAL;
2100
2102
        if (start >= max_blks)
2101
2103
                goto out;
2102
 
        if (start < le32_to_cpu(es->s_first_data_block)) {
2103
 
                len -= le32_to_cpu(es->s_first_data_block) - start;
2104
 
                start = le32_to_cpu(es->s_first_data_block);
2105
 
        }
2106
2104
        if (start + len > max_blks)
2107
2105
                len = max_blks - start;
2108
2106
 
2129
2127
                if (free_blocks < minlen)
2130
2128
                        continue;
2131
2129
 
2132
 
                if (len >= EXT3_BLOCKS_PER_GROUP(sb))
2133
 
                        len -= (EXT3_BLOCKS_PER_GROUP(sb) - first_block);
2134
 
                else
 
2130
                /*
 
2131
                 * For all the groups except the last one, last block will
 
2132
                 * always be EXT3_BLOCKS_PER_GROUP(sb), so we only need to
 
2133
                 * change it for the last group in which case first_block +
 
2134
                 * len < EXT3_BLOCKS_PER_GROUP(sb).
 
2135
                 */
 
2136
                if (first_block + len < EXT3_BLOCKS_PER_GROUP(sb))
2135
2137
                        last_block = first_block + len;
 
2138
                len -= last_block - first_block;
2136
2139
 
2137
2140
                ret = ext3_trim_all_free(sb, group, first_block,
2138
2141
                                        last_block, minlen);