* [ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 15/61] fs/netfs/buffered_read.c:261:12-13: WARNING opportunity for min()
@ 2022-07-09 14:32 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-07-09 14:32 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 5971 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: "GNU/Weeb Mailing List" <gwml@vger.gnuweeb.org>
CC: linux-kernel(a)vger.kernel.org
TO: David Howells <dhowells@redhat.com>
tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-linked-list
head: ce4670495468b797b0c5927fcb661bc0da48b9ab
commit: 44acd768fad13579d00524cf853d6ba6e682caba [15/61] netfs: Implement support for DIO read
:::::: branch date: 8 days ago
:::::: commit date: 9 days ago
config: openrisc-randconfig-c024-20220707 (https://download.01.org/0day-ci/archive/20220709/202207092231.QXWW4ouN-lkp(a)intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.3.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
cocci warnings: (new ones prefixed by >>)
>> fs/netfs/buffered_read.c:261:12-13: WARNING opportunity for min()
vim +261 fs/netfs/buffered_read.c
16211268fcb3667 David Howells 2022-03-01 214
16211268fcb3667 David Howells 2022-03-01 215 /**
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 216) * netfs_read_folio - Helper to manage a read_folio request
16211268fcb3667 David Howells 2022-03-01 217 * @file: The file to read from
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 218) * @folio: The folio to read
16211268fcb3667 David Howells 2022-03-01 219 *
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 220) * Fulfil a read_folio request by drawing data from the cache if
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 221) * possible, or the netfs if not. Space beyond the EOF is zero-filled.
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 222) * Multiple I/O requests from different sources will get munged together.
16211268fcb3667 David Howells 2022-03-01 223 *
16211268fcb3667 David Howells 2022-03-01 224 * The calling netfs must initialise a netfs context contiguous to the vfs
16211268fcb3667 David Howells 2022-03-01 225 * inode before calling this.
16211268fcb3667 David Howells 2022-03-01 226 *
16211268fcb3667 David Howells 2022-03-01 227 * This is usable whether or not caching is enabled.
16211268fcb3667 David Howells 2022-03-01 228 */
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 229) int netfs_read_folio(struct file *file, struct folio *folio)
16211268fcb3667 David Howells 2022-03-01 230 {
16211268fcb3667 David Howells 2022-03-01 231 struct address_space *mapping = folio_file_mapping(folio);
16211268fcb3667 David Howells 2022-03-01 232 struct netfs_io_request *rreq;
874c8ca1e60b2c5 David Howells 2022-06-09 233 struct netfs_inode *ctx = netfs_inode(mapping->host);
44acd768fad1357 David Howells 2022-01-14 234 ssize_t ret;
16211268fcb3667 David Howells 2022-03-01 235
16211268fcb3667 David Howells 2022-03-01 236 _enter("%lx", folio_index(folio));
16211268fcb3667 David Howells 2022-03-01 237
16211268fcb3667 David Howells 2022-03-01 238 rreq = netfs_alloc_request(mapping, file,
16211268fcb3667 David Howells 2022-03-01 239 folio_file_pos(folio), folio_size(folio),
16211268fcb3667 David Howells 2022-03-01 240 NETFS_READPAGE);
16211268fcb3667 David Howells 2022-03-01 241 if (IS_ERR(rreq)) {
16211268fcb3667 David Howells 2022-03-01 242 ret = PTR_ERR(rreq);
16211268fcb3667 David Howells 2022-03-01 243 goto alloc_error;
16211268fcb3667 David Howells 2022-03-01 244 }
16211268fcb3667 David Howells 2022-03-01 245
2dc0ef9af0bb9de David Howells 2021-08-10 246 ret = netfs_begin_cache_operation(rreq, ctx);
16211268fcb3667 David Howells 2022-03-01 247 if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS)
16211268fcb3667 David Howells 2022-03-01 248 goto discard;
16211268fcb3667 David Howells 2022-03-01 249
16211268fcb3667 David Howells 2022-03-01 250 netfs_stat(&netfs_n_rh_readpage);
16211268fcb3667 David Howells 2022-03-01 251 trace_netfs_read(rreq, rreq->start, rreq->len, netfs_read_trace_readpage);
6e7e799136cd274 David Howells 2021-07-09 252
6e7e799136cd274 David Howells 2021-07-09 253 /* Set up the output buffer */
6e7e799136cd274 David Howells 2021-07-09 254 rreq->buffering = NETFS_BUFFER;
6e7e799136cd274 David Howells 2021-07-09 255 ret = netfs_set_up_buffer(&rreq->buffer, rreq->mapping, NULL, folio,
6e7e799136cd274 David Howells 2021-07-09 256 folio_index(folio), folio_nr_pages(folio));
6e7e799136cd274 David Howells 2021-07-09 257 if (ret < 0)
6e7e799136cd274 David Howells 2021-07-09 258 goto discard;
6e7e799136cd274 David Howells 2021-07-09 259
44acd768fad1357 David Howells 2022-01-14 260 ret = netfs_begin_read(rreq, true);
44acd768fad1357 David Howells 2022-01-14 @261 return ret < 0 ? ret : 0;
16211268fcb3667 David Howells 2022-03-01 262
16211268fcb3667 David Howells 2022-03-01 263 discard:
16211268fcb3667 David Howells 2022-03-01 264 netfs_put_request(rreq, false, netfs_rreq_trace_put_discard);
16211268fcb3667 David Howells 2022-03-01 265 alloc_error:
16211268fcb3667 David Howells 2022-03-01 266 folio_unlock(folio);
16211268fcb3667 David Howells 2022-03-01 267 return ret;
16211268fcb3667 David Howells 2022-03-01 268 }
6c62371b7fd7762 Matthew Wilcox (Oracle 2022-04-29 269) EXPORT_SYMBOL(netfs_read_folio);
16211268fcb3667 David Howells 2022-03-01 270
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-09 14:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-09 14:32 [ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 15/61] fs/netfs/buffered_read.c:261:12-13: WARNING opportunity for min() kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.