diff mbox series

[22/22] mpool: add Kconfig and Makefile

Message ID 20200928164534.48203-23-nmeeramohide@micron.com (mailing list archive)
State Superseded
Headers show
Series add Object Storage Media Pool (mpool) | expand

Commit Message

Nabeel Meeramohideen Mohamed (nmeeramohide) Sept. 28, 2020, 4:45 p.m. UTC
From: Nabeel M Mohamed <nmeeramohide@micron.com>

This adds the Kconfig and Makefile for mpool.

Co-developed-by: Greg Becker <gbecker@micron.com>
Signed-off-by: Greg Becker <gbecker@micron.com>
Co-developed-by: Pierre Labat <plabat@micron.com>
Signed-off-by: Pierre Labat <plabat@micron.com>
Co-developed-by: John Groves <jgroves@micron.com>
Signed-off-by: John Groves <jgroves@micron.com>
Signed-off-by: Nabeel M Mohamed <nmeeramohide@micron.com>
---
 drivers/Kconfig        |  2 ++
 drivers/Makefile       |  1 +
 drivers/mpool/Kconfig  | 28 ++++++++++++++++++++++++++++
 drivers/mpool/Makefile | 11 +++++++++++
 4 files changed, 42 insertions(+)
 create mode 100644 drivers/mpool/Kconfig
 create mode 100644 drivers/mpool/Makefile

Comments

kernel test robot Sept. 28, 2020, 11:47 p.m. UTC | #1
Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.9-rc7 next-20200928]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/nmeeramohide-micron-com/add-Object-Storage-Media-Pool-mpool/20200929-004933
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/0d485fc58582bd112bb72fe15f107e8cbe3536b0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review nmeeramohide-micron-com/add-Object-Storage-Media-Pool-mpool/20200929-004933
        git checkout 0d485fc58582bd112bb72fe15f107e8cbe3536b0
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from arch/m68k/include/asm/io_mm.h:25,
                    from arch/m68k/include/asm/io.h:8,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:13,
                    from ./arch/m68k/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/highmem.h:10,
                    from include/linux/pagemap.h:11,
                    from include/linux/blkdev.h:16,
                    from drivers/mpool/pd.c:15:
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
   arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      83 |  ({u8 __w, __v = (b);  u32 _addr = ((u32) (addr)); \
         |       ^~~
   arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
     430 |   rom_out_8(port, *buf++);
         |   ^~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
   arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      86 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
     448 |   rom_out_be16(port, *buf++);
         |   ^~~~~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
   arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      90 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
     466 |   rom_out_le16(port, *buf++);
         |   ^~~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from drivers/mpool/pd.c:14:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/mpool/pd.c: In function 'pd_bio_rw':
>> drivers/mpool/pd.c:294:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     294 |   iov_base = (u64)iov[i].iov_base;
         |              ^
>> drivers/mpool/pd.c:224:13: warning: variable 'op' set but not used [-Wunused-but-set-variable]
     224 |  int i, cc, op;
         |             ^~
--
>> drivers/mpool/omf.c:27: warning: "STR" redefined
      27 | #define STR(x)  _STR(x)
         | 
   In file included from arch/m68k/include/asm/irqflags.h:8,
                    from include/linux/irqflags.h:16,
                    from include/linux/spinlock.h:54,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/slab.h:15,
                    from drivers/mpool/omf.c:16:
   arch/m68k/include/asm/entry.h:244: note: this is the location of the previous definition
     244 | #define STR(X) STR1(X)
         | 
   drivers/mpool/omf.c:28:19: warning: 'mpool_sbver' defined but not used [-Wunused-const-variable=]
      28 | static const char mpool_sbver[] = "MPOOL_SBVER_" STR(OMF_SB_DESC_VER_LAST);
         |                   ^~~~~~~~~~~
--
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:15,
                    from include/asm-generic/bug.h:19,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from drivers/mpool/mdc.c:6:
   drivers/mpool/mdc.c: In function 'mp_mdc_read':
   include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
         |                  ^~~~~~~~
   include/linux/printk.h:338:9: note: in expansion of macro 'KERN_ERR'
     338 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~
   drivers/mpool/mpool_printk.h:17:2: note: in expansion of macro 'pr_err'
      17 |  pr_err("%s: " _fmt ": errno %d", __func__, ## __VA_ARGS__, (_err))
         |  ^~~~~~
   drivers/mpool/mdc.c:458:3: note: in expansion of macro 'mp_pr_err'
     458 |   mp_pr_err("mpool %s, mdc %p read failed, mlog %p len %lu",
         |   ^~~~~~~~~
   drivers/mpool/mdc.c:458:58: note: format string is defined here
     458 |   mp_pr_err("mpool %s, mdc %p read failed, mlog %p len %lu",
         |                                                        ~~^
         |                                                          |
         |                                                          long unsigned int
         |                                                        %u
   In file included from include/linux/printk.h:7,
                    from include/linux/kernel.h:15,
                    from include/asm-generic/bug.h:19,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from drivers/mpool/mdc.c:6:
   drivers/mpool/mdc.c: In function 'mp_mdc_append':
>> include/linux/kern_levels.h:5:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'ssize_t' {aka 'int'} [-Wformat=]
       5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
         |                  ^~~~~~
   include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
      11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
         |                  ^~~~~~~~
   include/linux/printk.h:338:9: note: in expansion of macro 'KERN_ERR'
     338 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~
   drivers/mpool/mpool_printk.h:39:3: note: in expansion of macro 'pr_err'
      39 |   pr_err("%s: " _fmt ": errno %d",  \
         |   ^~~~~~
   drivers/mpool/mdc.c:480:3: note: in expansion of macro 'mp_pr_rl'
     480 |   mp_pr_rl("mpool %s, mdc %p append failed, mlog %p, len %lu sync %d",
         |   ^~~~~~~~
   drivers/mpool/mdc.c:480:60: note: format string is defined here
     480 |   mp_pr_rl("mpool %s, mdc %p append failed, mlog %p, len %lu sync %d",
         |                                                          ~~^
         |                                                            |
         |                                                            long unsigned int
         |                                                          %u
--
   In file included from arch/m68k/include/asm/io_mm.h:25,
                    from arch/m68k/include/asm/io.h:8,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:13,
                    from ./arch/m68k/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/highmem.h:10,
                    from include/linux/pagemap.h:11,
                    from include/linux/blkdev.h:16,
                    from drivers/mpool/mpctl.c:14:
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
   arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      83 |  ({u8 __w, __v = (b);  u32 _addr = ((u32) (addr)); \
         |       ^~~
   arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
     430 |   rom_out_8(port, *buf++);
         |   ^~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
   arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      86 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
     448 |   rom_out_be16(port, *buf++);
         |   ^~~~~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
   arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      90 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
     466 |   rom_out_le16(port, *buf++);
         |   ^~~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from drivers/mpool/mpctl.c:6:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/mpool/mpctl.c: In function 'mpc_open':
>> drivers/mpool/mpctl.c:2393:23: warning: left shift count >= width of type [-Wshift-count-overflow]
    2393 |  i_size_write(ip, 1ul << 63);
         |                       ^~
--
   In file included from arch/m68k/include/asm/io_mm.h:25,
                    from arch/m68k/include/asm/io.h:8,
                    from include/linux/io.h:13,
                    from include/linux/irq.h:20,
                    from include/asm-generic/hardirq.h:13,
                    from ./arch/m68k/include/generated/asm/hardirq.h:1,
                    from include/linux/hardirq.h:10,
                    from include/linux/interrupt.h:11,
                    from include/linux/kernel_stat.h:9,
                    from include/linux/cgroup.h:26,
                    from include/linux/memcontrol.h:13,
                    from drivers/mpool/mcache.c:7:
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsb':
   arch/m68k/include/asm/raw_io.h:83:7: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      83 |  ({u8 __w, __v = (b);  u32 _addr = ((u32) (addr)); \
         |       ^~~
   arch/m68k/include/asm/raw_io.h:430:3: note: in expansion of macro 'rom_out_8'
     430 |   rom_out_8(port, *buf++);
         |   ^~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw':
   arch/m68k/include/asm/raw_io.h:86:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      86 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:448:3: note: in expansion of macro 'rom_out_be16'
     448 |   rom_out_be16(port, *buf++);
         |   ^~~~~~~~~~~~
   arch/m68k/include/asm/raw_io.h: In function 'raw_rom_outsw_swapw':
   arch/m68k/include/asm/raw_io.h:90:8: warning: variable '__w' set but not used [-Wunused-but-set-variable]
      90 |  ({u16 __w, __v = (w); u32 _addr = ((u32) (addr)); \
         |        ^~~
   arch/m68k/include/asm/raw_io.h:466:3: note: in expansion of macro 'rom_out_le16'
     466 |   rom_out_le16(port, *buf++);
         |   ^~~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/mpool/mcache.c:6:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/mpool/mcache.c: In function 'mpc_readpages':
>> drivers/mpool/mcache.c:581:3: error: implicit declaration of function 'prefetchw' [-Werror=implicit-function-declaration]
     581 |   prefetchw(&page->flags);
         |   ^~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/mpool/reaper.c: In function 'mpc_reap_xvm_add':
>> drivers/mpool/reaper.c:577:12: warning: variable 'mult' set but not used [-Wunused-but-set-variable]
     577 |  uint idx, mult;
         |            ^~~~

vim +/prefetchw +581 drivers/mpool/mcache.c

3114e86da188ef1 Nabeel M Mohamed 2020-09-28  499  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  500  static int mpc_readpages(struct file *file, struct address_space *mapping,
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  501  			 struct list_head *pages, uint nr_pages)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  502  {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  503  	struct workqueue_struct *wq;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  504  	struct readpage_work *w;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  505  	struct work_struct *work;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  506  	struct mpc_mbinfo *mbinfo;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  507  	struct mpc_unit *unit;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  508  	struct mpc_xvm *xvm;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  509  	struct page *page;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  510  	off_t offset, mbend;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  511  	uint mbnum, iovmax, i;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  512  	uint ra_pages_max;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  513  	ulong index;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  514  	gfp_t gfp;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  515  	u32 key;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  516  	int rc;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  517  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  518  	unit = file->private_data;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  519  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  520  	ra_pages_max = unit->un_ra_pages_max;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  521  	if (ra_pages_max < 1)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  522  		return 0;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  523  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  524  	page   = lru_to_page(pages);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  525  	offset = page->index << PAGE_SHIFT;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  526  	index  = page->index;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  527  	work   = NULL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  528  	w      = NULL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  529  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  530  	key = offset >> xvm_size_max;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  531  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  532  	/*
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  533  	 * The idr value here (xvm) is pinned for the lifetime of the address map.
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  534  	 * Therefore, we can exit the rcu read-side critsec without worry that xvm will be
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  535  	 * destroyed before put_page() has been called on each and every page in the given
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  536  	 * list of pages.
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  537  	 */
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  538  	rcu_read_lock();
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  539  	xvm = idr_find(&unit->un_rgnmap.rm_root, key);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  540  	rcu_read_unlock();
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  541  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  542  	if (!xvm)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  543  		return 0;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  544  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  545  	offset %= (1ul << xvm_size_max);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  546  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  547  	mbnum = offset / xvm->xvm_bktsz;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  548  	if (mbnum >= xvm->xvm_mbinfoc)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  549  		return 0;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  550  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  551  	mbinfo = xvm->xvm_mbinfov + mbnum;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  552  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  553  	mbend = mbnum * xvm->xvm_bktsz + mbinfo->mblen;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  554  	iovmax = MPC_RA_IOV_MAX;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  555  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  556  	gfp = mapping_gfp_mask(mapping) & GFP_KERNEL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  557  	wq = mpc_rgn2wq(xvm->xvm_rgn);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  558  
f5867898fb79966 Nabeel M Mohamed 2020-09-28  559  	if (mpc_reap_xvm_duress(xvm))
f5867898fb79966 Nabeel M Mohamed 2020-09-28  560  		nr_pages = min_t(uint, nr_pages, 8);
f5867898fb79966 Nabeel M Mohamed 2020-09-28  561  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  562  	nr_pages = min_t(uint, nr_pages, ra_pages_max);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  563  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  564  	for (i = 0; i < nr_pages; ++i) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  565  		page    = lru_to_page(pages);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  566  		offset  = page->index << PAGE_SHIFT;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  567  		offset %= (1ul << xvm_size_max);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  568  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  569  		/* Don't read past the end of the mblock. */
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  570  		if (offset >= mbend)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  571  			break;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  572  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  573  		/* mblock reads must be logically contiguous. */
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  574  		if (page->index != index && work) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  575  			queue_work(wq, work);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  576  			work = NULL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  577  		}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  578  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  579  		index = page->index + 1; /* next expected page index */
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  580  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28 @581  		prefetchw(&page->flags);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  582  		list_del(&page->lru);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  583  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  584  		rc = add_to_page_cache_lru(page, mapping, page->index, gfp);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  585  		if (rc) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  586  			if (work) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  587  				queue_work(wq, work);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  588  				work = NULL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  589  			}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  590  			put_page(page);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  591  			continue;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  592  		}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  593  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  594  		if (!work) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  595  			w = page_address(page);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  596  			INIT_WORK(&w->w_work, mpc_readpages_cb);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  597  			w->w_args.a_xvm = xvm;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  598  			w->w_args.a_mbdesc = mbinfo->mbdesc;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  599  			w->w_args.a_mboffset = offset % xvm->xvm_bktsz;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  600  			w->w_args.a_pagec = 0;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  601  			work = &w->w_work;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  602  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  603  			iovmax = MPC_RA_IOV_MAX;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  604  			iovmax -= page->index % MPC_RA_IOV_MAX;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  605  		}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  606  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  607  		w->w_args.a_pagev[w->w_args.a_pagec++] = page;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  608  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  609  		/*
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  610  		 * Restrict batch size to the number of struct kvecs
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  611  		 * that will fit into a page (minus our header).
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  612  		 */
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  613  		if (w->w_args.a_pagec >= iovmax) {
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  614  			queue_work(wq, work);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  615  			work = NULL;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  616  		}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  617  	}
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  618  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  619  	if (work)
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  620  		queue_work(wq, work);
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  621  
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  622  	return 0;
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  623  }
3114e86da188ef1 Nabeel M Mohamed 2020-09-28  624  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/Kconfig b/drivers/Kconfig
index dcecc9f6e33f..547ac47a10eb 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -235,4 +235,6 @@  source "drivers/interconnect/Kconfig"
 source "drivers/counter/Kconfig"
 
 source "drivers/most/Kconfig"
+
+source "drivers/mpool/Kconfig"
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index c0cd1b9075e3..e2477288e761 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -188,3 +188,4 @@  obj-$(CONFIG_GNSS)		+= gnss/
 obj-$(CONFIG_INTERCONNECT)	+= interconnect/
 obj-$(CONFIG_COUNTER)		+= counter/
 obj-$(CONFIG_MOST)		+= most/
+obj-$(CONFIG_MPOOL)		+= mpool/
diff --git a/drivers/mpool/Kconfig b/drivers/mpool/Kconfig
new file mode 100644
index 000000000000..33380f497473
--- /dev/null
+++ b/drivers/mpool/Kconfig
@@ -0,0 +1,28 @@ 
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Object Storage Media Pool (mpool) configuration
+#
+
+config MPOOL
+	tristate "Object Storage Media Pool"
+	depends on BLOCK
+	default n
+	help
+	  This module implements a simple transactional object store on top of
+	  block storage devices.
+
+	  Mpool provides a high-performance alternative to file systems or
+	  raw block devices for applications that can benefit from its simple
+	  object storage model and unique features.
+
+	  If you want to use mpool, choose M here: the module will be called mpool.
+
+config MPOOL_ASSERT
+	bool "Object Storage Media Pool assert support"
+	depends on MPOOL
+	default n
+	help
+	  Enables runtime assertion checking for mpool.
+
+	  This is a developer only config. If this config is enabled and any of the
+	  asserts trigger, it results in a panic.
diff --git a/drivers/mpool/Makefile b/drivers/mpool/Makefile
new file mode 100644
index 000000000000..374bbe5bcfa0
--- /dev/null
+++ b/drivers/mpool/Makefile
@@ -0,0 +1,11 @@ 
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Makefile for Object Storage Media Pool (mpool)
+#
+
+obj-$(CONFIG_MPOOL) += mpool.o
+
+mpool-y             := init.o pd.o mclass.o smap.o omf.o \
+		       upgrade.o sb.o pmd_obj.o mblock.o  \
+		       mlog_utils.o mlog.o mdc.o mpcore.o pmd.o \
+		       mp.o mpctl.o sysfs.o mcache.o reaper.o