Message ID | f52d649dd35c616786b54ff7d76c6bcf95f9197e.1608053602.git.rgoldwyn@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix locking for btrfs direct writes | expand |
Hi Goldwyn, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [also build test WARNING on v5.10 next-20201215] [cannot apply to xfs-linux/for-next] [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/Goldwyn-Rodrigues/Fix-locking-for-btrfs-direct-writes/20201216-021312 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next config: sparc-randconfig-s031-20201215 (attached as .config) compiler: sparc-linux-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.3-184-g1b896707-dirty # https://github.com/0day-ci/linux/commit/4706fd8a8832b4948c25abc5fec38a017704d828 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Goldwyn-Rodrigues/Fix-locking-for-btrfs-direct-writes/20201216-021312 git checkout 4706fd8a8832b4948c25abc5fec38a017704d828 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): >> fs/iomap/direct-io.c:127:9: warning: no previous prototype for 'iomap_dio_complete' [-Wmissing-prototypes] 127 | ssize_t iomap_dio_complete(struct iomap_dio *dio) | ^~~~~~~~~~~~~~~~~~ "sparse warnings: (new ones prefixed by >>)" vim +/iomap_dio_complete +127 fs/iomap/direct-io.c 126 > 127 ssize_t iomap_dio_complete(struct iomap_dio *dio) 128 { 129 ssize_t ret; 130 131 ret = __iomap_dio_complete(dio); 132 /* 133 * If this is a DSYNC write, make sure we push it to stable storage now 134 * that we've written data. 135 */ 136 if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) 137 ret = generic_write_sync(dio->iocb, ret); 138 139 kfree(dio); 140 141 return ret; 142 } 143 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Tue, Dec 15, 2020 at 12:06:35PM -0600, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@suse.com> > > This introduces a separate function __iomap_dio_complte() which > completes the Direct I/O without performing the write sync. > > Filesystems such as btrfs which require an inode_lock for sync can call > __iomap_dio_complete() and must perform sync on their own after unlock. > > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> > --- > fs/iomap/direct-io.c | 16 +++++++++++++--- > include/linux/iomap.h | 2 +- > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c > index 933f234d5bec..11a108f39fd9 100644 > --- a/fs/iomap/direct-io.c > +++ b/fs/iomap/direct-io.c > @@ -76,7 +76,7 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, > dio->submit.cookie = submit_bio(bio); > } > > -ssize_t iomap_dio_complete(struct iomap_dio *dio) > +ssize_t __iomap_dio_complete(struct iomap_dio *dio) > { > const struct iomap_dio_ops *dops = dio->dops; > struct kiocb *iocb = dio->iocb; > @@ -119,18 +119,28 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) > } > > inode_dio_end(file_inode(iocb->ki_filp)); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(__iomap_dio_complete); > + > +ssize_t iomap_dio_complete(struct iomap_dio *dio) > +{ > + ssize_t ret; > + > + ret = __iomap_dio_complete(dio); > /* > * If this is a DSYNC write, make sure we push it to stable storage now > * that we've written data. > */ > if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) > - ret = generic_write_sync(iocb, ret); > + ret = generic_write_sync(dio->iocb, ret); > > kfree(dio); > > return ret; > } > -EXPORT_SYMBOL_GPL(iomap_dio_complete); > + NACK. If you don't want iomap_dio_complete to do O_DSYNC work after successfully writing data, strip those flags out of the kiocb before you call iomap_dio_rw() and do it yourself after calling iomap_dio_complete(). Cheers, Dave.
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index 933f234d5bec..11a108f39fd9 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -76,7 +76,7 @@ static void iomap_dio_submit_bio(struct iomap_dio *dio, struct iomap *iomap, dio->submit.cookie = submit_bio(bio); } -ssize_t iomap_dio_complete(struct iomap_dio *dio) +ssize_t __iomap_dio_complete(struct iomap_dio *dio) { const struct iomap_dio_ops *dops = dio->dops; struct kiocb *iocb = dio->iocb; @@ -119,18 +119,28 @@ ssize_t iomap_dio_complete(struct iomap_dio *dio) } inode_dio_end(file_inode(iocb->ki_filp)); + + return ret; +} +EXPORT_SYMBOL_GPL(__iomap_dio_complete); + +ssize_t iomap_dio_complete(struct iomap_dio *dio) +{ + ssize_t ret; + + ret = __iomap_dio_complete(dio); /* * If this is a DSYNC write, make sure we push it to stable storage now * that we've written data. */ if (ret > 0 && (dio->flags & IOMAP_DIO_NEED_SYNC)) - ret = generic_write_sync(iocb, ret); + ret = generic_write_sync(dio->iocb, ret); kfree(dio); return ret; } -EXPORT_SYMBOL_GPL(iomap_dio_complete); + static void iomap_dio_complete_work(struct work_struct *work) { diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 5bd3cac4df9c..5785dc0b8ec5 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -262,7 +262,7 @@ ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, struct iomap_dio *__iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, const struct iomap_ops *ops, const struct iomap_dio_ops *dops, bool wait_for_completion); -ssize_t iomap_dio_complete(struct iomap_dio *dio); +ssize_t __iomap_dio_complete(struct iomap_dio *dio); int iomap_dio_iopoll(struct kiocb *kiocb, bool spin); #ifdef CONFIG_SWAP