Skip to content

Commit e02cdc0

Browse files
committed
Merge patch series "netfs: Miscellaneous cleanups"
David Howells <[email protected]> says: Here are some miscellaneous very minor cleanups for netfslib for the next merge window, primarily from Max Kellermann, if you could pull them. (1) Remove NETFS_SREQ_SEEK_DATA_READ. (2) Remove NETFS_INVALID_WRITE. (3) Remove NETFS_ICTX_WRITETHROUGH. (4) Remove NETFS_READ_HOLE_CLEAR. (5) Reorder structs to eliminate holes. (6) Remove netfs_io_request::ractl. (7) Only provide proc_link field if CONFIG_PROC_FS=y. (8) Remove folio_queue::marks3. (9) Remove NETFS_RREQ_DONT_UNLOCK_FOLIOS. (10) Remove NETFS_RREQ_BLOCKED. * patches from https://lore.kernel.org/[email protected]: fs/netfs: remove unused flag NETFS_RREQ_BLOCKED fs/netfs: remove unused flag NETFS_RREQ_DONT_UNLOCK_FOLIOS folio_queue: remove unused field `marks3` fs/netfs: declare field `proc_link` only if CONFIG_PROC_FS=y fs/netfs: remove `netfs_io_request.ractl` fs/netfs: reorder struct fields to eliminate holes fs/netfs: remove unused enum choice NETFS_READ_HOLE_CLEAR fs/netfs: remove unused flag NETFS_ICTX_WRITETHROUGH fs/netfs: remove unused source NETFS_INVALID_WRITE fs/netfs: remove unused flag NETFS_SREQ_SEEK_DATA_READ Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
2 parents a1b4a25 + 4b1ca12 commit e02cdc0

File tree

12 files changed

+32
-102
lines changed

12 files changed

+32
-102
lines changed

Documentation/core-api/folio_queue.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,16 @@ The marks can be set by::
151151

152152
void folioq_mark(struct folio_queue *folioq, unsigned int slot);
153153
void folioq_mark2(struct folio_queue *folioq, unsigned int slot);
154-
void folioq_mark3(struct folio_queue *folioq, unsigned int slot);
155154

156155
Cleared by::
157156

158157
void folioq_unmark(struct folio_queue *folioq, unsigned int slot);
159158
void folioq_unmark2(struct folio_queue *folioq, unsigned int slot);
160-
void folioq_unmark3(struct folio_queue *folioq, unsigned int slot);
161159

162160
And the marks can be queried by::
163161

164162
bool folioq_is_marked(const struct folio_queue *folioq, unsigned int slot);
165163
bool folioq_is_marked2(const struct folio_queue *folioq, unsigned int slot);
166-
bool folioq_is_marked3(const struct folio_queue *folioq, unsigned int slot);
167164

168165
The marks can be used for any purpose and are not interpreted by this API.
169166

Documentation/filesystems/netfs_library.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,6 @@ handle falling back from one source type to another. The members are:
712712
at a boundary with the filesystem structure (e.g. at the end of a Ceph
713713
object). It tells netfslib not to retile subrequests across it.
714714

715-
* ``NETFS_SREQ_SEEK_DATA_READ``
716-
717-
This is a hint from netfslib to the cache that it might want to try
718-
skipping ahead to the next data (ie. using SEEK_DATA).
719-
720715
* ``error``
721716

722717
This is for the filesystem to store result of the subrequest. It should be

fs/netfs/buffered_read.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,16 @@ static int netfs_begin_cache_read(struct netfs_io_request *rreq, struct netfs_in
7878
* [!] NOTE: This must be run in the same thread as ->issue_read() was called
7979
* in as we access the readahead_control struct.
8080
*/
81-
static ssize_t netfs_prepare_read_iterator(struct netfs_io_subrequest *subreq)
81+
static ssize_t netfs_prepare_read_iterator(struct netfs_io_subrequest *subreq,
82+
struct readahead_control *ractl)
8283
{
8384
struct netfs_io_request *rreq = subreq->rreq;
8485
size_t rsize = subreq->len;
8586

8687
if (subreq->source == NETFS_DOWNLOAD_FROM_SERVER)
8788
rsize = umin(rsize, rreq->io_streams[0].sreq_max_len);
8889

89-
if (rreq->ractl) {
90+
if (ractl) {
9091
/* If we don't have sufficient folios in the rolling buffer,
9192
* extract a folioq's worth from the readahead region at a time
9293
* into the buffer. Note that this acquires a ref on each page
@@ -99,7 +100,7 @@ static ssize_t netfs_prepare_read_iterator(struct netfs_io_subrequest *subreq)
99100
while (rreq->submitted < subreq->start + rsize) {
100101
ssize_t added;
101102

102-
added = rolling_buffer_load_from_ra(&rreq->buffer, rreq->ractl,
103+
added = rolling_buffer_load_from_ra(&rreq->buffer, ractl,
103104
&put_batch);
104105
if (added < 0)
105106
return added;
@@ -211,7 +212,8 @@ static void netfs_issue_read(struct netfs_io_request *rreq,
211212
* slicing up the region to be read according to available cache blocks and
212213
* network rsize.
213214
*/
214-
static void netfs_read_to_pagecache(struct netfs_io_request *rreq)
215+
static void netfs_read_to_pagecache(struct netfs_io_request *rreq,
216+
struct readahead_control *ractl)
215217
{
216218
struct netfs_inode *ictx = netfs_inode(rreq->inode);
217219
unsigned long long start = rreq->start;
@@ -291,7 +293,7 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq)
291293
break;
292294

293295
issue:
294-
slice = netfs_prepare_read_iterator(subreq);
296+
slice = netfs_prepare_read_iterator(subreq, ractl);
295297
if (slice < 0) {
296298
ret = slice;
297299
subreq->error = ret;
@@ -359,11 +361,10 @@ void netfs_readahead(struct readahead_control *ractl)
359361

360362
netfs_rreq_expand(rreq, ractl);
361363

362-
rreq->ractl = ractl;
363364
rreq->submitted = rreq->start;
364365
if (rolling_buffer_init(&rreq->buffer, rreq->debug_id, ITER_DEST) < 0)
365366
goto cleanup_free;
366-
netfs_read_to_pagecache(rreq);
367+
netfs_read_to_pagecache(rreq, ractl);
367368

368369
netfs_put_request(rreq, true, netfs_rreq_trace_put_return);
369370
return;
@@ -389,7 +390,6 @@ static int netfs_create_singular_buffer(struct netfs_io_request *rreq, struct fo
389390
if (added < 0)
390391
return added;
391392
rreq->submitted = rreq->start + added;
392-
rreq->ractl = (struct readahead_control *)1UL;
393393
return 0;
394394
}
395395

@@ -459,7 +459,7 @@ static int netfs_read_gaps(struct file *file, struct folio *folio)
459459
iov_iter_bvec(&rreq->buffer.iter, ITER_DEST, bvec, i, rreq->len);
460460
rreq->submitted = rreq->start + flen;
461461

462-
netfs_read_to_pagecache(rreq);
462+
netfs_read_to_pagecache(rreq, NULL);
463463

464464
if (sink)
465465
folio_put(sink);
@@ -528,7 +528,7 @@ int netfs_read_folio(struct file *file, struct folio *folio)
528528
if (ret < 0)
529529
goto discard;
530530

531-
netfs_read_to_pagecache(rreq);
531+
netfs_read_to_pagecache(rreq, NULL);
532532
ret = netfs_wait_for_read(rreq);
533533
netfs_put_request(rreq, false, netfs_rreq_trace_put_return);
534534
return ret < 0 ? ret : 0;
@@ -685,7 +685,7 @@ int netfs_write_begin(struct netfs_inode *ctx,
685685
if (ret < 0)
686686
goto error_put;
687687

688-
netfs_read_to_pagecache(rreq);
688+
netfs_read_to_pagecache(rreq, NULL);
689689
ret = netfs_wait_for_read(rreq);
690690
if (ret < 0)
691691
goto error;
@@ -750,7 +750,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio,
750750
if (ret < 0)
751751
goto error_put;
752752

753-
netfs_read_to_pagecache(rreq);
753+
netfs_read_to_pagecache(rreq, NULL);
754754
ret = netfs_wait_for_read(rreq);
755755
netfs_put_request(rreq, false, netfs_rreq_trace_put_return);
756756
return ret < 0 ? ret : 0;

fs/netfs/buffered_write.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
115115
size_t max_chunk = mapping_max_folio_size(mapping);
116116
bool maybe_trouble = false;
117117

118-
if (unlikely(test_bit(NETFS_ICTX_WRITETHROUGH, &ctx->flags) ||
119-
iocb->ki_flags & (IOCB_DSYNC | IOCB_SYNC))
118+
if (unlikely(iocb->ki_flags & (IOCB_DSYNC | IOCB_SYNC))
120119
) {
121120
wbc_attach_fdatawrite_inode(&wbc, mapping->host);
122121

fs/netfs/direct_read.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ static int netfs_dispatch_unbuffered_reads(struct netfs_io_request *rreq)
106106
netfs_wait_for_pause(rreq);
107107
if (test_bit(NETFS_RREQ_FAILED, &rreq->flags))
108108
break;
109-
if (test_bit(NETFS_RREQ_BLOCKED, &rreq->flags) &&
110-
test_bit(NETFS_RREQ_NONBLOCK, &rreq->flags))
111-
break;
112109
cond_resched();
113110
} while (size > 0);
114111

fs/netfs/objects.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping,
6464
}
6565

6666
__set_bit(NETFS_RREQ_IN_PROGRESS, &rreq->flags);
67-
if (file && file->f_flags & O_NONBLOCK)
68-
__set_bit(NETFS_RREQ_NONBLOCK, &rreq->flags);
6967
if (rreq->netfs_ops->init_request) {
7068
ret = rreq->netfs_ops->init_request(rreq, file);
7169
if (ret < 0) {

fs/netfs/read_collect.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ static void netfs_unlock_read_folio(struct netfs_io_request *rreq,
8383
}
8484

8585
just_unlock:
86-
if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) {
87-
if (folio->index == rreq->no_unlock_folio &&
88-
test_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags)) {
89-
_debug("no unlock");
90-
} else {
91-
trace_netfs_folio(folio, netfs_folio_trace_read_unlock);
92-
folio_unlock(folio);
93-
}
86+
if (folio->index == rreq->no_unlock_folio &&
87+
test_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags)) {
88+
_debug("no unlock");
89+
} else {
90+
trace_netfs_folio(folio, netfs_folio_trace_read_unlock);
91+
folio_unlock(folio);
9492
}
9593

9694
folioq_clear(folioq, slot);

fs/netfs/write_collect.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,6 @@ void netfs_write_subrequest_terminated(void *_op, ssize_t transferred_or_error,
495495
case NETFS_WRITE_TO_CACHE:
496496
netfs_stat(&netfs_n_wh_write_done);
497497
break;
498-
case NETFS_INVALID_WRITE:
499-
break;
500498
default:
501499
BUG();
502500
}

include/linux/folio_queue.h

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ struct folio_queue {
3434
struct folio_queue *prev; /* Previous queue segment of NULL */
3535
unsigned long marks; /* 1-bit mark per folio */
3636
unsigned long marks2; /* Second 1-bit mark per folio */
37-
unsigned long marks3; /* Third 1-bit mark per folio */
3837
#if PAGEVEC_SIZE > BITS_PER_LONG
3938
#error marks is not big enough
4039
#endif
@@ -58,7 +57,6 @@ static inline void folioq_init(struct folio_queue *folioq, unsigned int rreq_id)
5857
folioq->prev = NULL;
5958
folioq->marks = 0;
6059
folioq->marks2 = 0;
61-
folioq->marks3 = 0;
6260
folioq->rreq_id = rreq_id;
6361
folioq->debug_id = 0;
6462
}
@@ -178,45 +176,6 @@ static inline void folioq_unmark2(struct folio_queue *folioq, unsigned int slot)
178176
clear_bit(slot, &folioq->marks2);
179177
}
180178

181-
/**
182-
* folioq_is_marked3: Check third folio mark in a folio queue segment
183-
* @folioq: The segment to query
184-
* @slot: The slot number of the folio to query
185-
*
186-
* Determine if the third mark is set for the folio in the specified slot in a
187-
* folio queue segment.
188-
*/
189-
static inline bool folioq_is_marked3(const struct folio_queue *folioq, unsigned int slot)
190-
{
191-
return test_bit(slot, &folioq->marks3);
192-
}
193-
194-
/**
195-
* folioq_mark3: Set the third mark on a folio in a folio queue segment
196-
* @folioq: The segment to modify
197-
* @slot: The slot number of the folio to modify
198-
*
199-
* Set the third mark for the folio in the specified slot in a folio queue
200-
* segment.
201-
*/
202-
static inline void folioq_mark3(struct folio_queue *folioq, unsigned int slot)
203-
{
204-
set_bit(slot, &folioq->marks3);
205-
}
206-
207-
/**
208-
* folioq_unmark3: Clear the third mark on a folio in a folio queue segment
209-
* @folioq: The segment to modify
210-
* @slot: The slot number of the folio to modify
211-
*
212-
* Clear the third mark for the folio in the specified slot in a folio queue
213-
* segment.
214-
*/
215-
static inline void folioq_unmark3(struct folio_queue *folioq, unsigned int slot)
216-
{
217-
clear_bit(slot, &folioq->marks3);
218-
}
219-
220179
/**
221180
* folioq_append: Add a folio to a folio queue segment
222181
* @folioq: The segment to add to
@@ -318,7 +277,6 @@ static inline void folioq_clear(struct folio_queue *folioq, unsigned int slot)
318277
folioq->vec.folios[slot] = NULL;
319278
folioq_unmark(folioq, slot);
320279
folioq_unmark2(folioq, slot);
321-
folioq_unmark3(folioq, slot);
322280
}
323281

324282
#endif /* _LINUX_FOLIO_QUEUE_H */

include/linux/fscache.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,6 @@ static inline void fscache_end_operation(struct netfs_cache_resources *cres)
498498
*
499499
* NETFS_READ_HOLE_IGNORE - Just try to read (may return a short read).
500500
*
501-
* NETFS_READ_HOLE_CLEAR - Seek for data, clearing the part of the buffer
502-
* skipped over, then do as for IGNORE.
503-
*
504501
* NETFS_READ_HOLE_FAIL - Give ENODATA if we encounter a hole.
505502
*/
506503
static inline

0 commit comments

Comments
 (0)