1. 07 Sep, 2018 1 commit
    • Dominique Martinet's avatar
      9p: add a per-client fcall kmem_cache · 91a76be3
      Dominique Martinet authored
      Having a specific cache for the fcall allocations helps speed up
      end-to-end latency.
      
      The caches will automatically be merged if there are multiple caches
      of items with the same size so we do not need to try to share a cache
      between different clients of the same size.
      
      Since the msize is negotiated with the server, only allocate the cache
      after that negotiation has happened - previous allocations or
      allocations of different sizes (e.g. zero-copy fcall) are made with
      kmalloc directly.
      
      Some figures on two beefy VMs with Connect-IB (sriov) / trans=rdma,
      with ior running 32 processes in parallel doing small 32 bytes IOs:
       - no alloc (4.18-rc7 request cache): 65.4k req/s
       - non-power of two alloc, no patch: 61.6k req/s
       - power of two alloc, no patch: 62.2k req/s
       - non-power of two alloc, with patch: 64.7k req/s
       - power of two alloc, with patch: 65.1k req/s
      
      Link: http://lkml.kernel.org/r/1532943263-24378-2-git-send-email-asmadeus@codewreck.orgSigned-off-by: default avatarDominique Martinet <dominique.martinet@cea.fr>
      Acked-by: default avatarJun Piao <piaojun@huawei.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Greg Kurz <groug@kaod.org>
      91a76be3
  2. 29 Aug, 2018 1 commit
  3. 12 Jan, 2017 1 commit
  4. 12 Feb, 2013 1 commit
    • Eric W. Biederman's avatar
      9p: Modify the stat structures to use kuid_t and kgid_t · 447c5094
      Eric W. Biederman authored
      9p has thre strucrtures that can encode inode stat information.  Modify
      all of those structures to contain kuid_t and kgid_t values.  Modify
      he wire encoders and decoders of those structures to use 'u' and 'g' instead of
      'd' in the format string where uids and gids are present.
      
      This results in all kuid and kgid conversion to and from on the wire values
      being performed by the same code in protocol.c where the client is known
      at the time of the conversion.
      
      Cc: Eric Van Hensbergen <ericvh@gmail.com>
      Cc: Ron Minnich <rminnich@gmail.com>
      Cc: Latchesar Ionkov <lucho@ionkov.net>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      447c5094
  5. 05 Jan, 2012 1 commit
    • Joe Perches's avatar
      9p: Reduce object size with CONFIG_NET_9P_DEBUG · 5d385153
      Joe Perches authored
      Reduce object size by deduplicating formats.
      
      Use vsprintf extension %pV.
      Rename P9_DPRINTK uses to p9_debug, align arguments.
      Add function for _p9_debug and macro to add __func__.
      Add missing "\n"s to p9_debug uses.
      Remove embedded function names as p9_debug adds it.
      Remove P9_EPRINTK macro and convert use to pr_<level>.
      Add and use pr_fmt and pr_<level>.
      
      $ size fs/9p/built-in.o*
         text	   data	    bss	    dec	    hex	filename
        62133	    984	  16000	  79117	  1350d	fs/9p/built-in.o.new
        67342	    984	  16928	  85254	  14d06	fs/9p/built-in.o.old
      $ size net/9p/built-in.o*
         text	   data	    bss	    dec	    hex	filename
        88792	   4148	  22024	 114964	  1c114	net/9p/built-in.o.new
        94072	   4148	  23232	 121452	  1da6c	net/9p/built-in.o.old
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      5d385153
  6. 24 Oct, 2011 2 commits
    • Aneesh Kumar K.V's avatar
      net/9p: Convert net/9p protocol dumps to tracepoints · 348b5901
      Aneesh Kumar K.V authored
      This helps in more control over debugging.
      root@qemu-img-64:~# ls /pass/123
      ls: cannot access /pass/123: No such file or directory
      root@qemu-img-64:~# cat /sys/kernel/debug/tracing/trace
      # tracer: nop
      #
      #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
      #              | |       |          |         |
                    ls-1536  [001]    70.928584: 9p_protocol_dump: clnt 18446612132784021504 P9_TWALK(tag = 1)
      000: 16 00 00 00 6e 01 00 01 00 00 00 02 00 00 00 01
      010: 00 03 00 31 32 33 00 00 00 ff ff ff ff 00 00 00
      
                    ls-1536  [001]    70.928587: <stack trace>
       => trace_9p_protocol_dump
       => p9pdu_finalize
       => p9_client_rpc
       => p9_client_walk
       => v9fs_vfs_lookup
       => d_alloc_and_lookup
       => walk_component
       => path_lookupat
                    ls-1536  [000]    70.929696: 9p_protocol_dump: clnt 18446612132784021504 P9_RLERROR(tag = 1)
      000: 0b 00 00 00 07 01 00 02 00 00 00 4e 03 00 02 00
      010: 00 00 00 00 03 00 02 00 00 00 00 00 ff 43 00 00
      
                    ls-1536  [000]    70.929697: <stack trace>
       => trace_9p_protocol_dump
       => p9_client_rpc
       => p9_client_walk
       => v9fs_vfs_lookup
       => d_alloc_and_lookup
       => walk_component
       => path_lookupat
       => do_path_lookup
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      348b5901
    • Aneesh Kumar K.V's avatar
      fs/9p: Update zero-copy implementation in 9p · abfa034e
      Aneesh Kumar K.V authored
      * remove lot of update to different data structure
      * add a seperate callback for zero copy request.
      * above makes non zero copy code path simpler
      * remove conditionalizing TREAD/TREADDIR/TWRITE in the zero copy path
      * Fix the dotu p9_check_errors with zero copy. Add sufficient doc around
      * Add support for both in and output buffers in zero copy callback
      * pin and unpin pages in the same context
      * use helpers instead of defining page offset and rest of page ourself
      * Fix mem leak in p9_check_errors
      * Remove 'E' and 'F' in p9pdu_vwritef
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      abfa034e
  7. 06 Sep, 2011 2 commits
  8. 23 Jul, 2011 4 commits
  9. 25 May, 2011 2 commits
  10. 15 Apr, 2011 1 commit
  11. 31 Mar, 2011 1 commit
  12. 15 Mar, 2011 3 commits
  13. 28 Oct, 2010 5 commits
  14. 02 Aug, 2010 11 commits
    • Aneesh Kumar K.V's avatar
      net/9p: Implement TXATTRCREATE 9p call · eda25e46
      Aneesh Kumar K.V authored
      TXATTRCREATE:  Prepare a fid for setting xattr value on a file system object.
      
       size[4] TXATTRCREATE tag[2] fid[4] name[s] attr_size[8] flags[4]
       size[4] RXATTRCREATE tag[2]
      
      txattrcreate gets a fid pointing to xattr. This fid can later be
      used to set the xattr value.
      
      flag value is derived from set Linux setxattr. The manpage says
      "The flags parameter can be used to refine the semantics of the operation.
      XATTR_CREATE specifies a pure create, which fails if the named attribute
      exists already. XATTR_REPLACE specifies a pure replace operation, which
      fails if the named attribute does not already exist. By default (no flags),
      the extended attribute will be created if need be, or will simply replace
      the value if the attribute exists."
      
      The actual setxattr operation happens when the fid is clunked. At that point
      the written byte count and the attr_size specified in TXATTRCREATE should be
      same otherwise an error will be returned.
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      eda25e46
    • Aneesh Kumar K.V's avatar
      net/9p: Implement attrwalk 9p call · 0ef63f34
      Aneesh Kumar K.V authored
      TXATTRWALK: Descend a ATTR namespace
      
       size[4] TXATTRWALK tag[2] fid[4] newfid[4] name[s]
       size[4] RXATTRWALK tag[2] size[8]
      
      txattrwalk gets a fid pointing to xattr. This fid can later be
      used to read the xattr value. If name is NULL the fid returned
      can be used to get the list of extended attribute associated to
      the file system object.
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      0ef63f34
    • M. Mohan Kumar's avatar
      9p: Implement LOPEN · ef56547e
      M. Mohan Kumar authored
      Implement 9p2000.L version of open(LOPEN) interface in 9p client.
      
      For LOPEN, no need to convert the flags to and from 9p mode to VFS mode.
      
      Synopsis:
      
          size[4] Tlopen tag[2] fid[4] mode[4]
      
          size[4] Rlopen tag[2] qid[13] iounit[4]
      
      [Fix mode bit format - jvrao@linux.vnet.ibm.com]
      Signed-off-by: default avatarM. Mohan Kumar <mohan@in.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbegren <ericvh@gmail.com>
      ef56547e
    • Venkateswararao Jujjuri (JV)'s avatar
      fs/9p: This patch implements TLCREATE for 9p2000.L protocol. · 5643135a
      Venkateswararao Jujjuri (JV) authored
      SYNOPSIS
      
          size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]
      
          size[4] Rlcreate tag[2] qid[13] iounit[4]
      
      DESCRIPTION
      
      The Tlreate request asks the file server to create a new regular file with the
      name supplied, in the directory (dir) represented by fid.
      The mode argument specifies the permissions to use. New file is created with
      the uid if the fid and with supplied gid.
      
      The flags argument represent Linux access mode flags with which the caller
      is requesting to open the file with. Protocol allows all the Linux access
      modes but it is upto the server to allow/disallow any of these acess modes.
      If the server doesn't support any of the access mode, it is expected to
      return error.
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      5643135a
    • M. Mohan Kumar's avatar
      9p: Implement TMKDIR · 01a622bd
      M. Mohan Kumar authored
      Implement TMKDIR as part of 2000.L Work
      
      Synopsis
      
          size[4] Tmkdir tag[2] fid[4] name[s] mode[4] gid[4]
      
          size[4] Rmkdir tag[2] qid[13]
      
      Description
      
          mkdir asks the file server to create a directory with given name,
          mode and gid. The qid for the new directory is returned with
          the mkdir reply message.
      
      Note: 72 is selected as the opcode for TMKDIR from the reserved list.
      Signed-off-by: default avatarM. Mohan Kumar <mohan@in.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      01a622bd
    • M. Mohan Kumar's avatar
      9p: Implement TMKNOD · 4b43516a
      M. Mohan Kumar authored
      Synopsis
      
          size[4] Tmknod tag[2] fid[4] name[s] mode[4] major[4] minor[4] gid[4]
      
          size[4] Rmknod tag[2] qid[13]
      
      Description
      
          mknod asks the file server to create a device node with given major and
          minor number, mode and gid. The qid for the new device node is returned
          with the mknod reply message.
      
      [sripathik@in.ibm.com: Fix error handling code]
      Signed-off-by: default avatarM. Mohan Kumar <mohan@in.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      4b43516a
    • Venkateswararao Jujjuri (JV)'s avatar
      9p: Define and implement TSYMLINK for 9P2000.L · 50cc42ff
      Venkateswararao Jujjuri (JV) authored
      Create a symbolic link
      
      SYNOPSIS
      
      size[4] Tsymlink tag[2] fid[4] name[s] symtgt[s] gid[4]
      
      size[4] Rsymlink tag[2] qid[13]
      
      DESCRIPTION
      
      Create a symbolic link named 'name' pointing to 'symtgt'.
      gid represents the effective group id of the caller.
      The  permissions of a symbolic link are irrelevant hence it is omitted
      from the protocol.
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Reviewed-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      50cc42ff
    • Venkateswararao Jujjuri (JV)'s avatar
      9p: Define and implement TLINK for 9P2000.L · 652df9a7
      Venkateswararao Jujjuri (JV) authored
      This patch adds a helper function to get the dentry from inode and
      uses it in creating a Hardlink
      
      SYNOPSIS
      
      size[4] Tlink tag[2] dfid[4] oldfid[4] newpath[s]
      
      size[4] Rlink tag[2]
      
      DESCRIPTION
      
      Create a link 'newpath' in directory pointed by dfid linking to oldfid path.
      
      [sripathik@in.ibm.com : p9_client_link should not free req structure
      if p9_client_rpc has returned an error.]
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      652df9a7
    • Sripathi Kodi's avatar
      9p: Implement client side of setattr for 9P2000.L protocol. · 87d7845a
      Sripathi Kodi authored
          SYNOPSIS
      
            size[4] Tsetattr tag[2] attr[n]
      
            size[4] Rsetattr tag[2]
      
          DESCRIPTION
      
            The setattr command changes some of the file status information.
            attr resembles the iattr structure used in Linux kernel. It
            specifies which status parameter is to be changed and to what
            value. It is laid out as follows:
      
               valid[4]
                  specifies which status information is to be changed. Possible
                  values are:
                  ATTR_MODE       (1 << 0)
                  ATTR_UID        (1 << 1)
                  ATTR_GID        (1 << 2)
                  ATTR_SIZE       (1 << 3)
                  ATTR_ATIME      (1 << 4)
                  ATTR_MTIME      (1 << 5)
                  ATTR_ATIME_SET  (1 << 7)
                  ATTR_MTIME_SET  (1 << 8)
      
                  The last two bits represent whether the time information
                  is being sent by the client's user space. In the absense
                  of these bits the server always uses server's time.
      
               mode[4]
                  File permission bits
      
               uid[4]
                  Owner id of file
      
               gid[4]
                  Group id of the file
      
               size[8]
                  File size
      
               atime_sec[8]
                  Time of last file access, seconds
      
               atime_nsec[8]
                  Time of last file access, nanoseconds
      
               mtime_sec[8]
                  Time of last file modification, seconds
      
               mtime_nsec[8]
                  Time of last file modification, nanoseconds
      
      Explanation of the patches:
      --------------------------
      
      *) The kernel just copies relevent contents of iattr structure to
         p9_iattr_dotl structure and passes it down to the client. The
         only check it has is calling inode_change_ok()
      *) The p9_iattr_dotl structure does not have ctime and ia_file
         parameters because I don't think these are needed in our case.
         The client user space can request updating just ctime by calling
         chown(fd, -1, -1). This is handled on server side without a need
         for putting ctime on the wire.
      *) The server currently supports changing mode, time, ownership and
         size of the file.
      *) 9P RFC says "Either all the changes in wstat request happen, or
         none of them does: if the request succeeds, all changes were made;
         if it fails, none were."
         I have not done anything to implement this specifically because I
         don't see a reason.
      Signed-off-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
      Signed-off-by: default avatarVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      87d7845a
    • Sripathi Kodi's avatar
      9p: getattr client implementation for 9P2000.L protocol. · f0853122
      Sripathi Kodi authored
              SYNOPSIS
      
                    size[4] Tgetattr tag[2] fid[4] request_mask[8]
      
                    size[4] Rgetattr tag[2] lstat[n]
      
                 DESCRIPTION
      
                    The getattr transaction inquires about the file identified by fid.
                    request_mask is a bit mask that specifies which fields of the
                    stat structure is the client interested in.
      
                    The reply will contain a machine-independent directory entry,
                    laid out as follows:
      
                       st_result_mask[8]
                          Bit mask that indicates which fields in the stat structure
                          have been populated by the server
      
                       qid.type[1]
                          the type of the file (directory, etc.), represented as a bit
                          vector corresponding to the high 8 bits of the file's mode
                          word.
      
                       qid.vers[4]
                          version number for given path
      
                       qid.path[8]
                          the file server's unique identification for the file
      
                       st_mode[4]
                          Permission and flags
      
                       st_uid[4]
                          User id of owner
      
                       st_gid[4]
                          Group ID of owner
      
                       st_nlink[8]
                          Number of hard links
      
                       st_rdev[8]
                          Device ID (if special file)
      
                       st_size[8]
                          Size, in bytes
      
                       st_blksize[8]
                          Block size for file system IO
      
                       st_blocks[8]
                          Number of file system blocks allocated
      
                       st_atime_sec[8]
                          Time of last access, seconds
      
                       st_atime_nsec[8]
                          Time of last access, nanoseconds
      
                       st_mtime_sec[8]
                          Time of last modification, seconds
      
                       st_mtime_nsec[8]
                          Time of last modification, nanoseconds
      
                       st_ctime_sec[8]
                          Time of last status change, seconds
      
                       st_ctime_nsec[8]
                          Time of last status change, nanoseconds
      
                       st_btime_sec[8]
                          Time of creation (birth) of file, seconds
      
                       st_btime_nsec[8]
                          Time of creation (birth) of file, nanoseconds
      
                       st_gen[8]
                          Inode generation
      
                       st_data_version[8]
                          Data version number
      
                    request_mask and result_mask bit masks contain the following bits
                       #define P9_STATS_MODE          0x00000001ULL
                       #define P9_STATS_NLINK         0x00000002ULL
                       #define P9_STATS_UID           0x00000004ULL
                       #define P9_STATS_GID           0x00000008ULL
                       #define P9_STATS_RDEV          0x00000010ULL
                       #define P9_STATS_ATIME         0x00000020ULL
                       #define P9_STATS_MTIME         0x00000040ULL
                       #define P9_STATS_CTIME         0x00000080ULL
                       #define P9_STATS_INO           0x00000100ULL
                       #define P9_STATS_SIZE          0x00000200ULL
                       #define P9_STATS_BLOCKS        0x00000400ULL
      
                       #define P9_STATS_BTIME         0x00000800ULL
                       #define P9_STATS_GEN           0x00001000ULL
                       #define P9_STATS_DATA_VERSION  0x00002000ULL
      
                       #define P9_STATS_BASIC         0x000007ffULL
                       #define P9_STATS_ALL           0x00003fffULL
      
              This patch implements the client side of getattr implementation for
              9P2000.L. It introduces a new structure p9_stat_dotl for getting
              Linux stat information along with QID. The data layout is similar to
              stat structure in Linux user space with the following major
              differences:
      
              inode (st_ino) is not part of data. Instead qid is.
      
              device (st_dev) is not part of data because this doesn't make sense
              on the client.
      
              All time variables are 64 bit wide on the wire. The kernel seems to use
              32 bit variables for these variables. However, some of the architectures
              have used 64 bit variables and glibc exposes 64 bit variables to user
              space on some architectures. Hence to be on the safer side we have made
              these 64 bit in the protocol. Refer to the comments in
              include/asm-generic/stat.h
      
              There are some additional fields: st_btime_sec, st_btime_nsec, st_gen,
              st_data_version apart from the bitmask, st_result_mask. The bit mask
              is filled by the server to indicate which stat fields have been
              populated by the server. Currently there is no clean way for the
              server to obtain these additional fields, so it sends back just the
              basic fields.
      Signed-off-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
      Signed-off-by: default avatarEric Van Hensbegren <ericvh@gmail.com>
      f0853122
    • Sripathi Kodi's avatar
      9p: readdir implementation for 9p2000.L · 7751bdb3
      Sripathi Kodi authored
      This patch implements the kernel part of readdir() implementation for 9p2000.L
      
          Change from V3: Instead of inode, server now sends qids for each dirent
      
          SYNOPSIS
      
          size[4] Treaddir tag[2] fid[4] offset[8] count[4]
          size[4] Rreaddir tag[2] count[4] data[count]
      
          DESCRIPTION
      
          The readdir request asks the server to read the directory specified by 'fid'
          at an offset specified by 'offset' and return as many dirent structures as
          possible that fit into count bytes. Each dirent structure is laid out as
          follows.
      
                  qid.type[1]
                    the type of the file (directory, etc.), represented as a bit
                    vector corresponding to the high 8 bits of the file's mode
                    word.
      
                  qid.vers[4]
                    version number for given path
      
                  qid.path[8]
                    the file server's unique identification for the file
      
                  offset[8]
                    offset into the next dirent.
      
                  type[1]
                    type of this directory entry.
      
                  name[256]
                    name of this directory entry.
      
          This patch adds v9fs_dir_readdir_dotl() as the readdir() call for 9p2000.L.
          This function sends P9_TREADDIR command to the server. In response the server
          sends a buffer filled with dirent structures. This is different from the
          existing v9fs_dir_readdir() call which receives stat structures from the server.
          This results in significant speedup of readdir() on large directories.
          For example, doing 'ls >/dev/null' on a directory with 10000 files on my
          laptop takes 1.088 seconds with the existing code, but only takes 0.339 seconds
          with the new readdir.
      Signed-off-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
      Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      7751bdb3
  15. 21 May, 2010 2 commits
  16. 23 Sep, 2009 1 commit
    • Abhishek Kulkarni's avatar
      9p: Add fscache support to 9p · 60e78d2c
      Abhishek Kulkarni authored
      This patch adds a persistent, read-only caching facility for
      9p clients using the FS-Cache caching backend.
      
      When the fscache facility is enabled, each inode is associated
      with a corresponding vcookie which is an index into the FS-Cache
      indexing tree. The FS-Cache indexing tree is indexed at 3 levels:
      - session object associated with each mount.
      - inode/vcookie
      - actual data (pages)
      
      A cache tag is chosen randomly for each session. These tags can
      be read off /sys/fs/9p/caches and can be passed as a mount-time
      parameter to re-attach to the specified caching session.
      Signed-off-by: default avatarAbhishek Kulkarni <adkulkar@umail.iu.edu>
      Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
      60e78d2c
  17. 22 Oct, 2008 1 commit