[ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 55/55] fs/netfs/buffered_flush.c:219:7: error: use of undeclared identifier 'p'
From: kernel test robot
Date: Thu Jun 30 2022 - 11:22:05 EST
tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-linked-list
head: e0aed6defb4fe6c570e77e8fd8d899651b40366e
commit: e0aed6defb4fe6c570e77e8fd8d899651b40366e [55/55] netfs: Implement truncation
config: x86_64-randconfig-a001 (https://download.01.org/0day-ci/archive/20220630/202206302347.OXqFhZY3-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a774ba7f60d1fef403b5507b1b1a7475d3684d71)
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/e0aed6defb4fe6c570e77e8fd8d899651b40366e
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-linked-list
git checkout e0aed6defb4fe6c570e77e8fd8d899651b40366e
# save the config file
mkdir build_dir && cp config build_dir/.config
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 where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All error/warnings (new ones prefixed by >>):
>> fs/netfs/buffered_flush.c:219:7: error: use of undeclared identifier 'p'
if (p->first > r->first) {
^
>> fs/netfs/buffered_flush.c:219:18: error: use of undeclared identifier 'r'
if (p->first > r->first) {
^
fs/netfs/buffered_flush.c:220:8: error: use of undeclared identifier 'p'
if (p->last + 1 < r->first) {
^
fs/netfs/buffered_flush.c:220:22: error: use of undeclared identifier 'r'
if (p->last + 1 < r->first) {
^
>> fs/netfs/buffered_flush.c:168:8: error: use of undeclared label 'out'
goto out;
^
>> fs/netfs/buffered_flush.c:176:10: error: use of undeclared label 'splice'
goto splice;
^
6 errors generated.
--
>> fs/netfs/truncate.c:202:18: warning: variable 'to' is uninitialized when used here [-Wuninitialized]
} while (from < to);
^~
fs/netfs/truncate.c:149:18: note: initialize the variable 'to' to silence this warning
pgoff_t from, to, fto;
^
= 0
>> fs/netfs/truncate.c:170:6: warning: variable 'from' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (ret < 0)
^~~~~~~
fs/netfs/truncate.c:176:45: note: uninitialized use occurs here
folio = read_mapping_folio(treq->mapping, from, NULL);
^~~~
fs/netfs/truncate.c:170:2: note: remove the 'if' if its condition is always true
if (ret < 0)
^~~~~~~~~~~~
fs/netfs/truncate.c:149:14: note: initialize the variable 'from' to silence this warning
pgoff_t from, to, fto;
^
= 0
2 warnings generated.
vim +/p +219 fs/netfs/buffered_flush.c
103
104 /*
105 * The write failed to some extent. We need to work out which bits we managed
106 * to do - for instance, we might have managed to write stuff to the cache, but
107 * not upload to the server.
108 */
109 static void netfs_redirty_range(struct netfs_io_request *wreq)
110 {
111 struct netfs_io_subrequest *subreq;
112 struct netfs_io_chain *chain;
113 struct netfs_dirty_region *d, *d2, *w, *tmp;
114 struct netfs_inode *ctx = netfs_inode(wreq->inode);
115 unsigned long long from, to;
116 unsigned int c;
117 bool upload_failed = false;
118 LIST_HEAD(discards);
119
120 trace_netfs_rreq(wreq, netfs_rreq_trace_redirty);
121
122 if (list_empty(&wreq->regions))
123 return netfs_clean_dirty_range(wreq);
124
125 /* Ask the filesystem how it wants to handle things if an upload
126 * failed. It has two choices: redirty everything or leave everything
127 * clean.
128 */
129 for (c = 0; c < wreq->nr_chains; c++)
130 if (chain->source != NETFS_WRITE_TO_CACHE && chain->error)
131 upload_failed = true;
132
133 if (upload_failed &&
134 wreq->netfs_ops->redirty_on_failure &&
135 !wreq->netfs_ops->redirty_on_failure(wreq))
136 return netfs_clean_dirty_range(wreq);
137
138 /* First of all, we step through the list of regions that were to be
139 * written back and see if we can discard/shorten anything that got
140 * partially stored.
141 *
142 * Don't retry write failures to the cache. If the cache got a fatal
143 * error, it will have gone offline and retrying is pointless; if it
144 * ran out of space, it probably won't be able to supply us with space
145 * on the second attempt.
146 */
147 list_for_each_entry_safe(w, tmp, &wreq->regions, dirty_link) {
148 if (w->type == NETFS_COPY_TO_CACHE) {
149 list_del_init(&w->dirty_link);
150 netfs_put_dirty_region(ctx, w, netfs_region_trace_put_clear);
151 }
152 }
153
154 w = list_first_entry_or_null(&wreq->regions,
155 struct netfs_dirty_region, dirty_link);
156 if (!w)
157 return;
158
159 /* Step through the the uncompleted regions and reintegrate them into
160 * the dirty list.
161 */
162 spin_lock(&ctx->dirty_lock);
163
164 d = list_first_entry_or_null(&ctx->dirty_regions,
165 struct netfs_dirty_region, dirty_link);
166 if (!d) {
167 list_splice_tail_init(&wreq->regions, &ctx->dirty_regions);
> 168 goto out;
169 }
170
171 while (d && w) {
172 /* Dirty region before writeback region and not touching. */
173 if (d->last < w->first && d->last != w->first - 1) {
174 d = netfs_next_region(ctx, d);
175 if (!d)
> 176 goto splice;
177 continue;
178 }
179
180 /* Dirty region overlaps with writeback region. */
181 if (d->first <= w->last) {
182 if (d->last == w->first - 1 &&
183 !netfs_are_regions_mergeable(ctx, d, d2)) {
184 d = netfs_next_region(ctx, d);
185 if (!d)
186 goto splice;
187 continue;
188 }
189
190 d->first = min(d->first, w->first);
191 d->last = max(d->last, w->last);
192 d->from = min(d->from, w->from);
193 d->to = max(d->to, w->to);
194 trace_netfs_dirty(ctx, d, w, netfs_dirty_trace_redirty_merge);
195
196 d2 = netfs_next_region(ctx, d);
197 if (d2 && d->last >= d2->first - 1 &&
198 netfs_are_regions_mergeable(ctx, d, d2)) {
199 d->last = d2->last;
200 d->to = d2->to;
201 list_move(&d2->dirty_link, &discards);
202 trace_netfs_dirty(ctx, d, d2, netfs_dirty_trace_bridged);
203 }
204
205 w = netfs_rreq_next_region(wreq, w);
206 continue;
207 }
208
209 /* Dirty region after writeback region and touching. */
210 if (d->first == w->last - 1 &&
211 !netfs_are_regions_mergeable(ctx, d, d2)) {
212 d->first = min(d->first, w->first);
213 d->from = min(d->from, w->from);
214 trace_netfs_dirty(ctx, d, w, netfs_dirty_trace_redirty_merge);
215 w = netfs_rreq_next_region(wreq, w);
216 continue;
217 }
218
> 219 if (p->first > r->first) {
220 if (p->last + 1 < r->first) {
221
222 }
223 } else {
224 }
225 }
226
227 spin_unlock(&ctx->dirty_lock);
228
229 BUG();
230 }
231
--
0-DAY CI Kernel Test Service
https://01.org/lkp