Skip to content

Commit 868941b

Browse files
zx2c4Al Viro
authored andcommitted
fs: remove no_llseek
Now that all callers of ->llseek are going through vfs_llseek(), we don't gain anything by keeping no_llseek around. Nothing actually calls it and setting ->llseek to no_lseek is completely equivalent to leaving it NULL. Longer term (== by the end of merge window) we want to remove all such intializations. To simplify the merge window this commit does *not* touch initializers - it only defines no_llseek as NULL (and simplifies the tests on file opening). At -rc1 we'll need do a mechanical removal of no_llseek - git grep -l -w no_llseek | grep -v porting.rst | while read i; do sed -i '/\<no_llseek\>/d' $i done would do it. Signed-off-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 97ef77c commit 868941b

File tree

7 files changed

+12
-14
lines changed

7 files changed

+12
-14
lines changed

Documentation/filesystems/porting.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,3 +914,11 @@ Calling conventions for file_open_root() changed; now it takes struct path *
914914
instead of passing mount and dentry separately. For callers that used to
915915
pass <mnt, mnt->mnt_root> pair (i.e. the root of given mount), a new helper
916916
is provided - file_open_root_mnt(). In-tree users adjusted.
917+
918+
---
919+
920+
**mandatory**
921+
922+
no_llseek is gone; don't set .llseek to that - just leave it NULL instead.
923+
Checks for "does that file have llseek(2), or should it fail with ESPIPE"
924+
should be done by looking at FMODE_LSEEK in file->f_mode.

drivers/gpu/drm/drm_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,7 @@ EXPORT_SYMBOL(drm_release_noglobal);
552552
* Since events are used by the KMS API for vblank and page flip completion this
553553
* means all modern display drivers must use it.
554554
*
555-
* @offset is ignored, DRM events are read like a pipe. Therefore drivers also
556-
* must set the &file_operation.llseek to no_llseek(). Polling support is
555+
* @offset is ignored, DRM events are read like a pipe. Polling support is
557556
* provided by drm_poll().
558557
*
559558
* This function will only ever read a full event. Therefore userspace must

fs/file_table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ static struct file *alloc_file(const struct path *path, int flags,
235235
file->f_mapping = path->dentry->d_inode->i_mapping;
236236
file->f_wb_err = filemap_sample_wb_err(file->f_mapping);
237237
file->f_sb_err = file_sample_sb_err(file);
238-
if (fop->llseek && fop->llseek != no_llseek)
238+
if (fop->llseek)
239239
file->f_mode |= FMODE_LSEEK;
240240
if ((file->f_mode & FMODE_READ) &&
241241
likely(fop->read || fop->read_iter))

fs/open.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,6 @@ static int do_dentry_open(struct file *f,
860860
f->f_mode |= FMODE_CAN_WRITE;
861861
if ((f->f_mode & FMODE_LSEEK) && !f->f_op->llseek)
862862
f->f_mode &= ~FMODE_LSEEK;
863-
if ((f->f_mode & FMODE_LSEEK) && f->f_op->llseek == no_llseek)
864-
f->f_mode &= ~FMODE_LSEEK;
865863
if (f->f_mapping->a_ops && f->f_mapping->a_ops->direct_IO)
866864
f->f_mode |= FMODE_CAN_ODIRECT;
867865

fs/read_write.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,6 @@ loff_t noop_llseek(struct file *file, loff_t offset, int whence)
227227
}
228228
EXPORT_SYMBOL(noop_llseek);
229229

230-
loff_t no_llseek(struct file *file, loff_t offset, int whence)
231-
{
232-
return -ESPIPE;
233-
}
234-
EXPORT_SYMBOL(no_llseek);
235-
236230
loff_t default_llseek(struct file *file, loff_t offset, int whence)
237231
{
238232
struct inode *inode = file_inode(file);

include/linux/fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
30223022
extern void
30233023
file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
30243024
extern loff_t noop_llseek(struct file *file, loff_t offset, int whence);
3025-
extern loff_t no_llseek(struct file *file, loff_t offset, int whence);
3025+
#define no_llseek NULL
30263026
extern loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize);
30273027
extern loff_t generic_file_llseek(struct file *file, loff_t offset, int whence);
30283028
extern loff_t generic_file_llseek_size(struct file *file, loff_t offset,

kernel/bpf/bpf_iter.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,9 @@ static bool bpf_iter_support_resched(struct seq_file *seq)
8181
#define MAX_ITER_OBJECTS 1000000
8282

8383
/* bpf_seq_read, a customized and simpler version for bpf iterator.
84-
* no_llseek is assumed for this file.
8584
* The following are differences from seq_read():
8685
* . fixed buffer size (PAGE_SIZE)
87-
* . assuming no_llseek
86+
* . assuming NULL ->llseek()
8887
* . stop() may call bpf program, handling potential overflow there
8988
*/
9089
static ssize_t bpf_seq_read(struct file *file, char __user *buf, size_t size,

0 commit comments

Comments
 (0)