2.4: UFS lseek cleanup
PATCH 1/1 2.4: UFS lseek cleanup
Marcelo,
The following patch continues the 2.4 lseek cleanup by removing a redundant ufs_file_lseek implementation and having UFS use the standard generic_file_llseek.
Al (who signed off on this for 2.5) says the implementation assumed it needed explicit size checking, but the standard generic_file_llseek does this just fine. So it is redundant and a sane cleanup. The patch is already in -ac, but not in 2.4.19-pre3.
This is against 2.4.19-pre3, please apply.
Robert Love
fs/ufs/file.c +1 -32
@@ -37,43 +37,12 @@#include <linux/pagemap.h> /* -* Make sure the offset never goes beyond the 32-bit mark.. -*/ -static long long ufs_file_lseek ( -struct file *file, -long long offset, -int origin ) -{ -long long retval; -struct inode *inode = file->f_dentry->d_inode; - -switch (origin) { -case 2 : - offset += inode->i_size; -break ; -case 1 : - offset += file->f_pos; - } - retval = -EINVAL ; -/* make sure the offset fits in 32 bits */ -if (((unsigned long long ) offset >>32 ) ==0 ) { -if (offset != file->f_pos) { - file->f_pos = offset; - file->f_reada =0 ; - file->f_version = ++event; - } - retval = offset; - } -return retval; -} - -/* * We have mostly NULL's here: the current defaults are ok for * the ufs filesystem. */ struct file_operations ufs_file_operations = { - llseek: ufs_file_lseek, + llseek: generic_file_llseek, read: generic_file_read, write: generic_file_write, mmap: generic_file_mmap,