1. 09 9月, 2013 8 次提交
    • J
      cifs: add new case-insensitive conversion routines that are based on wchar_t's · c2ccf53d
      Jeff Layton 提交于
      The existing NLS case conversion routines do not appropriately handle
      the (now common) case where the local host is using UTF8. This is
      because nls_utf8 has no support at all for converting a utf8 string
      between cases and the NLS infrastructure in general cannot handle
      a multibyte input character.
      
      In any case, what we really need for cifs is to emulate how we expect
      the server to convert the character to upper or lowercase. Thus, even
      if we had routines that could handle utf8 case conversion, we likely
      would end up with the wrong result if the name ends up being in the
      upper planes.
      
      This patch adds a new scheme for doing unicode case conversion. The
      case conversion tables that Microsoft has published for Windows 8
      have been converted to a set of lookup tables, and a routine is
      added to convert a wchar_t from lower to uppercase using those
      tables.
      Reported-and-Tested-by: NJan-Marek Glogowski <glogow@fbihome.de>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      c2ccf53d
    • S
      cifs: Move and expand MAX_SERVER_SIZE definition · cdf1246f
      Scott Lovenberg 提交于
      MAX_SERVER_SIZE has been moved to cifs_mount.h and renamed
      CIFS_NI_MAXHOST for clarity.  It has been expanded to 1024 as the
      previous value of 16 was very short.
      Signed-off-by: NScott Lovenberg <scott.lovenberg@gmail.com>
      Reviewed-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      cdf1246f
    • S
      cifs: Move string length definitions to uapi · 8c3a2b4c
      Scott Lovenberg 提交于
      The max string length definitions for user name, domain name, password,
      and share name have been moved into their own header file in uapi so the
      mount helper can use autoconf to define them instead of keeping the
      kernel side and userland side definitions in sync manually.  The names
      have also been standardized with a "CIFS" prefix and "LEN" suffix.
      Signed-off-by: NScott Lovenberg <scott.lovenberg@gmail.com>
      Reviewed-by: NChen Gang <gang.chen@asianux.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      8c3a2b4c
    • P
      CIFS: Implement follow_link for nounix CIFS mounts · d244bf2d
      Pavel Shilovsky 提交于
      by using a query reparse ioctl request.
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NPavel Shilovsky <pshilovsky@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      d244bf2d
    • P
      CIFS: Implement follow_link for SMB2 · b42bf888
      Pavel Shilovsky 提交于
      that allows to access files through symlink created on a server.
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NPavel Shilovsky <pshilovsky@samba.org>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      b42bf888
    • J
      cifs: display iocharset= option in /proc/mounts · 3ae35cde
      Jeff Layton 提交于
      ...but only if it's not the default charset.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      3ae35cde
    • J
      cifs: create a new Documentation/ directory and move docfiles into it · 30706a54
      Jeff Layton 提交于
      Currently, we have a number of documentation files that live under
      fs/cifs/. Generally, these don't get picked up by distro packagers,
      since they're in a non-standard location. Move them to a new spot
      under Documentation/ instead.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      30706a54
    • J
      cifs: ensure that srv_mutex is held when dealing with ssocket pointer · 73e216a8
      Jeff Layton 提交于
      Oleksii reported that he had seen an oops similar to this:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000088
      IP: [<ffffffff814dcc13>] sock_sendmsg+0x93/0xd0
      PGD 0
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in: ipt_MASQUERADE xt_REDIRECT xt_tcpudp iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack ip_tables x_tables carl9170 ath usb_storage f2fs nfnetlink_log nfnetlink md4 cifs dns_resolver hid_generic usbhid hid af_packet uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_core videodev rfcomm btusb bnep bluetooth qmi_wwan qcserial cdc_wdm usb_wwan usbnet usbserial mii snd_hda_codec_hdmi snd_hda_codec_realtek iwldvm mac80211 coretemp intel_powerclamp kvm_intel kvm iwlwifi snd_hda_intel cfg80211 snd_hda_codec xhci_hcd e1000e ehci_pci snd_hwdep sdhci_pci snd_pcm ehci_hcd microcode psmouse sdhci thinkpad_acpi mmc_core i2c_i801 pcspkr usbcore hwmon snd_timer snd_page_alloc snd ptp rfkill pps_core soundcore evdev usb_common vboxnetflt(O) vboxdrv(O)Oops#2 Part8
       loop tun binfmt_misc fuse msr acpi_call(O) ipv6 autofs4
      CPU: 0 PID: 21612 Comm: kworker/0:1 Tainted: G        W  O 3.10.1SIGN #28
      Hardware name: LENOVO 2306CTO/2306CTO, BIOS G2ET92WW (2.52 ) 02/22/2013
      Workqueue: cifsiod cifs_echo_request [cifs]
      task: ffff8801e1f416f0 ti: ffff880148744000 task.ti: ffff880148744000
      RIP: 0010:[<ffffffff814dcc13>]  [<ffffffff814dcc13>] sock_sendmsg+0x93/0xd0
      RSP: 0000:ffff880148745b00  EFLAGS: 00010246
      RAX: 0000000000000000 RBX: ffff880148745b78 RCX: 0000000000000048
      RDX: ffff880148745c90 RSI: ffff880181864a00 RDI: ffff880148745b78
      RBP: ffff880148745c48 R08: 0000000000000048 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff880181864a00
      R13: ffff880148745c90 R14: 0000000000000048 R15: 0000000000000048
      FS:  0000000000000000(0000) GS:ffff88021e200000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000088 CR3: 000000020c42c000 CR4: 00000000001407b0
      Oops#2 Part7
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Stack:
       ffff880148745b30 ffffffff810c4af9 0000004848745b30 ffff880181864a00
       ffffffff81ffbc40 0000000000000000 ffff880148745c90 ffffffff810a5aab
       ffff880148745bc0 ffffffff81ffbc40 ffff880148745b60 ffffffff815a9fb8
      Call Trace:
       [<ffffffff810c4af9>] ? finish_task_switch+0x49/0xe0
       [<ffffffff810a5aab>] ? lock_timer_base.isra.36+0x2b/0x50
       [<ffffffff815a9fb8>] ? _raw_spin_unlock_irqrestore+0x18/0x40
       [<ffffffff810a673f>] ? try_to_del_timer_sync+0x4f/0x70
       [<ffffffff815aa38f>] ? _raw_spin_unlock_bh+0x1f/0x30
       [<ffffffff814dcc87>] kernel_sendmsg+0x37/0x50
       [<ffffffffa081a0e0>] smb_send_kvec+0xd0/0x1d0 [cifs]
       [<ffffffffa081a263>] smb_send_rqst+0x83/0x1f0 [cifs]
       [<ffffffffa081ab6c>] cifs_call_async+0xec/0x1b0 [cifs]
       [<ffffffffa08245e0>] ? free_rsp_buf+0x40/0x40 [cifs]
      Oops#2 Part6
       [<ffffffffa082606e>] SMB2_echo+0x8e/0xb0 [cifs]
       [<ffffffffa0808789>] cifs_echo_request+0x79/0xa0 [cifs]
       [<ffffffff810b45b3>] process_one_work+0x173/0x4a0
       [<ffffffff810b52a1>] worker_thread+0x121/0x3a0
       [<ffffffff810b5180>] ? manage_workers.isra.27+0x2b0/0x2b0
       [<ffffffff810bae00>] kthread+0xc0/0xd0
       [<ffffffff810bad40>] ? kthread_create_on_node+0x120/0x120
       [<ffffffff815b199c>] ret_from_fork+0x7c/0xb0
       [<ffffffff810bad40>] ? kthread_create_on_node+0x120/0x120
      Code: 84 24 b8 00 00 00 4c 89 f1 4c 89 ea 4c 89 e6 48 89 df 4c 89 60 18 48 c7 40 28 00 00 00 00 4c 89 68 30 44 89 70 14 49 8b 44 24 28 <ff> 90 88 00 00 00 3d ef fd ff ff 74 10 48 8d 65 e0 5b 41 5c 41
       RIP  [<ffffffff814dcc13>] sock_sendmsg+0x93/0xd0
       RSP <ffff880148745b00>
      CR2: 0000000000000088
      
      The client was in the middle of trying to send a frame when the
      server->ssocket pointer got zeroed out. In most places, that we access
      that pointer, the srv_mutex is held. There's only one spot that I see
      that the server->ssocket pointer gets set and the srv_mutex isn't held.
      This patch corrects that.
      
      The upstream bug report was here:
      
          https://bugzilla.kernel.org/show_bug.cgi?id=60557
      
      Cc: <stable@vger.kernel.org>
      Reported-by: NOleksii Shevchuk <alxchk@gmail.com>
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NSteve French <smfrench@gmail.com>
      73e216a8
  2. 06 9月, 2013 12 次提交
  3. 05 9月, 2013 2 次提交
    • J
      f2fs: optimize gc for better performance · a26b7c8a
      Jin Xu 提交于
      This patch improves the gc efficiency by optimizing the victim
      selection policy. With this optimization, the random re-write
      performance could increase up to 20%.
      
      For f2fs, when disk is in shortage of free spaces, gc will selects
      dirty segments and moves valid blocks around for making more space
      available. The gc cost of a segment is determined by the valid blocks
      in the segment. The less the valid blocks, the higher the efficiency.
      The ideal victim segment is the one that has the most garbage blocks.
      
      Currently, it searches up to 20 dirty segments for a victim segment.
      The selected victim is not likely the best victim for gc when there
      are much more dirty segments. Why not searching more dirty segments
      for a better victim? The cost of searching dirty segments is
      negligible in comparison to moving blocks.
      
      In this patch, it enlarges the MAX_VICTIM_SEARCH to 4096 to make
      the search more aggressively for a possible better victim. Since
      it also applies to victim selection for SSR, it will likely improve
      the SSR efficiency as well.
      
      The test case is simple. It creates as many files until the disk full.
      The size for each file is 32KB. Then it writes as many as 100000
      records of 4KB size to random offsets of random files in sync mode.
      The testing was done on a 2GB partition of a SDHC card. Let's see the
      test result of f2fs without and with the patch.
      
      ---------------------------------------
      2GB partition, SDHC
      create 52023 files of size 32768 bytes
      random re-write 100000 records of 4KB
      ---------------------------------------
      | file creation (s) | rewrite time (s) | gc count | gc garbage blocks |
      [no patch]  341         4227             1174          174840
      [patched]   324         2958             645           106682
      
      It's obvious that, with the patch, f2fs finishes the test in 20+% less
      time than without the patch. And internally it does much less gc with
      higher efficiency than before.
      
      Since the performance improvement is related to gc, it might not be so
      obvious for other tests that do not trigger gc as often as this one (
      This is because f2fs selects dirty segments for SSR use most of the
      time when free space is in shortage). The well-known iozone test tool
      was not used for benchmarking the patch becuase it seems do not have
      a test case that performs random re-write on a full disk.
      
      This patch is the revised version based on the suggestion from
      Jaegeuk Kim.
      Signed-off-by: NJin Xu <jinuxstyle@gmail.com>
      [Jaegeuk Kim: suggested simpler solution]
      Reviewed-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      a26b7c8a
    • J
      f2fs: merge more bios of node block writes · 423e95cc
      Jaegeuk Kim 提交于
      Previously, we experience bio traces as follows when running simple sequential
      write test.
      
       f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500104928, size = 4K
       f2fs_do_submit_bio: type = NODE, io = no sync, sector = 499922208, size = 368K
       f2fs_do_submit_bio: type = NODE, io = no sync, sector = 499914752, size = 140K
      
       -> total 512K
      
      The first one is to write an indirect node block, and the others are to write
      direct node blocks.
      
      The reason why there are two separate bios for direct node blocks is:
      0. initial state
      ------------------    ------------------
      |                |    |xxxxxxxx        |
      ------------------    ------------------
      
      1. write 368K
      ------------------    ------------------
      |                |    |xxxxxxxxWWWWWWWW|
      ------------------    ------------------
      
      2. write 140K
      ------------------    ------------------
      |WWWWWWW         |    |xxxxxxxxWWWWWWWW|
      ------------------    ------------------
      
      This is because f2fs_write_node_pages tries to write just 512K totally, so that
      we can lose the chance to merge more bios nicely.
      
      After this patch is applied, we can get the following bio traces.
      
        f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500103168, size = 8K
        f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500111368, size = 4K
        f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500107272, size = 512K
        f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500108296, size = 512K
        f2fs_do_submit_bio: type = NODE, io = no sync, sector = 500109320, size = 500K
      
      And finally, we can improve the sequential write performance,
          from 458.775 MB/s to 479.945 MB/s on SSD.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      423e95cc
  4. 04 9月, 2013 10 次提交
  5. 03 9月, 2013 4 次提交
    • J
      f2fs: avoid an overflow during utilization calculation · 222cbdc4
      Jaegeuk Kim 提交于
      The current f2fs uses all the block counts with 32 bit numbers, which is able to
      cover about 15TB volume.
      
      But in calculation of utilization, f2fs multiplies the count by 100 which can
      induce overflow.
      This patch fixes this.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      222cbdc4
    • J
      f2fs: trigger GC when there are prefree segments · c34e333f
      Jaegeuk Kim 提交于
      Previously, f2fs conducts SSR when free_sections() < overprovision_sections.
      But, even though there are a lot of prefree segments, it can consider SSR only.
      So, let's consider the number of prefree segments too for triggering SSR.
      Signed-off-by: NJaegeuk Kim <jaegeuk.kim@samsung.com>
      c34e333f
    • L
      vfs: reimplement d_rcu_to_refcount() using lockref_get_or_lock() · 15570086
      Linus Torvalds 提交于
      This moves __d_rcu_to_refcount() from <linux/dcache.h> into fs/namei.c
      and re-implements it using the lockref infrastructure instead.  It also
      adds a lot of comments about what is actually going on, because turning
      a dentry that was looked up using RCU into a long-lived reference
      counted entry is one of the more subtle parts of the rcu walk.
      
      We also used to be _particularly_ subtle in unlazy_walk() where we
      re-validate both the dentry and its parent using the same sequence
      count.  We used to do it by nesting the locks and then verifying the
      sequence count just once.
      
      That was silly, because nested locking is expensive, but the sequence
      count check is not.  So this just re-validates the dentry and the parent
      separately, avoiding the nested locking, and making the lockref lookup
      possible.
      Acked-by: NWaiman Long <waiman.long@hp.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      15570086
    • W
      vfs: use lockref_get_not_zero() for optimistic lockless dget_parent() · df3d0bbc
      Waiman Long 提交于
      A valid parent pointer is always going to have a non-zero reference
      count, but if we look up the parent optimistically without locking, we
      have to protect against the (very unlikely) race against renaming
      changing the parent from under us.
      
      We do that by using lockref_get_not_zero(), and then re-checking the
      parent pointer after getting a valid reference.
      
      [ This is a re-implementation of a chunk from the original patch by
        Waiman Long: "dcache: Enable lockless update of dentry's refcount".
        I've completely rewritten the patch-series and split it up, but I'm
        attributing this part to Waiman as it's close enough to his earlier
        patch  - Linus ]
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      df3d0bbc
  6. 31 8月, 2013 2 次提交
  7. 29 8月, 2013 2 次提交