Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-09 Thread kbuild test robot
Hi Davidlohr,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Davidlohr-Bueso/locking-Introduce-range-reader-writer-lock/20170309-140444
config: i386-randconfig-i1-201710 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_io_generic':
>> drivers/staging/lustre/lustre/llite/file.c:1072:4: warning: large integer 
>> implicitly truncated to unsigned type [-Woverflow]
   range_rwlock_init(, 0, LUSTRE_EOF);
   ^

vim +1072 drivers/staging/lustre/lustre/llite/file.c

  1056  struct cl_io *io;
  1057  ssize_t result = 0;
  1058  int rc = 0;
  1059  
  1060  CDEBUG(D_VFSTRACE, "file: %pD, type: %d ppos: %llu, count: 
%zu\n",
  1061 file, iot, *ppos, count);
  1062  
  1063  restart:
  1064  io = vvp_env_thread_io(env);
  1065  ll_io_init(io, file, iot == CIT_WRITE);
  1066  
  1067  if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
  1068  struct vvp_io *vio = vvp_env_io(env);
  1069  bool range_locked = false;
  1070  
  1071  if (file->f_flags & O_APPEND)
> 1072  range_rwlock_init(, 0, LUSTRE_EOF);
  1073  else
  1074  range_rwlock_init(, *ppos, *ppos + count 
- 1);
  1075  
  1076  vio->vui_fd  = LUSTRE_FPRIVATE(file);
  1077  vio->vui_iter = args->u.normal.via_iter;
  1078  vio->vui_iocb = args->u.normal.via_iocb;
  1079  /*
  1080   * Direct IO reads must also take range lock,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-09 Thread kbuild test robot
Hi Davidlohr,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Davidlohr-Bueso/locking-Introduce-range-reader-writer-lock/20170309-140444
config: i386-randconfig-i1-201710 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_io_generic':
>> drivers/staging/lustre/lustre/llite/file.c:1072:4: warning: large integer 
>> implicitly truncated to unsigned type [-Woverflow]
   range_rwlock_init(, 0, LUSTRE_EOF);
   ^

vim +1072 drivers/staging/lustre/lustre/llite/file.c

  1056  struct cl_io *io;
  1057  ssize_t result = 0;
  1058  int rc = 0;
  1059  
  1060  CDEBUG(D_VFSTRACE, "file: %pD, type: %d ppos: %llu, count: 
%zu\n",
  1061 file, iot, *ppos, count);
  1062  
  1063  restart:
  1064  io = vvp_env_thread_io(env);
  1065  ll_io_init(io, file, iot == CIT_WRITE);
  1066  
  1067  if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
  1068  struct vvp_io *vio = vvp_env_io(env);
  1069  bool range_locked = false;
  1070  
  1071  if (file->f_flags & O_APPEND)
> 1072  range_rwlock_init(, 0, LUSTRE_EOF);
  1073  else
  1074  range_rwlock_init(, *ppos, *ppos + count 
- 1);
  1075  
  1076  vio->vui_fd  = LUSTRE_FPRIVATE(file);
  1077  vio->vui_iter = args->u.normal.via_iter;
  1078  vio->vui_iocb = args->u.normal.via_iocb;
  1079  /*
  1080   * Direct IO reads must also take range lock,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-09 Thread kbuild test robot
Hi Davidlohr,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Davidlohr-Bueso/locking-Introduce-range-reader-writer-lock/20170309-140444
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from 
drivers/staging/lustre/lustre/llite/../include/lustre/lustre_idl.h:76:0,
from 
drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:49,
from 
drivers/staging/lustre/lustre/llite/../include/lustre_dlm.h:47,
from drivers/staging/lustre/lustre/llite/file.c:40:
   drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_io_generic':
>> drivers/staging/lustre/lustre/llite/../include/lustre/lustre_user.h:78:20: 
>> warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define LUSTRE_EOF 0xULL
   ^
>> drivers/staging/lustre/lustre/llite/file.c:1072:33: note: in expansion of 
>> macro 'LUSTRE_EOF'
   range_rwlock_init(, 0, LUSTRE_EOF);
^~

vim +78 drivers/staging/lustre/lustre/llite/../include/lustre/lustre_user.h

23ec6607e9 John L. Hammond 2016-09-18  62   * are co-existing.
23ec6607e9 John L. Hammond 2016-09-18  63   */
23ec6607e9 John L. Hammond 2016-09-18  64  #if __BITS_PER_LONG != 64 || 
defined(__ARCH_WANT_STAT64)
23ec6607e9 John L. Hammond 2016-09-18  65  typedef struct stat64   lstat_t;
23ec6607e9 John L. Hammond 2016-09-18  66  #define lstat_f  lstat64
f0cf21abcc John L. Hammond 2016-10-02  67  #define fstat_f  fstat64
f0cf21abcc John L. Hammond 2016-10-02  68  #define fstatat_ffstatat64
23ec6607e9 John L. Hammond 2016-09-18  69  #else
23ec6607e9 John L. Hammond 2016-09-18  70  typedef struct stat lstat_t;
23ec6607e9 John L. Hammond 2016-09-18  71  #define lstat_f  lstat
f0cf21abcc John L. Hammond 2016-10-02  72  #define fstat_f  fstat
f0cf21abcc John L. Hammond 2016-10-02  73  #define fstatat_ffstatat
23ec6607e9 John L. Hammond 2016-09-18  74  #endif
23ec6607e9 John L. Hammond 2016-09-18  75  
23ec6607e9 John L. Hammond 2016-09-18  76  #define HAVE_LOV_USER_MDS_DATA
d7e09d0397 Peng Tao2013-05-02  77  
00c0a6aea0 John L. Hammond 2016-08-16 @78  #define LUSTRE_EOF 
0xULL
00c0a6aea0 John L. Hammond 2016-08-16  79  
d7e09d0397 Peng Tao2013-05-02  80  /* for statfs() */
d7e09d0397 Peng Tao2013-05-02  81  #define LL_SUPER_MAGIC 0x0BD00BD0
d7e09d0397 Peng Tao2013-05-02  82  
d7e09d0397 Peng Tao2013-05-02  83  #ifndef FSFILT_IOC_GETFLAGS
d7e09d0397 Peng Tao2013-05-02  84  #define FSFILT_IOC_GETFLAGS 
_IOR('f', 1, long)
d7e09d0397 Peng Tao2013-05-02  85  #define FSFILT_IOC_SETFLAGS 
_IOW('f', 2, long)
d7e09d0397 Peng Tao2013-05-02  86  #define FSFILT_IOC_GETVERSION
 _IOR('f', 3, long)

:: The code at line 78 was first introduced by commit
:: 00c0a6aea0d0ab2c11594616244d787ad7bf64dc staging: lustre: uapi: reduce 
scope of lustre_idl.h

:: TO: John L. Hammond 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-09 Thread kbuild test robot
Hi Davidlohr,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.11-rc1 next-20170309]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Davidlohr-Bueso/locking-Introduce-range-reader-writer-lock/20170309-140444
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from 
drivers/staging/lustre/lustre/llite/../include/lustre/lustre_idl.h:76:0,
from 
drivers/staging/lustre/lustre/llite/../include/lustre_lib.h:49,
from 
drivers/staging/lustre/lustre/llite/../include/lustre_dlm.h:47,
from drivers/staging/lustre/lustre/llite/file.c:40:
   drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_io_generic':
>> drivers/staging/lustre/lustre/llite/../include/lustre/lustre_user.h:78:20: 
>> warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define LUSTRE_EOF 0xULL
   ^
>> drivers/staging/lustre/lustre/llite/file.c:1072:33: note: in expansion of 
>> macro 'LUSTRE_EOF'
   range_rwlock_init(, 0, LUSTRE_EOF);
^~

vim +78 drivers/staging/lustre/lustre/llite/../include/lustre/lustre_user.h

23ec6607e9 John L. Hammond 2016-09-18  62   * are co-existing.
23ec6607e9 John L. Hammond 2016-09-18  63   */
23ec6607e9 John L. Hammond 2016-09-18  64  #if __BITS_PER_LONG != 64 || 
defined(__ARCH_WANT_STAT64)
23ec6607e9 John L. Hammond 2016-09-18  65  typedef struct stat64   lstat_t;
23ec6607e9 John L. Hammond 2016-09-18  66  #define lstat_f  lstat64
f0cf21abcc John L. Hammond 2016-10-02  67  #define fstat_f  fstat64
f0cf21abcc John L. Hammond 2016-10-02  68  #define fstatat_ffstatat64
23ec6607e9 John L. Hammond 2016-09-18  69  #else
23ec6607e9 John L. Hammond 2016-09-18  70  typedef struct stat lstat_t;
23ec6607e9 John L. Hammond 2016-09-18  71  #define lstat_f  lstat
f0cf21abcc John L. Hammond 2016-10-02  72  #define fstat_f  fstat
f0cf21abcc John L. Hammond 2016-10-02  73  #define fstatat_ffstatat
23ec6607e9 John L. Hammond 2016-09-18  74  #endif
23ec6607e9 John L. Hammond 2016-09-18  75  
23ec6607e9 John L. Hammond 2016-09-18  76  #define HAVE_LOV_USER_MDS_DATA
d7e09d0397 Peng Tao2013-05-02  77  
00c0a6aea0 John L. Hammond 2016-08-16 @78  #define LUSTRE_EOF 
0xULL
00c0a6aea0 John L. Hammond 2016-08-16  79  
d7e09d0397 Peng Tao2013-05-02  80  /* for statfs() */
d7e09d0397 Peng Tao2013-05-02  81  #define LL_SUPER_MAGIC 0x0BD00BD0
d7e09d0397 Peng Tao2013-05-02  82  
d7e09d0397 Peng Tao2013-05-02  83  #ifndef FSFILT_IOC_GETFLAGS
d7e09d0397 Peng Tao2013-05-02  84  #define FSFILT_IOC_GETFLAGS 
_IOR('f', 1, long)
d7e09d0397 Peng Tao2013-05-02  85  #define FSFILT_IOC_SETFLAGS 
_IOW('f', 2, long)
d7e09d0397 Peng Tao2013-05-02  86  #define FSFILT_IOC_GETVERSION
 _IOR('f', 3, long)

:: The code at line 78 was first introduced by commit
:: 00c0a6aea0d0ab2c11594616244d787ad7bf64dc staging: lustre: uapi: reduce 
scope of lustre_idl.h

:: TO: John L. Hammond 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-08 Thread Davidlohr Bueso

On Tue, 07 Mar 2017, Oleg Drokin wrote:

On Mar 7, 2017, at 12:03 AM, Davidlohr Bueso wrote:


This replaces the in-house version, which is also derived
from Jan's interval tree implementation.

Cc: oleg.dro...@intel.com
Cc: andreas.dil...@intel.com
Cc: jsimm...@infradead.org
Cc: lustre-de...@lists.lustre.org

Signed-off-by: Davidlohr Bueso 
---
XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', is 
this a problem?


Hm, cannot seem to find the other patches in this series anywhere to verify and 
my subscription to linux-kernel broke as it turns out.


You can find the full series here:

https://lwn.net/Articles/716383/


You mean the range is ulong? So only can have this working up to 2G offsets on 
the
32bit systems and then wrap around?


Yes.

Thanks,
Davidlohr


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-08 Thread Davidlohr Bueso

On Tue, 07 Mar 2017, Oleg Drokin wrote:

On Mar 7, 2017, at 12:03 AM, Davidlohr Bueso wrote:


This replaces the in-house version, which is also derived
from Jan's interval tree implementation.

Cc: oleg.dro...@intel.com
Cc: andreas.dil...@intel.com
Cc: jsimm...@infradead.org
Cc: lustre-de...@lists.lustre.org

Signed-off-by: Davidlohr Bueso 
---
XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', is 
this a problem?


Hm, cannot seem to find the other patches in this series anywhere to verify and 
my subscription to linux-kernel broke as it turns out.


You can find the full series here:

https://lwn.net/Articles/716383/


You mean the range is ulong? So only can have this working up to 2G offsets on 
the
32bit systems and then wrap around?


Yes.

Thanks,
Davidlohr


Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-07 Thread Oleg Drokin

On Mar 7, 2017, at 12:03 AM, Davidlohr Bueso wrote:

> This replaces the in-house version, which is also derived
> from Jan's interval tree implementation.
> 
> Cc: oleg.dro...@intel.com
> Cc: andreas.dil...@intel.com
> Cc: jsimm...@infradead.org
> Cc: lustre-de...@lists.lustre.org
> 
> Signed-off-by: Davidlohr Bueso 
> ---
> XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', 
> is this a problem?

Hm, cannot seem to find the other patches in this series anywhere to verify and 
my subscription to linux-kernel broke as it turns out.
You mean the range is ulong? So only can have this working up to 2G offsets on 
the
32bit systems and then wrap around?

> 
> drivers/staging/lustre/lustre/llite/Makefile   |   2 +-
> drivers/staging/lustre/lustre/llite/file.c |  21 +-
> .../staging/lustre/lustre/llite/llite_internal.h   |   4 +-
> drivers/staging/lustre/lustre/llite/llite_lib.c|   3 +-
> drivers/staging/lustre/lustre/llite/range_lock.c   | 239 -
> drivers/staging/lustre/lustre/llite/range_lock.h   |  82 ---
> 6 files changed, 15 insertions(+), 336 deletions(-)
> delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.c
> delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.h
> 
> diff --git a/drivers/staging/lustre/lustre/llite/Makefile 
> b/drivers/staging/lustre/lustre/llite/Makefile
> index 322d4fa63f5d..922a901bc62c 100644
> --- a/drivers/staging/lustre/lustre/llite/Makefile
> +++ b/drivers/staging/lustre/lustre/llite/Makefile
> @@ -1,6 +1,6 @@
> obj-$(CONFIG_LUSTRE_FS) += lustre.o
> lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \
> - rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \
> + rw.o rw26.o namei.o symlink.o llite_mmap.o \
>   xattr.o xattr_cache.o xattr_security.o \
>   super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \
>   vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o \
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index 481c0d01d4c6..1a14a79f87f8 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -42,6 +42,7 @@
> #include 
> #include 
> #include 
> +#include 
> #include "../include/lustre/ll_fiemap.h"
> #include "../include/lustre/lustre_ioctl.h"
> #include "../include/lustre_swab.h"
> @@ -1055,7 +1056,7 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   struct ll_inode_info *lli = ll_i2info(file_inode(file));
>   struct ll_file_data  *fd  = LUSTRE_FPRIVATE(file);
>   struct vvp_io *vio = vvp_env_io(env);
> - struct range_lock range;
> + struct range_rwlock range;
>   struct cl_io *io;
>   ssize_t result = 0;
>   int rc = 0;
> @@ -1072,9 +1073,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   bool range_locked = false;
> 
>   if (file->f_flags & O_APPEND)
> - range_lock_init(, 0, LUSTRE_EOF);
> + range_rwlock_init(, 0, LUSTRE_EOF);
>   else
> - range_lock_init(, *ppos, *ppos + count - 1);
> + range_rwlock_init(, *ppos, *ppos + count - 1);
> 
>   vio->vui_fd  = LUSTRE_FPRIVATE(file);
>   vio->vui_iter = args->u.normal.via_iter;
> @@ -1087,10 +1088,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   if (((iot == CIT_WRITE) ||
>(iot == CIT_READ && (file->f_flags & O_DIRECT))) &&
>   !(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
> - CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
> -range.rl_node.in_extent.start,
> -range.rl_node.in_extent.end);
> - rc = range_lock(>lli_write_tree, );
> + CDEBUG(D_VFSTRACE, "Range lock [%lu, %lu]\n",
> +range.node.start, range.node.last);
> + rc = 
> range_write_lock_interruptible(>lli_write_tree, );
>   if (rc < 0)
>   goto out;
> 
> @@ -1100,10 +1100,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   rc = cl_io_loop(env, io);
>   ll_cl_remove(file, env);
>   if (range_locked) {
> - CDEBUG(D_VFSTRACE, "Range unlock [%llu, %llu]\n",
> -range.rl_node.in_extent.start,
> -range.rl_node.in_extent.end);
> - range_unlock(>lli_write_tree, );
> + CDEBUG(D_VFSTRACE, "Range unlock [%lu, %lu]\n",
> +range.node.start, range.node.last);
> + range_write_unlock(>lli_write_tree, );
>   }
>   } else {
> 

Re: [PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-07 Thread Oleg Drokin

On Mar 7, 2017, at 12:03 AM, Davidlohr Bueso wrote:

> This replaces the in-house version, which is also derived
> from Jan's interval tree implementation.
> 
> Cc: oleg.dro...@intel.com
> Cc: andreas.dil...@intel.com
> Cc: jsimm...@infradead.org
> Cc: lustre-de...@lists.lustre.org
> 
> Signed-off-by: Davidlohr Bueso 
> ---
> XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', 
> is this a problem?

Hm, cannot seem to find the other patches in this series anywhere to verify and 
my subscription to linux-kernel broke as it turns out.
You mean the range is ulong? So only can have this working up to 2G offsets on 
the
32bit systems and then wrap around?

> 
> drivers/staging/lustre/lustre/llite/Makefile   |   2 +-
> drivers/staging/lustre/lustre/llite/file.c |  21 +-
> .../staging/lustre/lustre/llite/llite_internal.h   |   4 +-
> drivers/staging/lustre/lustre/llite/llite_lib.c|   3 +-
> drivers/staging/lustre/lustre/llite/range_lock.c   | 239 -
> drivers/staging/lustre/lustre/llite/range_lock.h   |  82 ---
> 6 files changed, 15 insertions(+), 336 deletions(-)
> delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.c
> delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.h
> 
> diff --git a/drivers/staging/lustre/lustre/llite/Makefile 
> b/drivers/staging/lustre/lustre/llite/Makefile
> index 322d4fa63f5d..922a901bc62c 100644
> --- a/drivers/staging/lustre/lustre/llite/Makefile
> +++ b/drivers/staging/lustre/lustre/llite/Makefile
> @@ -1,6 +1,6 @@
> obj-$(CONFIG_LUSTRE_FS) += lustre.o
> lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \
> - rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \
> + rw.o rw26.o namei.o symlink.o llite_mmap.o \
>   xattr.o xattr_cache.o xattr_security.o \
>   super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \
>   vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o \
> diff --git a/drivers/staging/lustre/lustre/llite/file.c 
> b/drivers/staging/lustre/lustre/llite/file.c
> index 481c0d01d4c6..1a14a79f87f8 100644
> --- a/drivers/staging/lustre/lustre/llite/file.c
> +++ b/drivers/staging/lustre/lustre/llite/file.c
> @@ -42,6 +42,7 @@
> #include 
> #include 
> #include 
> +#include 
> #include "../include/lustre/ll_fiemap.h"
> #include "../include/lustre/lustre_ioctl.h"
> #include "../include/lustre_swab.h"
> @@ -1055,7 +1056,7 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   struct ll_inode_info *lli = ll_i2info(file_inode(file));
>   struct ll_file_data  *fd  = LUSTRE_FPRIVATE(file);
>   struct vvp_io *vio = vvp_env_io(env);
> - struct range_lock range;
> + struct range_rwlock range;
>   struct cl_io *io;
>   ssize_t result = 0;
>   int rc = 0;
> @@ -1072,9 +1073,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   bool range_locked = false;
> 
>   if (file->f_flags & O_APPEND)
> - range_lock_init(, 0, LUSTRE_EOF);
> + range_rwlock_init(, 0, LUSTRE_EOF);
>   else
> - range_lock_init(, *ppos, *ppos + count - 1);
> + range_rwlock_init(, *ppos, *ppos + count - 1);
> 
>   vio->vui_fd  = LUSTRE_FPRIVATE(file);
>   vio->vui_iter = args->u.normal.via_iter;
> @@ -1087,10 +1088,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   if (((iot == CIT_WRITE) ||
>(iot == CIT_READ && (file->f_flags & O_DIRECT))) &&
>   !(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
> - CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
> -range.rl_node.in_extent.start,
> -range.rl_node.in_extent.end);
> - rc = range_lock(>lli_write_tree, );
> + CDEBUG(D_VFSTRACE, "Range lock [%lu, %lu]\n",
> +range.node.start, range.node.last);
> + rc = 
> range_write_lock_interruptible(>lli_write_tree, );
>   if (rc < 0)
>   goto out;
> 
> @@ -1100,10 +1100,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
> vvp_io_args *args,
>   rc = cl_io_loop(env, io);
>   ll_cl_remove(file, env);
>   if (range_locked) {
> - CDEBUG(D_VFSTRACE, "Range unlock [%llu, %llu]\n",
> -range.rl_node.in_extent.start,
> -range.rl_node.in_extent.end);
> - range_unlock(>lli_write_tree, );
> + CDEBUG(D_VFSTRACE, "Range unlock [%lu, %lu]\n",
> +range.node.start, range.node.last);
> + range_write_unlock(>lli_write_tree, );
>   }
>   } else {
>   /* 

[PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-06 Thread Davidlohr Bueso
This replaces the in-house version, which is also derived
from Jan's interval tree implementation.

Cc: oleg.dro...@intel.com
Cc: andreas.dil...@intel.com
Cc: jsimm...@infradead.org
Cc: lustre-de...@lists.lustre.org

Signed-off-by: Davidlohr Bueso 
---
XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', is 
this a problem?

 drivers/staging/lustre/lustre/llite/Makefile   |   2 +-
 drivers/staging/lustre/lustre/llite/file.c |  21 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |   4 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|   3 +-
 drivers/staging/lustre/lustre/llite/range_lock.c   | 239 -
 drivers/staging/lustre/lustre/llite/range_lock.h   |  82 ---
 6 files changed, 15 insertions(+), 336 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.c
 delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.h

diff --git a/drivers/staging/lustre/lustre/llite/Makefile 
b/drivers/staging/lustre/lustre/llite/Makefile
index 322d4fa63f5d..922a901bc62c 100644
--- a/drivers/staging/lustre/lustre/llite/Makefile
+++ b/drivers/staging/lustre/lustre/llite/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_LUSTRE_FS) += lustre.o
 lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \
-   rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \
+   rw.o rw26.o namei.o symlink.o llite_mmap.o \
xattr.o xattr_cache.o xattr_security.o \
super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \
vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o \
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 481c0d01d4c6..1a14a79f87f8 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "../include/lustre/ll_fiemap.h"
 #include "../include/lustre/lustre_ioctl.h"
 #include "../include/lustre_swab.h"
@@ -1055,7 +1056,7 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
struct ll_inode_info *lli = ll_i2info(file_inode(file));
struct ll_file_data  *fd  = LUSTRE_FPRIVATE(file);
struct vvp_io *vio = vvp_env_io(env);
-   struct range_lock range;
+   struct range_rwlock range;
struct cl_io *io;
ssize_t result = 0;
int rc = 0;
@@ -1072,9 +1073,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
bool range_locked = false;
 
if (file->f_flags & O_APPEND)
-   range_lock_init(, 0, LUSTRE_EOF);
+   range_rwlock_init(, 0, LUSTRE_EOF);
else
-   range_lock_init(, *ppos, *ppos + count - 1);
+   range_rwlock_init(, *ppos, *ppos + count - 1);
 
vio->vui_fd  = LUSTRE_FPRIVATE(file);
vio->vui_iter = args->u.normal.via_iter;
@@ -1087,10 +1088,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
if (((iot == CIT_WRITE) ||
 (iot == CIT_READ && (file->f_flags & O_DIRECT))) &&
!(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
-   CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
-  range.rl_node.in_extent.start,
-  range.rl_node.in_extent.end);
-   rc = range_lock(>lli_write_tree, );
+   CDEBUG(D_VFSTRACE, "Range lock [%lu, %lu]\n",
+  range.node.start, range.node.last);
+   rc = 
range_write_lock_interruptible(>lli_write_tree, );
if (rc < 0)
goto out;
 
@@ -1100,10 +1100,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
rc = cl_io_loop(env, io);
ll_cl_remove(file, env);
if (range_locked) {
-   CDEBUG(D_VFSTRACE, "Range unlock [%llu, %llu]\n",
-  range.rl_node.in_extent.start,
-  range.rl_node.in_extent.end);
-   range_unlock(>lli_write_tree, );
+   CDEBUG(D_VFSTRACE, "Range unlock [%lu, %lu]\n",
+  range.node.start, range.node.last);
+   range_write_unlock(>lli_write_tree, );
}
} else {
/* cl_io_rw_init() handled IO */
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 55f68acd85d1..aa2ae72e3e70 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -49,8 +49,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 

[PATCH 5/5] staging/lustre: Use generic range rwlock

2017-03-06 Thread Davidlohr Bueso
This replaces the in-house version, which is also derived
from Jan's interval tree implementation.

Cc: oleg.dro...@intel.com
Cc: andreas.dil...@intel.com
Cc: jsimm...@infradead.org
Cc: lustre-de...@lists.lustre.org

Signed-off-by: Davidlohr Bueso 
---
XXX: compile tested only. In house uses 'ulong long', generic uses 'ulong', is 
this a problem?

 drivers/staging/lustre/lustre/llite/Makefile   |   2 +-
 drivers/staging/lustre/lustre/llite/file.c |  21 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |   4 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|   3 +-
 drivers/staging/lustre/lustre/llite/range_lock.c   | 239 -
 drivers/staging/lustre/lustre/llite/range_lock.h   |  82 ---
 6 files changed, 15 insertions(+), 336 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.c
 delete mode 100644 drivers/staging/lustre/lustre/llite/range_lock.h

diff --git a/drivers/staging/lustre/lustre/llite/Makefile 
b/drivers/staging/lustre/lustre/llite/Makefile
index 322d4fa63f5d..922a901bc62c 100644
--- a/drivers/staging/lustre/lustre/llite/Makefile
+++ b/drivers/staging/lustre/lustre/llite/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_LUSTRE_FS) += lustre.o
 lustre-y := dcache.o dir.o file.o llite_lib.o llite_nfs.o \
-   rw.o rw26.o namei.o symlink.o llite_mmap.o range_lock.o \
+   rw.o rw26.o namei.o symlink.o llite_mmap.o \
xattr.o xattr_cache.o xattr_security.o \
super25.o statahead.o glimpse.o lcommon_cl.o lcommon_misc.o \
vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o \
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 481c0d01d4c6..1a14a79f87f8 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "../include/lustre/ll_fiemap.h"
 #include "../include/lustre/lustre_ioctl.h"
 #include "../include/lustre_swab.h"
@@ -1055,7 +1056,7 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
struct ll_inode_info *lli = ll_i2info(file_inode(file));
struct ll_file_data  *fd  = LUSTRE_FPRIVATE(file);
struct vvp_io *vio = vvp_env_io(env);
-   struct range_lock range;
+   struct range_rwlock range;
struct cl_io *io;
ssize_t result = 0;
int rc = 0;
@@ -1072,9 +1073,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
bool range_locked = false;
 
if (file->f_flags & O_APPEND)
-   range_lock_init(, 0, LUSTRE_EOF);
+   range_rwlock_init(, 0, LUSTRE_EOF);
else
-   range_lock_init(, *ppos, *ppos + count - 1);
+   range_rwlock_init(, *ppos, *ppos + count - 1);
 
vio->vui_fd  = LUSTRE_FPRIVATE(file);
vio->vui_iter = args->u.normal.via_iter;
@@ -1087,10 +1088,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
if (((iot == CIT_WRITE) ||
 (iot == CIT_READ && (file->f_flags & O_DIRECT))) &&
!(vio->vui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
-   CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
-  range.rl_node.in_extent.start,
-  range.rl_node.in_extent.end);
-   rc = range_lock(>lli_write_tree, );
+   CDEBUG(D_VFSTRACE, "Range lock [%lu, %lu]\n",
+  range.node.start, range.node.last);
+   rc = 
range_write_lock_interruptible(>lli_write_tree, );
if (rc < 0)
goto out;
 
@@ -1100,10 +1100,9 @@ ll_file_io_generic(const struct lu_env *env, struct 
vvp_io_args *args,
rc = cl_io_loop(env, io);
ll_cl_remove(file, env);
if (range_locked) {
-   CDEBUG(D_VFSTRACE, "Range unlock [%llu, %llu]\n",
-  range.rl_node.in_extent.start,
-  range.rl_node.in_extent.end);
-   range_unlock(>lli_write_tree, );
+   CDEBUG(D_VFSTRACE, "Range unlock [%lu, %lu]\n",
+  range.node.start, range.node.last);
+   range_write_unlock(>lli_write_tree, );
}
} else {
/* cl_io_rw_init() handled IO */
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 55f68acd85d1..aa2ae72e3e70 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -49,8 +49,8 @@
 #include 
 #include 
 #include 
+#include 
 #include "vvp_internal.h"
-#include