提交 2a8a3597 编写于 作者: A Al Viro

lustre: use file_inode()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 09561a53
...@@ -1025,8 +1025,8 @@ static int tracefiled(void *arg) ...@@ -1025,8 +1025,8 @@ static int tracefiled(void *arg)
if (f_pos >= (off_t)cfs_tracefile_size) if (f_pos >= (off_t)cfs_tracefile_size)
f_pos = 0; f_pos = 0;
else if (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(filp->f_dentry->d_inode); f_pos = i_size_read(file_inode(filp));
buf = kmap(tage->page); buf = kmap(tage->page);
rc = vfs_write(filp, (__force const char __user *)buf, rc = vfs_write(filp, (__force const char __user *)buf,
......
...@@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx) ...@@ -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) 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_file_data *lfd = LUSTRE_FPRIVATE(filp);
struct ll_sb_info *sbi = ll_i2sbi(inode); struct ll_sb_info *sbi = ll_i2sbi(inode);
int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
...@@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename) ...@@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename)
static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 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 ll_sb_info *sbi = ll_i2sbi(inode);
struct obd_ioctl_data *data; struct obd_ioctl_data *data;
int rc = 0; int rc = 0;
......
...@@ -489,7 +489,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, ...@@ -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, static int ll_local_open(struct file *file, struct lookup_intent *it,
struct ll_file_data *fd, struct obd_client_handle *och) 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); struct ll_inode_info *lli = ll_i2info(inode);
LASSERT(!LUSTRE_FPRIVATE(file)); LASSERT(!LUSTRE_FPRIVATE(file));
...@@ -1053,7 +1053,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, ...@@ -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) static bool file_is_noatime(const struct file *file)
{ {
const struct vfsmount *mnt = file->f_path.mnt; 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().*/ /* Adapted from file_accessed() and touch_atime().*/
if (file->f_flags & O_NOATIME) if (file->f_flags & O_NOATIME)
...@@ -1079,7 +1079,7 @@ static bool file_is_noatime(const struct file *file) ...@@ -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) 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; io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
if (write) { if (write) {
...@@ -1105,7 +1105,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, ...@@ -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, struct file *file, enum cl_io_type iot,
loff_t *ppos, size_t count) 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 ll_file_data *fd = LUSTRE_FPRIVATE(file);
struct cl_io *io; struct cl_io *io;
ssize_t result; ssize_t result;
...@@ -1175,11 +1175,11 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, ...@@ -1175,11 +1175,11 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
if (iot == CIT_READ) { if (iot == CIT_READ) {
if (result >= 0) 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); LPROC_LL_READ_BYTES, result);
} else if (iot == CIT_WRITE) { } else if (iot == CIT_WRITE) {
if (result >= 0) { 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); LPROC_LL_WRITE_BYTES, result);
fd->fd_write_failed = false; fd->fd_write_failed = false;
} else if (result != -ERESTARTSYS) { } else if (result != -ERESTARTSYS) {
...@@ -1950,8 +1950,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, ...@@ -1950,8 +1950,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
if (!llss) if (!llss)
return -ENOMEM; return -ENOMEM;
llss->inode1 = file1->f_dentry->d_inode; llss->inode1 = file_inode(file1);
llss->inode2 = file2->f_dentry->d_inode; llss->inode2 = file_inode(file2);
if (!S_ISREG(llss->inode2->i_mode)) { if (!S_ISREG(llss->inode2->i_mode)) {
rc = -EINVAL; rc = -EINVAL;
...@@ -2195,7 +2195,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file, ...@@ -2195,7 +2195,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
static long static long
ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 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); struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int flags, rc; int flags, rc;
...@@ -2514,7 +2514,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -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) 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; loff_t retval, eof = 0;
retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : 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) ...@@ -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) 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_inode_info *lli = ll_i2info(inode);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
int rc, err; int rc, err;
...@@ -2621,8 +2621,7 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, ...@@ -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) int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
{ {
struct dentry *dentry = file->f_dentry; struct inode *inode = file_inode(file);
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode); struct ll_inode_info *lli = ll_i2info(inode);
struct ptlrpc_request *req; struct ptlrpc_request *req;
struct obd_capa *oc; struct obd_capa *oc;
...@@ -2675,7 +2674,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) ...@@ -2675,7 +2674,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
static int static int
ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) 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 ll_sb_info *sbi = ll_i2sbi(inode);
struct ldlm_enqueue_info einfo = { struct ldlm_enqueue_info einfo = {
.ei_type = LDLM_FLOCK, .ei_type = LDLM_FLOCK,
......
...@@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, ...@@ -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) static inline int ll_file_nolock(const struct file *file)
{ {
struct ll_file_data *fd = LUSTRE_FPRIVATE(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); LASSERT(fd != NULL);
return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
......
...@@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, ...@@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,
unsigned long *ra_flags) unsigned long *ra_flags)
{ {
struct file *file = vma->vm_file; 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_io *io;
struct cl_fault_io *fio; struct cl_fault_io *fio;
struct lu_env *env; struct lu_env *env;
...@@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, ...@@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
cfs_restore_sigs(set); cfs_restore_sigs(set);
if (result == 0) { 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); struct ll_inode_info *lli = ll_i2info(inode);
lock_page(vmpage); lock_page(vmpage);
...@@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -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" CWARN("app(%s): the page %lu of file %lu is under heavy"
" contention.\n", " contention.\n",
current->comm, vmf->pgoff, current->comm, vmf->pgoff,
vma->vm_file->f_dentry->d_inode->i_ino); file_inode(vma->vm_file)->i_ino);
printed = true; printed = true;
} }
} while (retry); } while (retry);
...@@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -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) 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); struct ccc_object *vob = cl_inode2ccc(inode);
LASSERT(vma->vm_file); LASSERT(vma->vm_file);
...@@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma) ...@@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma)
*/ */
static void ll_vm_close(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); struct ccc_object *vob = cl_inode2ccc(inode);
LASSERT(vma->vm_file); LASSERT(vma->vm_file);
...@@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = { ...@@ -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) 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; int rc;
if (ll_file_nolock(file)) if (ll_file_nolock(file))
......
...@@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head) ...@@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
{ {
const struct lu_env *env = lo->lo_env; const struct lu_env *env = lo->lo_env;
struct cl_io *io = &lo->lo_io; 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; struct cl_object *obj = ll_i2info(inode)->lli_clob;
pgoff_t offset; pgoff_t offset;
int ret; int ret;
...@@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
break; break;
} }
if (inode == NULL) 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) if (lo->lo_state == LLOOP_BOUND)
fid = ll_i2info(inode)->lli_fid; fid = ll_i2info(inode)->lli_fid;
else else
...@@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file, ...@@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
lo_free = lo; lo_free = lo;
continue; continue;
} }
if (lo->lo_backing_file->f_dentry->d_inode == if (file_inode(lo->lo_backing_file) == file_inode(file))
file->f_dentry->d_inode)
break; break;
} }
if (lo || !lo_free) { if (lo || !lo_free) {
......
...@@ -108,7 +108,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, ...@@ -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); struct inode *inode = ccc_object_inode(ios->cis_obj);
LASSERT(inode == 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); vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime);
return 0; return 0;
} }
...@@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env, ...@@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env,
down_read(&mm->mmap_sem); down_read(&mm->mmap_sem);
while ((vma = our_vma(mm, addr, count)) != NULL) { 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; int flags = CEF_MUST;
if (ll_file_nolock(vma->vm_file)) { if (ll_file_nolock(vma->vm_file)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册