1
0
Fork 0

lustre: use file_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
hifive-unleashed-5.1
Al Viro 2014-10-20 18:02:33 -04:00
parent 09561a53b5
commit 2a8a3597aa
7 changed files with 29 additions and 31 deletions

View File

@ -1025,8 +1025,8 @@ static int tracefiled(void *arg)
if (f_pos >= (off_t)cfs_tracefile_size)
f_pos = 0;
else if (f_pos > i_size_read(filp->f_dentry->d_inode))
f_pos = i_size_read(filp->f_dentry->d_inode);
else if (f_pos > i_size_read(file_inode(filp)))
f_pos = i_size_read(file_inode(filp));
buf = kmap(tage->page);
rc = vfs_write(filp, (__force const char __user *)buf,

View File

@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx)
static int ll_readdir(struct file *filp, struct dir_context *ctx)
{
struct inode *inode = filp->f_dentry->d_inode;
struct inode *inode = file_inode(filp);
struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
struct ll_sb_info *sbi = ll_i2sbi(inode);
int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename)
static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct obd_ioctl_data *data;
int rc = 0;

View File

@ -489,7 +489,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
static int ll_local_open(struct file *file, struct lookup_intent *it,
struct ll_file_data *fd, struct obd_client_handle *och)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_inode_info *lli = ll_i2info(inode);
LASSERT(!LUSTRE_FPRIVATE(file));
@ -1053,7 +1053,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
static bool file_is_noatime(const struct file *file)
{
const struct vfsmount *mnt = file->f_path.mnt;
const struct inode *inode = file->f_path.dentry->d_inode;
const struct inode *inode = file_inode(file);
/* Adapted from file_accessed() and touch_atime().*/
if (file->f_flags & O_NOATIME)
@ -1079,7 +1079,7 @@ static bool file_is_noatime(const struct file *file)
void ll_io_init(struct cl_io *io, const struct file *file, int write)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
if (write) {
@ -1105,7 +1105,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
struct file *file, enum cl_io_type iot,
loff_t *ppos, size_t count)
{
struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode);
struct ll_inode_info *lli = ll_i2info(file_inode(file));
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
struct cl_io *io;
ssize_t result;
@ -1175,11 +1175,11 @@ out:
if (iot == CIT_READ) {
if (result >= 0)
ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
ll_stats_ops_tally(ll_i2sbi(file_inode(file)),
LPROC_LL_READ_BYTES, result);
} else if (iot == CIT_WRITE) {
if (result >= 0) {
ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode),
ll_stats_ops_tally(ll_i2sbi(file_inode(file)),
LPROC_LL_WRITE_BYTES, result);
fd->fd_write_failed = false;
} else if (result != -ERESTARTSYS) {
@ -1950,8 +1950,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
if (!llss)
return -ENOMEM;
llss->inode1 = file1->f_dentry->d_inode;
llss->inode2 = file2->f_dentry->d_inode;
llss->inode1 = file_inode(file1);
llss->inode2 = file_inode(file2);
if (!S_ISREG(llss->inode2->i_mode)) {
rc = -EINVAL;
@ -2195,7 +2195,7 @@ out:
static long
ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int flags, rc;
@ -2514,7 +2514,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
loff_t retval, eof = 0;
retval = offset + ((origin == SEEK_END) ? i_size_read(inode) :
@ -2538,7 +2538,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
static int ll_flush(struct file *file, fl_owner_t id)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int rc, err;
@ -2621,8 +2621,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_inode_info *lli = ll_i2info(inode);
struct ptlrpc_request *req;
struct obd_capa *oc;
@ -2675,7 +2674,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
static int
ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ldlm_enqueue_info einfo = {
.ei_type = LDLM_FLOCK,

View File

@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io,
static inline int ll_file_nolock(const struct file *file)
{
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
LASSERT(fd != NULL);
return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||

View File

@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,
unsigned long *ra_flags)
{
struct file *file = vma->vm_file;
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
struct cl_io *io;
struct cl_fault_io *fio;
struct lu_env *env;
@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
cfs_restore_sigs(set);
if (result == 0) {
struct inode *inode = vma->vm_file->f_dentry->d_inode;
struct inode *inode = file_inode(vma->vm_file);
struct ll_inode_info *lli = ll_i2info(inode);
lock_page(vmpage);
@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
CWARN("app(%s): the page %lu of file %lu is under heavy"
" contention.\n",
current->comm, vmf->pgoff,
vma->vm_file->f_dentry->d_inode->i_ino);
file_inode(vma->vm_file)->i_ino);
printed = true;
}
} while (retry);
@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
*/
static void ll_vm_open(struct vm_area_struct *vma)
{
struct inode *inode = vma->vm_file->f_dentry->d_inode;
struct inode *inode = file_inode(vma->vm_file);
struct ccc_object *vob = cl_inode2ccc(inode);
LASSERT(vma->vm_file);
@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma)
*/
static void ll_vm_close(struct vm_area_struct *vma)
{
struct inode *inode = vma->vm_file->f_dentry->d_inode;
struct inode *inode = file_inode(vma->vm_file);
struct ccc_object *vob = cl_inode2ccc(inode);
LASSERT(vma->vm_file);
@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = {
int ll_file_mmap(struct file *file, struct vm_area_struct *vma)
{
struct inode *inode = file->f_dentry->d_inode;
struct inode *inode = file_inode(file);
int rc;
if (ll_file_nolock(file))

View File

@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
{
const struct lu_env *env = lo->lo_env;
struct cl_io *io = &lo->lo_io;
struct inode *inode = lo->lo_backing_file->f_dentry->d_inode;
struct inode *inode = file_inode(lo->lo_backing_file);
struct cl_object *obj = ll_i2info(inode)->lli_clob;
pgoff_t offset;
int ret;
@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
break;
}
if (inode == NULL)
inode = lo->lo_backing_file->f_dentry->d_inode;
inode = file_inode(lo->lo_backing_file);
if (lo->lo_state == LLOOP_BOUND)
fid = ll_i2info(inode)->lli_fid;
else
@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
lo_free = lo;
continue;
}
if (lo->lo_backing_file->f_dentry->d_inode ==
file->f_dentry->d_inode)
if (file_inode(lo->lo_backing_file) == file_inode(file))
break;
}
if (lo || !lo_free) {

View File

@ -108,7 +108,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env,
struct inode *inode = ccc_object_inode(ios->cis_obj);
LASSERT(inode ==
cl2ccc_io(env, ios)->cui_fd->fd_file->f_dentry->d_inode);
file_inode(cl2ccc_io(env, ios)->cui_fd->fd_file));
vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime);
return 0;
}
@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env,
down_read(&mm->mmap_sem);
while ((vma = our_vma(mm, addr, count)) != NULL) {
struct inode *inode = vma->vm_file->f_dentry->d_inode;
struct inode *inode = file_inode(vma->vm_file);
int flags = CEF_MUST;
if (ll_file_nolock(vma->vm_file)) {