[ammarfaizi2-block:dhowells/linux-fs/netfs-maple 28/40] fs/netfs/direct_read.c:194:22: warning: mixing declarations and code is incompatible with standards before C99

From: kernel test robot
Date: Tue Apr 05 2022 - 00:48:57 EST


tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-maple
head: 674eea41fc70a740ff83ec590f9833f805852464
commit: 86ffcdd2a1cb7c858063208fdfb7abe941bc0b9e [28/40] netfs: Support decryption on DIO read
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220405/202204051244.41Wy7KP6-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
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/ammarfaizi2/linux-block/commit/86ffcdd2a1cb7c858063208fdfb7abe941bc0b9e
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-maple
git checkout 86ffcdd2a1cb7c858063208fdfb7abe941bc0b9e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/netfs/

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

All warnings (new ones prefixed by >>):

fs/netfs/direct_read.c:193:3: error: expected expression
unsigned int min_bsize = 1ULL << ctx->min_bshift;
^
fs/netfs/direct_read.c:194:54: error: use of undeclared identifier 'min_bsize'
unsigned long long start = round_down(rreq->start, min_bsize);
^
fs/netfs/direct_read.c:196:47: error: use of undeclared identifier 'min_bsize'
round_up(rreq->start + rreq->len, min_bsize),
^
fs/netfs/direct_read.c:196:47: error: use of undeclared identifier 'min_bsize'
>> fs/netfs/direct_read.c:194:22: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
unsigned long long start = round_down(rreq->start, min_bsize);
^
1 warning and 4 errors generated.


vim +194 fs/netfs/direct_read.c

111
112 /**
113 * netfs_direct_read_iter - Perform a direct I/O read
114 * @iocb: The I/O control descriptor describing the read
115 * @iter: The output buffer (also specifies read length)
116 */
117 ssize_t netfs_direct_read_iter(struct kiocb *iocb, struct iov_iter *iter)
118 {
119 struct netfs_io_request *rreq;
120 struct netfs_i_context *ctx;
121 ssize_t n, ret;
122
123 _enter("");
124
125 rreq = netfs_alloc_request(iocb->ki_filp->f_mapping, iocb->ki_filp,
126 iocb->ki_pos, iov_iter_count(iter),
127 NETFS_DIO_READ);
128 if (IS_ERR(rreq))
129 return PTR_ERR(rreq);
130
131 ctx = netfs_i_context(rreq->inode);
132 netfs_stat(&netfs_n_rh_dio_read);
133 trace_netfs_read(rreq, rreq->start, rreq->len, netfs_read_trace_dio_read);
134
135 rreq->buffering = NETFS_DIRECT;
136 if (test_bit(NETFS_RREQ_CONTENT_ENCRYPTION, &rreq->flags)) {
137 static const enum netfs_buffering buffering[2][2] = {
138 /* [async][aligned] */
139 [false][false] = NETFS_BOUNCE_DEC_COPY,
140 [false][true] = NETFS_BOUNCE_DEC_TO_DIRECT,
141 [true ][false] = NETFS_BOUNCE_DEC_COPY_BV,
142 [true ][true] = NETFS_BOUNCE_DEC_TO_DIRECT_BV,
143 };
144 bool aligned = netfs_is_crypto_aligned(rreq, iter);
145 bool async = !is_sync_kiocb(iocb);
146
147 rreq->buffering = buffering[async][aligned];
148 }
149
150 kdebug("remote_i %llx %llx %llx",
151 ctx->remote_i_size, rreq->i_size, i_size_read(netfs_inode(ctx)));
152
153 /* If this is an async op, we have to keep track of the destination
154 * buffer for ourselves as the caller's iterator will be trashed when
155 * we return.
156 *
157 * In such a case, extract an iterator to represent as much of the the
158 * output buffer as we can manage. Note that the extraction might not
159 * be able to allocate a sufficiently large bvec array and may shorten
160 * the request.
161 */
162 switch (rreq->buffering) {
163 case NETFS_DIRECT:
164 case NETFS_BOUNCE_DEC_TO_DIRECT:
165 case NETFS_BOUNCE_DEC_COPY:
166 rreq->direct_iter = *iter;
167 rreq->len = iov_iter_count(&rreq->direct_iter);
168 break;
169 case NETFS_DIRECT_BV:
170 case NETFS_BOUNCE_DEC_TO_DIRECT_BV:
171 case NETFS_BOUNCE_DEC_COPY_BV:
172 n = extract_iter_to_iter(iter, rreq->len, &rreq->direct_iter,
173 &rreq->direct_bv);
174 if (n < 0) {
175 ret = n;
176 goto out;
177 }
178 rreq->direct_bv_count = n;
179 rreq->len = iov_iter_count(&rreq->direct_iter);
180 break;
181 default:
182 BUG();
183 }
184
185 /* If we're going to use a bounce buffer, we need to set it up. We
186 * will then need to pad the request out to the minimum block size.
187 */
188 switch (rreq->buffering) {
189 case NETFS_BOUNCE_DEC_TO_DIRECT:
190 case NETFS_BOUNCE_DEC_COPY:
191 case NETFS_BOUNCE_DEC_TO_DIRECT_BV:
192 case NETFS_BOUNCE_DEC_COPY_BV:
193 unsigned int min_bsize = 1ULL << ctx->min_bshift;
> 194 unsigned long long start = round_down(rreq->start, min_bsize);

--
0-DAY CI Kernel Test Service
https://01.org/lkp