1. 24 Oct, 2011 5 commits
  2. 23 Oct, 2011 3 commits
  3. 21 Oct, 2011 5 commits
    • Domenico Andreoli's avatar
      ARM: S3C24XX: Fix s3c24xx build errors if !CONFIG_PM · fb630b9f
      Domenico Andreoli authored
      v2:
      - register_syscore_ops(&s3c24xx_irq_syscore_ops) does not need to be
        conditionally compiled out, it is already optimized out on !CONFIG_PM
      - fix also s3c2412 and s3c2416 affected by the same build issue
      
      v1:
      s3c2440.c fails to build if !CONFIG_PM because in such case
      s3c2410_pm_syscore_ops is not defined. Same error should happen also
      in s3c2410.c and s3c2442.c
      Signed-off-by: default avatarDomenico Andreoli <cavokz@gmail.com>
      Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
      fb630b9f
    • Linus Torvalds's avatar
      Merge git://github.com/herbertx/crypto · 2efd7c0f
      Linus Torvalds authored
      * git://github.com/herbertx/crypto:
        crypto: ghash - Avoid null pointer dereference if no key is set
      2efd7c0f
    • Linus Torvalds's avatar
      Merge branch 'fix/hda' of git://github.com/tiwai/sound · 62ddc004
      Linus Torvalds authored
      * 'fix/hda' of git://github.com/tiwai/sound:
        ALSA: HDA: conexant support for Lenovo T520/W520
        ALSA: hda - Add position_fix quirk for Dell Inspiron 1010
      62ddc004
    • Nick Bowler's avatar
      crypto: ghash - Avoid null pointer dereference if no key is set · 7ed47b7d
      Nick Bowler authored
      The ghash_update function passes a pointer to gf128mul_4k_lle which will
      be NULL if ghash_setkey is not called or if the most recent call to
      ghash_setkey failed to allocate memory.  This causes an oops.  Fix this
      up by returning an error code in the null case.
      
      This is trivially triggered from unprivileged userspace through the
      AF_ALG interface by simply writing to the socket without setting a key.
      
      The ghash_final function has a similar issue, but triggering it requires
      a memory allocation failure in ghash_setkey _after_ at least one
      successful call to ghash_update.
      
        BUG: unable to handle kernel NULL pointer dereference at 00000670
        IP: [<d88c92d4>] gf128mul_4k_lle+0x23/0x60 [gf128mul]
        *pde = 00000000
        Oops: 0000 [#1] PREEMPT SMP
        Modules linked in: ghash_generic gf128mul algif_hash af_alg nfs lockd nfs_acl sunrpc bridge ipv6 stp llc
      
        Pid: 1502, comm: hashatron Tainted: G        W   3.1.0-rc9-00085-ge9308cfd #32 Bochs Bochs
        EIP: 0060:[<d88c92d4>] EFLAGS: 00000202 CPU: 0
        EIP is at gf128mul_4k_lle+0x23/0x60 [gf128mul]
        EAX: d69db1f0 EBX: d6b8ddac ECX: 00000004 EDX: 00000000
        ESI: 00000670 EDI: d6b8ddac EBP: d6b8ddc8 ESP: d6b8dda4
         DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
        Process hashatron (pid: 1502, ti=d6b8c000 task=d6810000 task.ti=d6b8c000)
        Stack:
         00000000 d69db1f0 00000163 00000000 d6b8ddc8 c101a520 d69db1f0 d52aa000
         00000ff0 d6b8dde8 d88d310f d6b8a3f8 d52aa000 00001000 d88d502c d6b8ddfc
         00001000 d6b8ddf4 c11676ed d69db1e8 d6b8de24 c11679ad d52aa000 00000000
        Call Trace:
         [<c101a520>] ? kmap_atomic_prot+0x37/0xa6
         [<d88d310f>] ghash_update+0x85/0xbe [ghash_generic]
         [<c11676ed>] crypto_shash_update+0x18/0x1b
         [<c11679ad>] shash_ahash_update+0x22/0x36
         [<c11679cc>] shash_async_update+0xb/0xd
         [<d88ce0ba>] hash_sendpage+0xba/0xf2 [algif_hash]
         [<c121b24c>] kernel_sendpage+0x39/0x4e
         [<d88ce000>] ? 0xd88cdfff
         [<c121b298>] sock_sendpage+0x37/0x3e
         [<c121b261>] ? kernel_sendpage+0x4e/0x4e
         [<c10b4dbc>] pipe_to_sendpage+0x56/0x61
         [<c10b4e1f>] splice_from_pipe_feed+0x58/0xcd
         [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10
         [<c10b51f5>] __splice_from_pipe+0x36/0x55
         [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10
         [<c10b6383>] splice_from_pipe+0x51/0x64
         [<c10b63c2>] ? default_file_splice_write+0x2c/0x2c
         [<c10b63d5>] generic_splice_sendpage+0x13/0x15
         [<c10b4d66>] ? splice_from_pipe_begin+0x10/0x10
         [<c10b527f>] do_splice_from+0x5d/0x67
         [<c10b6865>] sys_splice+0x2bf/0x363
         [<c129373b>] ? sysenter_exit+0xf/0x16
         [<c104dc1e>] ? trace_hardirqs_on_caller+0x10e/0x13f
         [<c129370c>] sysenter_do_call+0x12/0x32
        Code: 83 c4 0c 5b 5e 5f c9 c3 55 b9 04 00 00 00 89 e5 57 8d 7d e4 56 53 8d 5d e4 83 ec 18 89 45 e0 89 55 dc 0f b6 70 0f c1 e6 04 01 d6 <f3> a5 be 0f 00 00 00 4e 89 d8 e8 48 ff ff ff 8b 45 e0 89 da 0f
        EIP: [<d88c92d4>] gf128mul_4k_lle+0x23/0x60 [gf128mul] SS:ESP 0068:d6b8dda4
        CR2: 0000000000000670
        ---[ end trace 4eaa2a86a8e2da24 ]---
        note: hashatron[1502] exited with preempt_count 1
        BUG: scheduling while atomic: hashatron/1502/0x10000002
        INFO: lockdep is turned off.
        [...]
      Signed-off-by: default avatarNick Bowler <nbowler@elliptictech.com>
      Cc: stable@kernel.org [2.6.37+]
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      7ed47b7d
    • Marek Szyprowski's avatar
      ARM: S5P: fix offset calculation on gpio-interrupt · 1052cff3
      Marek Szyprowski authored
      Offsets of the irq controller registers were calculated
      correctly only for first GPIO bank. This patch fixes
      calculation of the register offsets for all GPIO banks.
      Reported-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
      1052cff3
  4. 20 Oct, 2011 4 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc · fd11e153
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
        sparc: Add alignment flag to PCI expansion resources
        sparc: Avoid calling sigprocmask()
        sparc: Use set_current_blocked()
        sparc32,leon: SRMMU MMU Table probe fix
      fd11e153
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 505f48b5
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
        fib_rules: fix unresolved_rules counting
        r8169: fix wrong eee setting for rlt8111evl
        r8169: fix driver shutdown WoL regression.
        ehea: Change maintainer to me
        pptp: pptp_rcv_core() misses pskb_may_pull() call
        tproxy: copy transparent flag when creating a time wait
        pptp: fix skb leak in pptp_xmit()
        bonding: use local function pointer of bond->recv_probe in bond_handle_frame
        smsc911x: Add support for SMSC LAN89218
        tg3: negate USE_PHYLIB flag check
        netconsole: enable netconsole can make net_device refcnt incorrent
        bluetooth: Properly clone LSM attributes to newly created child connections
        l2tp: fix a potential skb leak in l2tp_xmit_skb()
        bridge: fix hang on removal of bridge via netlink
        x25: Prevent skb overreads when checking call user data
        x25: Handle undersized/fragmented skbs
        x25: Validate incoming call user data lengths
        udplite: fast-path computation of checksum coverage
        IPVS netns shutdown/startup dead-lock
        netfilter: nf_conntrack: fix event flooding in GRE protocol tracker
      505f48b5
    • Jean Delvare's avatar
      hwmon: (w83627ehf) Fix negative 8-bit temperature values · 133d324d
      Jean Delvare authored
      Since 8-bit temperature values are now handled in 16-bit struct
      members, values have to be cast to s8 for negative temperatures to be
      properly handled. This is broken since kernel version 2.6.39
      (commit bce26c58.)
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Cc: Guenter Roeck <guenter.roeck@ericsson.com>
      Cc: stable@kernel.org	# 2.6.39+
      Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
      133d324d
    • Hugh Dickins's avatar
      mm: fix race between mremap and removing migration entry · 486cf46f
      Hugh Dickins authored
      I don't usually pay much attention to the stale "? " addresses in
      stack backtraces, but this lucky report from Pawel Sikora hints that
      mremap's move_ptes() has inadequate locking against page migration.
      
       3.0 BUG_ON(!PageLocked(p)) in migration_entry_to_page():
       kernel BUG at include/linux/swapops.h:105!
       RIP: 0010:[<ffffffff81127b76>]  [<ffffffff81127b76>]
                             migration_entry_wait+0x156/0x160
        [<ffffffff811016a1>] handle_pte_fault+0xae1/0xaf0
        [<ffffffff810feee2>] ? __pte_alloc+0x42/0x120
        [<ffffffff8112c26b>] ? do_huge_pmd_anonymous_page+0xab/0x310
        [<ffffffff81102a31>] handle_mm_fault+0x181/0x310
        [<ffffffff81106097>] ? vma_adjust+0x537/0x570
        [<ffffffff81424bed>] do_page_fault+0x11d/0x4e0
        [<ffffffff81109a05>] ? do_mremap+0x2d5/0x570
        [<ffffffff81421d5f>] page_fault+0x1f/0x30
      
      mremap's down_write of mmap_sem, together with i_mmap_mutex or lock,
      and pagetable locks, were good enough before page migration (with its
      requirement that every migration entry be found) came in, and enough
      while migration always held mmap_sem; but not enough nowadays, when
      there's memory hotremove and compaction.
      
      The danger is that move_ptes() lets a migration entry dodge around
      behind remove_migration_pte()'s back, so it's in the old location when
      looking at the new, then in the new location when looking at the old.
      
      Either mremap's move_ptes() must additionally take anon_vma lock(), or
      migration's remove_migration_pte() must stop peeking for is_swap_entry()
      before it takes pagetable lock.
      
      Consensus chooses the latter: we prefer to add overhead to migration
      than to mremapping, which gets used by JVMs and by exec stack setup.
      Reported-and-tested-by: default avatarPaweł Sikora <pluto@agmk.net>
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Acked-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      486cf46f
  5. 19 Oct, 2011 23 commits
    • Kjetil Oftedal's avatar
      sparc: Add alignment flag to PCI expansion resources · aad45644
      Kjetil Oftedal authored
      Currently no type of alignment is specified for PCI expansion roms while 
      parsing the openfirmware tree. This causes calls to pci_map_rom() to fail.
      IORESOURCE_SIZEALIGN is the default alignment used for rom resouces in 
      pci/probe.c, and has been verified to work with various cards on a ultra 10.
      Signed-off-By: default avatarKjetil Oftedal <oftedal@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aad45644
    • Yan, Zheng's avatar
      fib_rules: fix unresolved_rules counting · afaef734
      Yan, Zheng authored
      we should decrease ops->unresolved_rules when deleting a unresolved rule.
      Signed-off-by: default avatarZheng Yan <zheng.z.yan@intel.com>
      Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      afaef734
    • hayeswang's avatar
      r8169: fix wrong eee setting for rlt8111evl · 1b23a3e3
      hayeswang authored
      Correct the wrong parameter for setting EEE for RTL8111E-VL.
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1b23a3e3
    • françois romieu's avatar
      r8169: fix driver shutdown WoL regression. · 649b3b8c
      françois romieu authored
      Due to commit 92fc43b4 ("r8169: modify the
      flow of the hw reset."), rtl8169_hw_reset stomps during driver shutdown on
      RxConfig bits which are needed for WOL on some versions of the hardware.
      
      As these bits were formerly set from the r81{0x, 68}_pll_power_down methods,
      factor them out for use in the driver shutdown (rtl_shutdown) handler.
      
      I favored __rtl8169_get_wol() -hardware state indication- over
      RTL_FEATURE_WOL as the latter has become a good candidate for removal.
      Signed-off-by: default avatarFrancois Romieu <romieu@fr.zoreil.com>
      Cc: Hayes <hayeswang@realtek.com>
      Tested-by: default avatarMarc Ballarin <ballarin.marc@gmx.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      649b3b8c
    • Thadeu Lima de Souza Cascardo's avatar
      ehea: Change maintainer to me · 34b1901a
      Thadeu Lima de Souza Cascardo authored
      Breno Leitao has passed the maintainership to me.
      Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
      Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
      Acked-by: default avatarBreno Leitão <leitao@linux.vnet.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34b1901a
    • Josef Bacik's avatar
      Btrfs: don't flush the cache inode before writing it · 016fc6a6
      Josef Bacik authored
      I noticed we had a little bit of latency when writing out the space cache
      inodes.  It's because we flush it before we write anything in case we have dirty
      pages already there.  This doesn't matter though since we're just going to
      overwrite the space, and there really shouldn't be any dirty pages anyway.  This
      makes some of my tests run a little bit faster.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      016fc6a6
    • Josef Bacik's avatar
      Btrfs: if we have a lot of pinned space, commit the transaction · 7e355b83
      Josef Bacik authored
      Mitch kept hitting a panic because he was getting ENOSPC.  One of my previous
      patches makes it so we are much better at not allocating new metadata chunks.
      Unfortunately coupled with the overcommit patch this works us into a bit of a
      problem if we are removing a bunch of space and end up chewing up all of our
      space with pinned extents.  We can allocate chunks fine and overflow is ok, but
      the only way to reclaim this space is to commit the transaction.  So if we go to
      overcommit, first check and see how much pinned space we have.  If we have more
      than 80% of the free space chewed up with pinned extents, just commit the
      transaction, this will free up enough space for our reservation and we won't
      have this problem anymore.  With this patch Mitch's test doesn't blow up
      anymore.  Thanks,
      Reported-and-tested-by: default avatarMitch Harder <mitch.harder@sabayonlinux.org>
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      7e355b83
    • Josef Bacik's avatar
      Btrfs: seperate out btrfs_block_rsv_check out into 2 different functions · 36ba022a
      Josef Bacik authored
      Currently btrfs_block_rsv_check does 2 things, it will either refill a block
      reserve like in the truncate or refill case, or it will check to see if there is
      enough space in the global reserve and possibly refill it.  However because of
      overcommit we could be well overcommitting ourselves just to try and refill the
      global reserve, when really we should just be committing the transaction.  So
      breack this out into btrfs_block_rsv_refill and btrfs_block_rsv_check.  Refill
      will try to reserve more metadata if it can and btrfs_block_rsv_check will not,
      it will only tell you if the factor of the total space is still reserved.
      Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      36ba022a
    • Josef Bacik's avatar
      Btrfs: reserve some space for an orphan item when unlinking · 3880a1b4
      Josef Bacik authored
      In __unlink_start_trans() if we don't have enough room for a reservation we will
      check to see if the unlink will free up space.  If it does that's great, but we
      will still could add an orphan item, so we need to reserve enough space to add
      the orphan item.  Do this and migrate the space the global reserve so it all
      works out right.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      3880a1b4
    • Josef Bacik's avatar
      Btrfs: release trans metadata bytes before flushing delayed refs · b24e03db
      Josef Bacik authored
      We started setting trans->block_rsv = NULL to allow the delayed refs flushing
      stuff to use the right block_rsv and then just made
      btrfs_trans_release_metadata() unconditionally use the trans block rsv.  The
      problem with this is we need to reserve some space in the transaction and then
      migrate it to the global block rsv, so we need to be able to free that out
      properly.  So instead just move btrfs_trans_release_metadata() before the
      delayed ref flushing and use trans->block_rsv for the freeing.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      b24e03db
    • Josef Bacik's avatar
      Btrfs: allow shrink_delalloc flush the needed reclaimed pages · 877da174
      Josef Bacik authored
      Currently we only allow a maximum of 2 megabytes of pages to be flushed at a
      time.  This was ok before, but now we have overcommit which will screw us in a
      heartbeat if we are quickly filling the disk.  So instead pick either 2
      megabytes or the number of pages we need to reclaim to be safe again, which ever
      is larger.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      877da174
    • Josef Bacik's avatar
      Btrfs: wait for ordered extents if we're in trouble when shrinking delalloc · f104d044
      Josef Bacik authored
      The only way we actually reclaim delalloc space is waiting for the IO to
      completely finish.  Usually we kick off a bunch of IO and wait for a little bit
      and hope we can make our reservation, and usually this works out pretty well.
      With overcommit however we can get seriously underwater if we're filling up the
      disk quickly, so we need to be able to force the delalloc shrinker to wait for
      the ordered IO to finish to give us a better chance of actually reclaiming
      enough space to get our reservation.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      f104d044
    • Josef Bacik's avatar
      Btrfs: don't check bytes_pinned to determine if we should commit the transaction · bbb495c2
      Josef Bacik authored
      Before the only reason to commit the transaction to recover space in
      reserve_metadata_bytes() was if there were enough pinned_bytes to satisfy our
      reservation.  But now we have the delayed inode stuff which will hold it's
      reservations until we commit the transaction.  So say we max out our reservation
      by creating a bunch of files but don't have any pinned bytes we will ENOSPC out
      early even though we could commit the transaction and get that space back.  So
      now just unconditionally commit the transaction since currently there is no way
      to know how much metadata space is being reserved by delayed inode stuff.
      Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      bbb495c2
    • Josef Bacik's avatar
      Btrfs: fix regression in re-setting a large xattr · ed3ee9f4
      Josef Bacik authored
      Recently I changed the xattr stuff to unconditionally set the xattr first in
      case the xattr didn't exist yet.  This has introduced a regression when setting
      an xattr that already exists with a large value.  If we find the key we are
      looking for split_leaf will assume that we're extending that item.  The problem
      is the size we pass down to btrfs_search_slot includes the size of the item
      already, so if we have the largest xattr we can possibly have plus the size of
      the xattr item plus the xattr item that btrfs_search_slot we'd overflow the
      leaf.  Thankfully this is not what we're doing, but split_leaf doesn't know this
      so it just returns EOVERFLOW.  So in the xattr code we need to check and see if
      we got back EOVERFLOW and treat it like EEXIST since that's really what
      happened.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      ed3ee9f4
    • Josef Bacik's avatar
      Btrfs: fix the amount of space reserved for unlink · e70bea5f
      Josef Bacik authored
      Our unlink reservations were a bit much, we were reserving 10 and I only count 8
      possible items we're touching, so comment what we're reserving for and fix the
      count value.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      e70bea5f
    • Josef Bacik's avatar
      Btrfs: wait for ordered extents if we didn't reclaim enough · 4b91c14f
      Josef Bacik authored
      I noticed recently that my overcommit patch was causing one of my enospc tests
      to fail 25% of the time with early ENOSPC.  This is because my overcommit patch
      was letting us go way over board, but it wasn't waiting long enough to let the
      delalloc shrinker do it's job.  The problem is we just start writeback and wait
      a little bit hoping we flush enough, but we only free up delalloc space by
      having the writes complete all the way.  We do this by waiting for ordered
      extents, which we do but only if we already free'd enough for the reservation,
      which isn't right, we should flush ordered extents if we didn't reclaim enough
      in case that will push us over the edge.  With this patch I've not seen a
      failure in this enospc test after running it in a loop for an hour.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      4b91c14f
    • Josef Bacik's avatar
      Btrfs: inline checksums into the disk free space cache · 5b0e95bf
      Josef Bacik authored
      Yeah yeah I know this is how we used to do it and then I changed it, but damnit
      I'm changing it back.  The fact is that writing out checksums will modify
      metadata, which could cause us to dirty a block group we've already written out,
      so we have to truncate it and all of it's checksums and re-write it which will
      write new checksums which could dirty a blockg roup that has already been
      written and you see where I'm going with this?  This can cause unmount or really
      anything that depends on a transaction to commit to take it's sweet damned time
      to happen.  So go back to the way it was, only this time we're specifically
      setting NODATACOW because we can't go through the COW pathway anyway and we're
      doing our own built-in cow'ing by truncating the free space cache.  The other
      new thing is once we truncate the old cache and preallocate the new space, we
      don't need to do that song and dance at all for the rest of the transaction, we
      can just overwrite the existing space with the new cache if the block group
      changes for whatever reason, and the NODATACOW will let us do this fine.  So
      keep track of which transaction we last cleared our cache in and if we cleared
      it in this transaction just say we're all setup and carry on.  This survives
      xfstests and stress.sh.
      
      The inode cache will continue to use the normal csum infrastructure since it
      only gets written once and there will be no more modifications to the fs tree in
      a transaction commit.
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      5b0e95bf
    • Josef Bacik's avatar
      Btrfs: take overflow into account in reserving space · 9a82ca65
      Josef Bacik authored
      My overcommit stuff can be a little racy when we're filling up the disk with
      fs_mark and we overcommit into things that quickly get used up for data.  So use
      num_bytes to see if we have enough available space so we're less likely to
      overcommit ourselves out of the ability to make reservations.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      9a82ca65
    • Josef Bacik's avatar
      Btrfs: check the return value of filemap_write_and_wait in the space cache · 549b4fdb
      Josef Bacik authored
      We need to check the return value of filemap_write_and_wait in the space cache
      writeout code.  Also don't set the inode's generation until we're sure nothing
      else is going to fail.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      549b4fdb
    • Josef Bacik's avatar
      Btrfs: add a io_ctl struct and helpers for dealing with the space cache · a67509c3
      Josef Bacik authored
      In writing and reading the space cache we have one big loop that keeps track of
      which page we are on and then a bunch of sizeable loops underneath this big loop
      to try and read/write out properly.  Especially in the write case this makes
      things hugely complicated and hard to follow, and makes our error checking and
      recovery equally as complex.  So add a io_ctl struct with a bunch of helpers to
      keep track of the pages we have, where we are, if we have enough space etc.
      This unifies how we deal with the pages we're writing and keeps all the messy
      tracking internal.  This allows us to kill the big loops in both the read and
      write case and makes reviewing and chaning the write and read paths much
      simpler.  I've run xfstests and stress.sh on this code and it survives.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      a67509c3
    • Josef Bacik's avatar
      Btrfs: don't skip writing out a empty block groups cache · f75b130e
      Josef Bacik authored
      I noticed a slight bug where we will not bother writing out the block group
      cache's space cache if it's space tree is empty.  Since it could have a cluster
      or pinned extents that need to be written out this is just not a valid test.
      Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      f75b130e
    • Josef Bacik's avatar
      Btrfs: introduce mount option no_space_cache · 73bc1876
      Josef Bacik authored
      Some users have requested this and I've found I needed a way to disable cache
      loading without actually clearing the cache, so introduce the no_space_cache
      option.  Before we check the super blocks cache generation field and if it was
      populated we always turned space caching on.  Now we check this and set the
      space cache option on, and then parse the mount options so that if we want it
      off it get's turned off.  Then we check the mount option all the places we do
      the caching work instead of checking the super's cache generation.  This makes
      things more consistent and lets us turn space caching off.  Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      73bc1876
    • Josef Bacik's avatar
      Btrfs: only inherit btrfs specific flags when creating files · e27425d6
      Josef Bacik authored
      Xfstests 79 was failing because we were inheriting the S_APPEND flag when we
      weren't supposed to.  There isn't any specific documentation on this so I'm
      taking the test as the standard of how things work, and having S_APPEND set on a
      directory doesn't mean that S_APPEND gets inherited by its children according to
      this test.  So only inherit btrfs specific things.  This will let us set
      compress/nocompress on specific directories and everything in the directories
      will inherit this flag, same with nodatacow.  With this patch test 79 passes.
      Thanks,
      Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
      e27425d6