aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/drbd/drbd_debugfs.c6
-rw-r--r--drivers/gpu/drm/armada/armada_gem.c2
-rw-r--r--drivers/media/pci/zoran/zoran_procfs.c4
-rw-r--r--drivers/misc/genwqe/card_dev.c2
-rw-r--r--drivers/net/tun.c4
-rw-r--r--drivers/s390/char/hmcdrv_dev.c16
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c8
-rw-r--r--drivers/staging/lustre/lustre/libcfs/tracefile.c4
-rw-r--r--drivers/staging/lustre/lustre/llite/dcache.c21
-rw-r--r--drivers/staging/lustre/lustre/llite/dir.c9
-rw-r--r--drivers/staging/lustre/lustre/llite/file.c158
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_internal.h10
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_lib.c8
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_mmap.c12
-rw-r--r--drivers/staging/lustre/lustre/llite/llite_nfs.c8
-rw-r--r--drivers/staging/lustre/lustre/llite/lloop.c7
-rw-r--r--drivers/staging/lustre/lustre/llite/namei.c388
-rw-r--r--drivers/staging/lustre/lustre/llite/statahead.c33
-rw-r--r--drivers/staging/lustre/lustre/llite/vvp_io.c4
-rw-r--r--drivers/staging/lustre/lustre/llite/xattr.c9
20 files changed, 298 insertions, 415 deletions
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c
index 900d4d3272d1..9a950022ff88 100644
--- a/drivers/block/drbd/drbd_debugfs.c
+++ b/drivers/block/drbd/drbd_debugfs.c
@@ -419,7 +419,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
419 return 0; 419 return 0;
420} 420}
421 421
422/* simple_positive(file->f_dentry) respectively debugfs_positive(), 422/* simple_positive(file->f_path.dentry) respectively debugfs_positive(),
423 * but neither is "reachable" from here. 423 * but neither is "reachable" from here.
424 * So we have our own inline version of it above. :-( */ 424 * So we have our own inline version of it above. :-( */
425static inline int debugfs_positive(struct dentry *dentry) 425static inline int debugfs_positive(struct dentry *dentry)
@@ -437,14 +437,14 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo
437 437
438 /* Are we still linked, 438 /* Are we still linked,
439 * or has debugfs_remove() already been called? */ 439 * or has debugfs_remove() already been called? */
440 parent = file->f_dentry->d_parent; 440 parent = file->f_path.dentry->d_parent;
441 /* not sure if this can happen: */ 441 /* not sure if this can happen: */
442 if (!parent || !parent->d_inode) 442 if (!parent || !parent->d_inode)
443 goto out; 443 goto out;
444 /* serialize with d_delete() */ 444 /* serialize with d_delete() */
445 mutex_lock(&parent->d_inode->i_mutex); 445 mutex_lock(&parent->d_inode->i_mutex);
446 /* Make sure the object is still alive */ 446 /* Make sure the object is still alive */
447 if (debugfs_positive(file->f_dentry) 447 if (debugfs_positive(file->f_path.dentry)
448 && kref_get_unless_zero(kref)) 448 && kref_get_unless_zero(kref))
449 ret = 0; 449 ret = 0;
450 mutex_unlock(&parent->d_inode->i_mutex); 450 mutex_unlock(&parent->d_inode->i_mutex);
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index 7496f55611a5..ef5feeecec84 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -226,7 +226,7 @@ struct armada_gem_object *armada_gem_alloc_object(struct drm_device *dev,
226 226
227 obj->dev_addr = DMA_ERROR_CODE; 227 obj->dev_addr = DMA_ERROR_CODE;
228 228
229 mapping = obj->obj.filp->f_path.dentry->d_inode->i_mapping; 229 mapping = file_inode(obj->obj.filp)->i_mapping;
230 mapping_set_gfp_mask(mapping, GFP_HIGHUSER | __GFP_RECLAIMABLE); 230 mapping_set_gfp_mask(mapping, GFP_HIGHUSER | __GFP_RECLAIMABLE);
231 231
232 DRM_DEBUG_DRIVER("alloc obj %p size %zu\n", obj, size); 232 DRM_DEBUG_DRIVER("alloc obj %p size %zu\n", obj, size);
diff --git a/drivers/media/pci/zoran/zoran_procfs.c b/drivers/media/pci/zoran/zoran_procfs.c
index f7ceee0cdefd..437652761093 100644
--- a/drivers/media/pci/zoran/zoran_procfs.c
+++ b/drivers/media/pci/zoran/zoran_procfs.c
@@ -157,8 +157,8 @@ static ssize_t zoran_write(struct file *file, const char __user *buffer,
157 return -EFAULT; 157 return -EFAULT;
158 } 158 }
159 string[count] = 0; 159 string[count] = 0;
160 dprintk(4, KERN_INFO "%s: write_proc: name=%s count=%zu zr=%p\n", 160 dprintk(4, KERN_INFO "%s: write_proc: name=%pD count=%zu zr=%p\n",
161 ZR_DEVNAME(zr), file->f_path.dentry->d_name.name, count, zr); 161 ZR_DEVNAME(zr), file, count, zr);
162 ldelim = " \t\n"; 162 ldelim = " \t\n";
163 tdelim = "="; 163 tdelim = "=";
164 line = strpbrk(sp, ldelim); 164 line = strpbrk(sp, ldelim);
diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c
index 5918586f2f76..c49d244265ec 100644
--- a/drivers/misc/genwqe/card_dev.c
+++ b/drivers/misc/genwqe/card_dev.c
@@ -395,7 +395,7 @@ static void genwqe_vma_open(struct vm_area_struct *vma)
395static void genwqe_vma_close(struct vm_area_struct *vma) 395static void genwqe_vma_close(struct vm_area_struct *vma)
396{ 396{
397 unsigned long vsize = vma->vm_end - vma->vm_start; 397 unsigned long vsize = vma->vm_end - vma->vm_start;
398 struct inode *inode = vma->vm_file->f_dentry->d_inode; 398 struct inode *inode = file_inode(vma->vm_file);
399 struct dma_mapping *dma_map; 399 struct dma_mapping *dma_map;
400 struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev, 400 struct genwqe_dev *cd = container_of(inode->i_cdev, struct genwqe_dev,
401 cdev_genwqe); 401 cdev_genwqe);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 9dd3746994a4..4d332dc93b70 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2222,7 +2222,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
2222} 2222}
2223 2223
2224#ifdef CONFIG_PROC_FS 2224#ifdef CONFIG_PROC_FS
2225static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f) 2225static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f)
2226{ 2226{
2227 struct tun_struct *tun; 2227 struct tun_struct *tun;
2228 struct ifreq ifr; 2228 struct ifreq ifr;
@@ -2238,7 +2238,7 @@ static int tun_chr_show_fdinfo(struct seq_file *m, struct file *f)
2238 if (tun) 2238 if (tun)
2239 tun_put(tun); 2239 tun_put(tun);
2240 2240
2241 return seq_printf(m, "iff:\t%s\n", ifr.ifr_name); 2241 seq_printf(m, "iff:\t%s\n", ifr.ifr_name);
2242} 2242}
2243#endif 2243#endif
2244 2244
diff --git a/drivers/s390/char/hmcdrv_dev.c b/drivers/s390/char/hmcdrv_dev.c
index 0c5176179c17..43cee7fcd01c 100644
--- a/drivers/s390/char/hmcdrv_dev.c
+++ b/drivers/s390/char/hmcdrv_dev.c
@@ -136,8 +136,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp)
136 if (rc) 136 if (rc)
137 module_put(THIS_MODULE); 137 module_put(THIS_MODULE);
138 138
139 pr_debug("open file '/dev/%s' with return code %d\n", 139 pr_debug("open file '/dev/%pD' with return code %d\n", fp, rc);
140 fp->f_dentry->d_name.name, rc);
141 return rc; 140 return rc;
142} 141}
143 142
@@ -146,7 +145,7 @@ static int hmcdrv_dev_open(struct inode *inode, struct file *fp)
146 */ 145 */
147static int hmcdrv_dev_release(struct inode *inode, struct file *fp) 146static int hmcdrv_dev_release(struct inode *inode, struct file *fp)
148{ 147{
149 pr_debug("closing file '/dev/%s'\n", fp->f_dentry->d_name.name); 148 pr_debug("closing file '/dev/%pD'\n", fp);
150 kfree(fp->private_data); 149 kfree(fp->private_data);
151 fp->private_data = NULL; 150 fp->private_data = NULL;
152 hmcdrv_ftp_shutdown(); 151 hmcdrv_ftp_shutdown();
@@ -231,8 +230,8 @@ static ssize_t hmcdrv_dev_read(struct file *fp, char __user *ubuf,
231 retlen = hmcdrv_dev_transfer((char *) fp->private_data, 230 retlen = hmcdrv_dev_transfer((char *) fp->private_data,
232 *pos, ubuf, len); 231 *pos, ubuf, len);
233 232
234 pr_debug("read from file '/dev/%s' at %lld returns %zd/%zu\n", 233 pr_debug("read from file '/dev/%pD' at %lld returns %zd/%zu\n",
235 fp->f_dentry->d_name.name, (long long) *pos, retlen, len); 234 fp, (long long) *pos, retlen, len);
236 235
237 if (retlen > 0) 236 if (retlen > 0)
238 *pos += retlen; 237 *pos += retlen;
@@ -248,8 +247,8 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf,
248{ 247{
249 ssize_t retlen; 248 ssize_t retlen;
250 249
251 pr_debug("writing file '/dev/%s' at pos. %lld with length %zd\n", 250 pr_debug("writing file '/dev/%pD' at pos. %lld with length %zd\n",
252 fp->f_dentry->d_name.name, (long long) *pos, len); 251 fp, (long long) *pos, len);
253 252
254 if (!fp->private_data) { /* first expect a cmd write */ 253 if (!fp->private_data) { /* first expect a cmd write */
255 fp->private_data = kmalloc(len + 1, GFP_KERNEL); 254 fp->private_data = kmalloc(len + 1, GFP_KERNEL);
@@ -272,8 +271,7 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf,
272 if (retlen > 0) 271 if (retlen > 0)
273 *pos += retlen; 272 *pos += retlen;
274 273
275 pr_debug("write to file '/dev/%s' returned %zd\n", 274 pr_debug("write to file '/dev/%pD' returned %zd\n", fp, retlen);
276 fp->f_dentry->d_name.name, retlen);
277 275
278 return retlen; 276 return retlen;
279} 277}
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 786a2aff7b59..5633e7dadc08 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -968,8 +968,8 @@ lpfc_debugfs_dumpDif_open(struct inode *inode, struct file *file)
968 goto out; 968 goto out;
969 969
970 /* Round to page boundary */ 970 /* Round to page boundary */
971 printk(KERN_ERR "9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%s\n", 971 printk(KERN_ERR "9060 BLKGRD: %s: _dump_buf_dif=0x%p file=%pD\n",
972 __func__, _dump_buf_dif, file->f_dentry->d_name.name); 972 __func__, _dump_buf_dif, file);
973 debug->buffer = _dump_buf_dif; 973 debug->buffer = _dump_buf_dif;
974 if (!debug->buffer) { 974 if (!debug->buffer) {
975 kfree(debug); 975 kfree(debug);
@@ -1011,7 +1011,7 @@ static ssize_t
1011lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, 1011lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
1012 size_t nbytes, loff_t *ppos) 1012 size_t nbytes, loff_t *ppos)
1013{ 1013{
1014 struct dentry *dent = file->f_dentry; 1014 struct dentry *dent = file->f_path.dentry;
1015 struct lpfc_hba *phba = file->private_data; 1015 struct lpfc_hba *phba = file->private_data;
1016 char cbuf[32]; 1016 char cbuf[32];
1017 uint64_t tmp = 0; 1017 uint64_t tmp = 0;
@@ -1052,7 +1052,7 @@ static ssize_t
1052lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, 1052lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1053 size_t nbytes, loff_t *ppos) 1053 size_t nbytes, loff_t *ppos)
1054{ 1054{
1055 struct dentry *dent = file->f_dentry; 1055 struct dentry *dent = file->f_path.dentry;
1056 struct lpfc_hba *phba = file->private_data; 1056 struct lpfc_hba *phba = file->private_data;
1057 char dstbuf[32]; 1057 char dstbuf[32];
1058 uint64_t tmp = 0; 1058 uint64_t tmp = 0;
diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c
index 7e3f6a45da00..7561030c96e6 100644
--- a/drivers/staging/lustre/lustre/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c
@@ -1025,8 +1025,8 @@ static int tracefiled(void *arg)
1025 1025
1026 if (f_pos >= (off_t)cfs_tracefile_size) 1026 if (f_pos >= (off_t)cfs_tracefile_size)
1027 f_pos = 0; 1027 f_pos = 0;
1028 else if (f_pos > i_size_read(filp->f_dentry->d_inode)) 1028 else if (f_pos > i_size_read(file_inode(filp)))
1029 f_pos = i_size_read(filp->f_dentry->d_inode); 1029 f_pos = i_size_read(file_inode(filp));
1030 1030
1031 buf = kmap(tage->page); 1031 buf = kmap(tage->page);
1032 rc = vfs_write(filp, (__force const char __user *)buf, 1032 rc = vfs_write(filp, (__force const char __user *)buf,
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c
index 439e4875b05c..f692261e9b5c 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -151,10 +151,10 @@ static int ll_ddelete(const struct dentry *de)
151{ 151{
152 LASSERT(de); 152 LASSERT(de);
153 153
154 CDEBUG(D_DENTRY, "%s dentry %.*s (%p, parent %p, inode %p) %s%s\n", 154 CDEBUG(D_DENTRY, "%s dentry %pd (%p, parent %p, inode %p) %s%s\n",
155 d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping", 155 d_lustre_invalid((struct dentry *)de) ? "deleting" : "keeping",
156 de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, 156 de, de, de->d_parent, de->d_inode,
157 d_unhashed((struct dentry *)de) ? "" : "hashed,", 157 d_unhashed(de) ? "" : "hashed,",
158 list_empty(&de->d_subdirs) ? "" : "subdirs"); 158 list_empty(&de->d_subdirs) ? "" : "subdirs");
159 159
160 /* kernel >= 2.6.38 last refcount is decreased after this function. */ 160 /* kernel >= 2.6.38 last refcount is decreased after this function. */
@@ -180,8 +180,8 @@ int ll_d_init(struct dentry *de)
180{ 180{
181 LASSERT(de != NULL); 181 LASSERT(de != NULL);
182 182
183 CDEBUG(D_DENTRY, "ldd on dentry %.*s (%p) parent %p inode %p refc %d\n", 183 CDEBUG(D_DENTRY, "ldd on dentry %pd (%p) parent %p inode %p refc %d\n",
184 de->d_name.len, de->d_name.name, de, de->d_parent, de->d_inode, 184 de, de, de->d_parent, de->d_inode,
185 d_count(de)); 185 d_count(de));
186 186
187 if (de->d_fsdata == NULL) { 187 if (de->d_fsdata == NULL) {
@@ -258,10 +258,9 @@ void ll_invalidate_aliases(struct inode *inode)
258 inode->i_ino, inode->i_generation, inode); 258 inode->i_ino, inode->i_generation, inode);
259 259
260 ll_lock_dcache(inode); 260 ll_lock_dcache(inode);
261 ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_alias) { 261 ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) {
262 CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " 262 CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p "
263 "inode %p flags %d\n", dentry->d_name.len, 263 "inode %p flags %d\n", dentry, dentry, dentry->d_parent,
264 dentry->d_name.name, dentry, dentry->d_parent,
265 dentry->d_inode, dentry->d_flags); 264 dentry->d_inode, dentry->d_flags);
266 265
267 if (unlikely(dentry == dentry->d_sb->s_root)) { 266 if (unlikely(dentry == dentry->d_sb->s_root)) {
@@ -352,8 +351,8 @@ static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags)
352{ 351{
353 int rc; 352 int rc;
354 353
355 CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", 354 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, flags=%u\n",
356 dentry->d_name.name, flags); 355 dentry, flags);
357 356
358 rc = ll_revalidate_dentry(dentry, flags); 357 rc = ll_revalidate_dentry(dentry, flags);
359 return rc; 358 return rc;
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index b0bb7095dde5..a79fd65ec4c6 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -593,7 +593,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx)
593 593
594static int ll_readdir(struct file *filp, struct dir_context *ctx) 594static int ll_readdir(struct file *filp, struct dir_context *ctx)
595{ 595{
596 struct inode *inode = filp->f_dentry->d_inode; 596 struct inode *inode = file_inode(filp);
597 struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); 597 struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
598 struct ll_sb_info *sbi = ll_i2sbi(inode); 598 struct ll_sb_info *sbi = ll_i2sbi(inode);
599 int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; 599 int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
@@ -1242,7 +1242,7 @@ ll_getname(const char __user *filename)
1242 1242
1243static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1243static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1244{ 1244{
1245 struct inode *inode = file->f_dentry->d_inode; 1245 struct inode *inode = file_inode(file);
1246 struct ll_sb_info *sbi = ll_i2sbi(inode); 1246 struct ll_sb_info *sbi = ll_i2sbi(inode);
1247 struct obd_ioctl_data *data; 1247 struct obd_ioctl_data *data;
1248 int rc = 0; 1248 int rc = 0;
@@ -1389,7 +1389,7 @@ lmv_out_free:
1389 return -EFAULT; 1389 return -EFAULT;
1390 } 1390 }
1391 1391
1392 if (inode->i_sb->s_root == file->f_dentry) 1392 if (is_root_inode(inode))
1393 set_default = 1; 1393 set_default = 1;
1394 1394
1395 /* in v1 and v3 cases lumv1 points to data */ 1395 /* in v1 and v3 cases lumv1 points to data */
@@ -1780,8 +1780,7 @@ out_quotactl:
1780 return ll_flush_ctx(inode); 1780 return ll_flush_ctx(inode);
1781#ifdef CONFIG_FS_POSIX_ACL 1781#ifdef CONFIG_FS_POSIX_ACL
1782 case LL_IOC_RMTACL: { 1782 case LL_IOC_RMTACL: {
1783 if (sbi->ll_flags & LL_SBI_RMT_CLIENT && 1783 if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) {
1784 inode == inode->i_sb->s_root->d_inode) {
1785 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 1784 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
1786 1785
1787 LASSERT(fd != NULL); 1786 LASSERT(fd != NULL);
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index c99b74117152..a2ae9a68a9a0 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -266,6 +266,10 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
266{ 266{
267 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 267 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
268 struct ll_inode_info *lli = ll_i2info(inode); 268 struct ll_inode_info *lli = ll_i2info(inode);
269 int lockmode;
270 __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
271 struct lustre_handle lockh;
272 ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};
269 int rc = 0; 273 int rc = 0;
270 274
271 /* clear group lock, if present */ 275 /* clear group lock, if present */
@@ -292,39 +296,26 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
292 296
293 /* Let's see if we have good enough OPEN lock on the file and if 297 /* Let's see if we have good enough OPEN lock on the file and if
294 we can skip talking to MDS */ 298 we can skip talking to MDS */
295 if (file->f_dentry->d_inode) { /* Can this ever be false? */
296 int lockmode;
297 __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
298 struct lustre_handle lockh;
299 struct inode *inode = file->f_dentry->d_inode;
300 ldlm_policy_data_t policy = {.l_inodebits={MDS_INODELOCK_OPEN}};
301
302 mutex_lock(&lli->lli_och_mutex);
303 if (fd->fd_omode & FMODE_WRITE) {
304 lockmode = LCK_CW;
305 LASSERT(lli->lli_open_fd_write_count);
306 lli->lli_open_fd_write_count--;
307 } else if (fd->fd_omode & FMODE_EXEC) {
308 lockmode = LCK_PR;
309 LASSERT(lli->lli_open_fd_exec_count);
310 lli->lli_open_fd_exec_count--;
311 } else {
312 lockmode = LCK_CR;
313 LASSERT(lli->lli_open_fd_read_count);
314 lli->lli_open_fd_read_count--;
315 }
316 mutex_unlock(&lli->lli_och_mutex);
317 299
318 if (!md_lock_match(md_exp, flags, ll_inode2fid(inode), 300 mutex_lock(&lli->lli_och_mutex);
319 LDLM_IBITS, &policy, lockmode, 301 if (fd->fd_omode & FMODE_WRITE) {
320 &lockh)) { 302 lockmode = LCK_CW;
321 rc = ll_md_real_close(file->f_dentry->d_inode, 303 LASSERT(lli->lli_open_fd_write_count);
322 fd->fd_omode); 304 lli->lli_open_fd_write_count--;
323 } 305 } else if (fd->fd_omode & FMODE_EXEC) {
306 lockmode = LCK_PR;
307 LASSERT(lli->lli_open_fd_exec_count);
308 lli->lli_open_fd_exec_count--;
324 } else { 309 } else {
325 CERROR("Releasing a file %p with negative dentry %p. Name %s", 310 lockmode = LCK_CR;
326 file, file->f_dentry, file->f_dentry->d_name.name); 311 LASSERT(lli->lli_open_fd_read_count);
312 lli->lli_open_fd_read_count--;
327 } 313 }
314 mutex_unlock(&lli->lli_och_mutex);
315
316 if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
317 LDLM_IBITS, &policy, lockmode, &lockh))
318 rc = ll_md_real_close(inode, fd->fd_omode);
328 319
329out: 320out:
330 LUSTRE_FPRIVATE(file) = NULL; 321 LUSTRE_FPRIVATE(file) = NULL;
@@ -350,8 +341,7 @@ int ll_file_release(struct inode *inode, struct file *file)
350 inode->i_generation, inode); 341 inode->i_generation, inode);
351 342
352#ifdef CONFIG_FS_POSIX_ACL 343#ifdef CONFIG_FS_POSIX_ACL
353 if (sbi->ll_flags & LL_SBI_RMT_CLIENT && 344 if (sbi->ll_flags & LL_SBI_RMT_CLIENT && is_root_inode(inode)) {
354 inode == inode->i_sb->s_root->d_inode) {
355 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 345 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
356 346
357 LASSERT(fd != NULL); 347 LASSERT(fd != NULL);
@@ -363,7 +353,7 @@ int ll_file_release(struct inode *inode, struct file *file)
363 } 353 }
364#endif 354#endif
365 355
366 if (inode->i_sb->s_root != file->f_dentry) 356 if (!is_root_inode(inode))
367 ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1); 357 ll_stats_ops_tally(sbi, LPROC_LL_RELEASE, 1);
368 fd = LUSTRE_FPRIVATE(file); 358 fd = LUSTRE_FPRIVATE(file);
369 LASSERT(fd != NULL); 359 LASSERT(fd != NULL);
@@ -375,7 +365,7 @@ int ll_file_release(struct inode *inode, struct file *file)
375 lli->lli_opendir_pid != 0) 365 lli->lli_opendir_pid != 0)
376 ll_stop_statahead(inode, lli->lli_opendir_key); 366 ll_stop_statahead(inode, lli->lli_opendir_key);
377 367
378 if (inode->i_sb->s_root == file->f_dentry) { 368 if (is_root_inode(inode)) {
379 LUSTRE_FPRIVATE(file) = NULL; 369 LUSTRE_FPRIVATE(file) = NULL;
380 ll_file_data_put(fd); 370 ll_file_data_put(fd);
381 return 0; 371 return 0;
@@ -394,21 +384,19 @@ int ll_file_release(struct inode *inode, struct file *file)
394 return rc; 384 return rc;
395} 385}
396 386
397static int ll_intent_file_open(struct file *file, void *lmm, 387static int ll_intent_file_open(struct dentry *dentry, void *lmm,
398 int lmmsize, struct lookup_intent *itp) 388 int lmmsize, struct lookup_intent *itp)
399{ 389{
400 struct ll_sb_info *sbi = ll_i2sbi(file->f_dentry->d_inode); 390 struct inode *inode = dentry->d_inode;
401 struct dentry *parent = file->f_dentry->d_parent; 391 struct ll_sb_info *sbi = ll_i2sbi(inode);
402 const char *name = file->f_dentry->d_name.name; 392 struct dentry *parent = dentry->d_parent;
403 const int len = file->f_dentry->d_name.len; 393 const char *name = dentry->d_name.name;
394 const int len = dentry->d_name.len;
404 struct md_op_data *op_data; 395 struct md_op_data *op_data;
405 struct ptlrpc_request *req; 396 struct ptlrpc_request *req;
406 __u32 opc = LUSTRE_OPC_ANY; 397 __u32 opc = LUSTRE_OPC_ANY;
407 int rc; 398 int rc;
408 399
409 if (!parent)
410 return -ENOENT;
411
412 /* Usually we come here only for NFSD, and we want open lock. 400 /* Usually we come here only for NFSD, and we want open lock.
413 But we can also get here with pre 2.6.15 patchless kernels, and in 401 But we can also get here with pre 2.6.15 patchless kernels, and in
414 that case that lock is also ok */ 402 that case that lock is also ok */
@@ -425,7 +413,7 @@ static int ll_intent_file_open(struct file *file, void *lmm,
425 } 413 }
426 414
427 op_data = ll_prep_md_op_data(NULL, parent->d_inode, 415 op_data = ll_prep_md_op_data(NULL, parent->d_inode,
428 file->f_dentry->d_inode, name, len, 416 inode, name, len,
429 O_RDWR, opc, NULL); 417 O_RDWR, opc, NULL);
430 if (IS_ERR(op_data)) 418 if (IS_ERR(op_data))
431 return PTR_ERR(op_data); 419 return PTR_ERR(op_data);
@@ -441,7 +429,7 @@ static int ll_intent_file_open(struct file *file, void *lmm,
441 if (!it_disposition(itp, DISP_OPEN_OPEN) || 429 if (!it_disposition(itp, DISP_OPEN_OPEN) ||
442 it_open_error(DISP_OPEN_OPEN, itp)) 430 it_open_error(DISP_OPEN_OPEN, itp))
443 goto out; 431 goto out;
444 ll_release_openhandle(file->f_dentry, itp); 432 ll_release_openhandle(inode, itp);
445 goto out; 433 goto out;
446 } 434 }
447 435
@@ -456,10 +444,9 @@ static int ll_intent_file_open(struct file *file, void *lmm,
456 goto out; 444 goto out;
457 } 445 }
458 446
459 rc = ll_prep_inode(&file->f_dentry->d_inode, req, NULL, itp); 447 rc = ll_prep_inode(&inode, req, NULL, itp);
460 if (!rc && itp->d.lustre.it_lock_mode) 448 if (!rc && itp->d.lustre.it_lock_mode)
461 ll_set_lock_data(sbi->ll_md_exp, file->f_dentry->d_inode, 449 ll_set_lock_data(sbi->ll_md_exp, inode, itp, NULL);
462 itp, NULL);
463 450
464out: 451out:
465 ptlrpc_req_finished(req); 452 ptlrpc_req_finished(req);
@@ -501,7 +488,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
501static int ll_local_open(struct file *file, struct lookup_intent *it, 488static int ll_local_open(struct file *file, struct lookup_intent *it,
502 struct ll_file_data *fd, struct obd_client_handle *och) 489 struct ll_file_data *fd, struct obd_client_handle *och)
503{ 490{
504 struct inode *inode = file->f_dentry->d_inode; 491 struct inode *inode = file_inode(file);
505 struct ll_inode_info *lli = ll_i2info(inode); 492 struct ll_inode_info *lli = ll_i2info(inode);
506 493
507 LASSERT(!LUSTRE_FPRIVATE(file)); 494 LASSERT(!LUSTRE_FPRIVATE(file));
@@ -574,7 +561,7 @@ int ll_file_open(struct inode *inode, struct file *file)
574 spin_unlock(&lli->lli_sa_lock); 561 spin_unlock(&lli->lli_sa_lock);
575 } 562 }
576 563
577 if (inode->i_sb->s_root == file->f_dentry) { 564 if (is_root_inode(inode)) {
578 LUSTRE_FPRIVATE(file) = fd; 565 LUSTRE_FPRIVATE(file) = fd;
579 return 0; 566 return 0;
580 } 567 }
@@ -632,7 +619,7 @@ restart:
632 goto out_openerr; 619 goto out_openerr;
633 } 620 }
634 621
635 ll_release_openhandle(file->f_dentry, it); 622 ll_release_openhandle(inode, it);
636 } 623 }
637 (*och_usecount)++; 624 (*och_usecount)++;
638 625
@@ -652,7 +639,7 @@ restart:
652 result in a deadlock */ 639 result in a deadlock */
653 mutex_unlock(&lli->lli_och_mutex); 640 mutex_unlock(&lli->lli_och_mutex);
654 it->it_create_mode |= M_CHECK_STALE; 641 it->it_create_mode |= M_CHECK_STALE;
655 rc = ll_intent_file_open(file, NULL, 0, it); 642 rc = ll_intent_file_open(file->f_path.dentry, NULL, 0, it);
656 it->it_create_mode &= ~M_CHECK_STALE; 643 it->it_create_mode &= ~M_CHECK_STALE;
657 if (rc) 644 if (rc)
658 goto out_openerr; 645 goto out_openerr;
@@ -1065,7 +1052,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
1065static bool file_is_noatime(const struct file *file) 1052static bool file_is_noatime(const struct file *file)
1066{ 1053{
1067 const struct vfsmount *mnt = file->f_path.mnt; 1054 const struct vfsmount *mnt = file->f_path.mnt;
1068 const struct inode *inode = file->f_path.dentry->d_inode; 1055 const struct inode *inode = file_inode(file);
1069 1056
1070 /* Adapted from file_accessed() and touch_atime().*/ 1057 /* Adapted from file_accessed() and touch_atime().*/
1071 if (file->f_flags & O_NOATIME) 1058 if (file->f_flags & O_NOATIME)
@@ -1091,7 +1078,7 @@ static bool file_is_noatime(const struct file *file)
1091 1078
1092void ll_io_init(struct cl_io *io, const struct file *file, int write) 1079void ll_io_init(struct cl_io *io, const struct file *file, int write)
1093{ 1080{
1094 struct inode *inode = file->f_dentry->d_inode; 1081 struct inode *inode = file_inode(file);
1095 1082
1096 io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK; 1083 io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
1097 if (write) { 1084 if (write) {
@@ -1117,7 +1104,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
1117 struct file *file, enum cl_io_type iot, 1104 struct file *file, enum cl_io_type iot,
1118 loff_t *ppos, size_t count) 1105 loff_t *ppos, size_t count)
1119{ 1106{
1120 struct ll_inode_info *lli = ll_i2info(file->f_dentry->d_inode); 1107 struct ll_inode_info *lli = ll_i2info(file_inode(file));
1121 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 1108 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
1122 struct cl_io *io; 1109 struct cl_io *io;
1123 ssize_t result; 1110 ssize_t result;
@@ -1178,20 +1165,20 @@ out:
1178 /* If any bit been read/written (result != 0), we just return 1165 /* If any bit been read/written (result != 0), we just return
1179 * short read/write instead of restart io. */ 1166 * short read/write instead of restart io. */
1180 if ((result == 0 || result == -ENODATA) && io->ci_need_restart) { 1167 if ((result == 0 || result == -ENODATA) && io->ci_need_restart) {
1181 CDEBUG(D_VFSTRACE, "Restart %s on %s from %lld, count:%zd\n", 1168 CDEBUG(D_VFSTRACE, "Restart %s on %pD from %lld, count:%zd\n",
1182 iot == CIT_READ ? "read" : "write", 1169 iot == CIT_READ ? "read" : "write",
1183 file->f_dentry->d_name.name, *ppos, count); 1170 file, *ppos, count);
1184 LASSERTF(io->ci_nob == 0, "%zd", io->ci_nob); 1171 LASSERTF(io->ci_nob == 0, "%zd", io->ci_nob);
1185 goto restart; 1172 goto restart;
1186 } 1173 }
1187 1174
1188 if (iot == CIT_READ) { 1175 if (iot == CIT_READ) {
1189 if (result >= 0) 1176 if (result >= 0)
1190 ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), 1177 ll_stats_ops_tally(ll_i2sbi(file_inode(file)),
1191 LPROC_LL_READ_BYTES, result); 1178 LPROC_LL_READ_BYTES, result);
1192 } else if (iot == CIT_WRITE) { 1179 } else if (iot == CIT_WRITE) {
1193 if (result >= 0) { 1180 if (result >= 0) {
1194 ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), 1181 ll_stats_ops_tally(ll_i2sbi(file_inode(file)),
1195 LPROC_LL_WRITE_BYTES, result); 1182 LPROC_LL_WRITE_BYTES, result);
1196 fd->fd_write_failed = false; 1183 fd->fd_write_failed = false;
1197 } else if (result != -ERESTARTSYS) { 1184 } else if (result != -ERESTARTSYS) {
@@ -1354,7 +1341,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
1354 return ll_lov_recreate(inode, &oi, ost_idx); 1341 return ll_lov_recreate(inode, &oi, ost_idx);
1355} 1342}
1356 1343
1357int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, 1344int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
1358 int flags, struct lov_user_md *lum, int lum_size) 1345 int flags, struct lov_user_md *lum, int lum_size)
1359{ 1346{
1360 struct lov_stripe_md *lsm = NULL; 1347 struct lov_stripe_md *lsm = NULL;
@@ -1371,21 +1358,20 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
1371 } 1358 }
1372 1359
1373 ll_inode_size_lock(inode); 1360 ll_inode_size_lock(inode);
1374 rc = ll_intent_file_open(file, lum, lum_size, &oit); 1361 rc = ll_intent_file_open(dentry, lum, lum_size, &oit);
1375 if (rc) 1362 if (rc)
1376 goto out_unlock; 1363 goto out_unlock;
1377 rc = oit.d.lustre.it_status; 1364 rc = oit.d.lustre.it_status;
1378 if (rc < 0) 1365 if (rc < 0)
1379 goto out_req_free; 1366 goto out_req_free;
1380 1367
1381 ll_release_openhandle(file->f_dentry, &oit); 1368 ll_release_openhandle(inode, &oit);
1382 1369
1383out_unlock: 1370out_unlock:
1384 ll_inode_size_unlock(inode); 1371 ll_inode_size_unlock(inode);
1385 ll_intent_release(&oit); 1372 ll_intent_release(&oit);
1386 ccc_inode_lsm_put(inode, lsm); 1373 ccc_inode_lsm_put(inode, lsm);
1387out: 1374out:
1388 cl_lov_delay_create_clear(&file->f_flags);
1389 return rc; 1375 return rc;
1390out_req_free: 1376out_req_free:
1391 ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data); 1377 ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data);
@@ -1499,7 +1485,9 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
1499 return -EFAULT; 1485 return -EFAULT;
1500 } 1486 }
1501 1487
1502 rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size); 1488 rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lump,
1489 lum_size);
1490 cl_lov_delay_create_clear(&file->f_flags);
1503 1491
1504 OBD_FREE_LARGE(lump, lum_size); 1492 OBD_FREE_LARGE(lump, lum_size);
1505 return rc; 1493 return rc;
@@ -1526,7 +1514,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file,
1526 return -EFAULT; 1514 return -EFAULT;
1527 } 1515 }
1528 1516
1529 rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size); 1517 rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, lumv1,
1518 lum_size);
1519 cl_lov_delay_create_clear(&file->f_flags);
1530 if (rc == 0) { 1520 if (rc == 0) {
1531 struct lov_stripe_md *lsm; 1521 struct lov_stripe_md *lsm;
1532 __u32 gen; 1522 __u32 gen;
@@ -1631,22 +1621,21 @@ int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg)
1631/** 1621/**
1632 * Close inode open handle 1622 * Close inode open handle
1633 * 1623 *
1634 * \param dentry [in] dentry which contains the inode 1624 * \param inode [in] inode in question
1635 * \param it [in,out] intent which contains open info and result 1625 * \param it [in,out] intent which contains open info and result
1636 * 1626 *
1637 * \retval 0 success 1627 * \retval 0 success
1638 * \retval <0 failure 1628 * \retval <0 failure
1639 */ 1629 */
1640int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it) 1630int ll_release_openhandle(struct inode *inode, struct lookup_intent *it)
1641{ 1631{
1642 struct inode *inode = dentry->d_inode;
1643 struct obd_client_handle *och; 1632 struct obd_client_handle *och;
1644 int rc; 1633 int rc;
1645 1634
1646 LASSERT(inode); 1635 LASSERT(inode);
1647 1636
1648 /* Root ? Do nothing. */ 1637 /* Root ? Do nothing. */
1649 if (dentry->d_inode->i_sb->s_root == dentry) 1638 if (is_root_inode(inode))
1650 return 0; 1639 return 0;
1651 1640
1652 /* No open handle to close? Move away */ 1641 /* No open handle to close? Move away */
@@ -1959,8 +1948,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2,
1959 if (!llss) 1948 if (!llss)
1960 return -ENOMEM; 1949 return -ENOMEM;
1961 1950
1962 llss->inode1 = file1->f_dentry->d_inode; 1951 llss->inode1 = file_inode(file1);
1963 llss->inode2 = file2->f_dentry->d_inode; 1952 llss->inode2 = file_inode(file2);
1964 1953
1965 if (!S_ISREG(llss->inode2->i_mode)) { 1954 if (!S_ISREG(llss->inode2->i_mode)) {
1966 rc = -EINVAL; 1955 rc = -EINVAL;
@@ -2092,7 +2081,7 @@ putgl:
2092 rc = 0; 2081 rc = 0;
2093 if (llss->ia2.ia_valid != 0) { 2082 if (llss->ia2.ia_valid != 0) {
2094 mutex_lock(&llss->inode1->i_mutex); 2083 mutex_lock(&llss->inode1->i_mutex);
2095 rc = ll_setattr(file1->f_dentry, &llss->ia2); 2084 rc = ll_setattr(file1->f_path.dentry, &llss->ia2);
2096 mutex_unlock(&llss->inode1->i_mutex); 2085 mutex_unlock(&llss->inode1->i_mutex);
2097 } 2086 }
2098 2087
@@ -2100,7 +2089,7 @@ putgl:
2100 int rc1; 2089 int rc1;
2101 2090
2102 mutex_lock(&llss->inode2->i_mutex); 2091 mutex_lock(&llss->inode2->i_mutex);
2103 rc1 = ll_setattr(file2->f_dentry, &llss->ia1); 2092 rc1 = ll_setattr(file2->f_path.dentry, &llss->ia1);
2104 mutex_unlock(&llss->inode2->i_mutex); 2093 mutex_unlock(&llss->inode2->i_mutex);
2105 if (rc == 0) 2094 if (rc == 0)
2106 rc = rc1; 2095 rc = rc1;
@@ -2185,7 +2174,7 @@ static int ll_hsm_import(struct inode *inode, struct file *file,
2185 2174
2186 mutex_lock(&inode->i_mutex); 2175 mutex_lock(&inode->i_mutex);
2187 2176
2188 rc = ll_setattr_raw(file->f_dentry, attr, true); 2177 rc = ll_setattr_raw(file->f_path.dentry, attr, true);
2189 if (rc == -ENODATA) 2178 if (rc == -ENODATA)
2190 rc = 0; 2179 rc = 0;
2191 2180
@@ -2204,7 +2193,7 @@ out:
2204static long 2193static long
2205ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2194ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2206{ 2195{
2207 struct inode *inode = file->f_dentry->d_inode; 2196 struct inode *inode = file_inode(file);
2208 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 2197 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
2209 int flags, rc; 2198 int flags, rc;
2210 2199
@@ -2523,7 +2512,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2523 2512
2524static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) 2513static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
2525{ 2514{
2526 struct inode *inode = file->f_dentry->d_inode; 2515 struct inode *inode = file_inode(file);
2527 loff_t retval, eof = 0; 2516 loff_t retval, eof = 0;
2528 2517
2529 retval = offset + ((origin == SEEK_END) ? i_size_read(inode) : 2518 retval = offset + ((origin == SEEK_END) ? i_size_read(inode) :
@@ -2547,7 +2536,7 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
2547 2536
2548static int ll_flush(struct file *file, fl_owner_t id) 2537static int ll_flush(struct file *file, fl_owner_t id)
2549{ 2538{
2550 struct inode *inode = file->f_dentry->d_inode; 2539 struct inode *inode = file_inode(file);
2551 struct ll_inode_info *lli = ll_i2info(inode); 2540 struct ll_inode_info *lli = ll_i2info(inode);
2552 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 2541 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
2553 int rc, err; 2542 int rc, err;
@@ -2622,16 +2611,9 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
2622 return result; 2611 return result;
2623} 2612}
2624 2613
2625/*
2626 * When dentry is provided (the 'else' case), *file->f_dentry may be
2627 * null and dentry must be used directly rather than pulled from
2628 * *file->f_dentry as is done otherwise.
2629 */
2630
2631int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) 2614int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2632{ 2615{
2633 struct dentry *dentry = file->f_dentry; 2616 struct inode *inode = file_inode(file);
2634 struct inode *inode = dentry->d_inode;
2635 struct ll_inode_info *lli = ll_i2info(inode); 2617 struct ll_inode_info *lli = ll_i2info(inode);
2636 struct ptlrpc_request *req; 2618 struct ptlrpc_request *req;
2637 struct obd_capa *oc; 2619 struct obd_capa *oc;
@@ -2684,7 +2666,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2684static int 2666static int
2685ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) 2667ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
2686{ 2668{
2687 struct inode *inode = file->f_dentry->d_inode; 2669 struct inode *inode = file_inode(file);
2688 struct ll_sb_info *sbi = ll_i2sbi(inode); 2670 struct ll_sb_info *sbi = ll_i2sbi(inode);
2689 struct ldlm_enqueue_info einfo = { 2671 struct ldlm_enqueue_info einfo = {
2690 .ei_type = LDLM_FLOCK, 2672 .ei_type = LDLM_FLOCK,
@@ -2908,8 +2890,8 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
2908 2890
2909 LASSERT(inode != NULL); 2891 LASSERT(inode != NULL);
2910 2892
2911 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%s\n", 2893 CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),name=%pd\n",
2912 inode->i_ino, inode->i_generation, inode, dentry->d_name.name); 2894 inode->i_ino, inode->i_generation, inode, dentry);
2913 2895
2914 exp = ll_i2mdexp(inode); 2896 exp = ll_i2mdexp(inode);
2915 2897
@@ -3119,7 +3101,7 @@ int ll_inode_permission(struct inode *inode, int mask)
3119 /* as root inode are NOT getting validated in lookup operation, 3101 /* as root inode are NOT getting validated in lookup operation,
3120 * need to do it before permission check. */ 3102 * need to do it before permission check. */
3121 3103
3122 if (inode == inode->i_sb->s_root->d_inode) { 3104 if (is_root_inode(inode)) {
3123 rc = __ll_inode_revalidate(inode->i_sb->s_root, 3105 rc = __ll_inode_revalidate(inode->i_sb->s_root,
3124 MDS_INODELOCK_LOOKUP); 3106 MDS_INODELOCK_LOOKUP);
3125 if (rc) 3107 if (rc)
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 36aa0fd147f2..77d1c12704b4 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -748,7 +748,7 @@ int ll_file_release(struct inode *inode, struct file *file);
748int ll_glimpse_ioctl(struct ll_sb_info *sbi, 748int ll_glimpse_ioctl(struct ll_sb_info *sbi,
749 struct lov_stripe_md *lsm, lstat_t *st); 749 struct lov_stripe_md *lsm, lstat_t *st);
750void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch); 750void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch);
751int ll_release_openhandle(struct dentry *, struct lookup_intent *); 751int ll_release_openhandle(struct inode *, struct lookup_intent *);
752int ll_md_real_close(struct inode *inode, fmode_t fmode); 752int ll_md_real_close(struct inode *inode, fmode_t fmode);
753void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, 753void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data,
754 struct obd_client_handle **och, unsigned long flags); 754 struct obd_client_handle **och, unsigned long flags);
@@ -763,7 +763,7 @@ struct posix_acl *ll_get_acl(struct inode *inode, int type);
763 763
764int ll_inode_permission(struct inode *inode, int mask); 764int ll_inode_permission(struct inode *inode, int mask);
765 765
766int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file, 766int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
767 int flags, struct lov_user_md *lum, 767 int flags, struct lov_user_md *lum,
768 int lum_size); 768 int lum_size);
769int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, 769int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename,
@@ -1413,7 +1413,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io,
1413static inline int ll_file_nolock(const struct file *file) 1413static inline int ll_file_nolock(const struct file *file)
1414{ 1414{
1415 struct ll_file_data *fd = LUSTRE_FPRIVATE(file); 1415 struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
1416 struct inode *inode = file->f_dentry->d_inode; 1416 struct inode *inode = file_inode(file);
1417 1417
1418 LASSERT(fd != NULL); 1418 LASSERT(fd != NULL);
1419 return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || 1419 return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
@@ -1489,8 +1489,8 @@ static inline void __d_lustre_invalidate(struct dentry *dentry)
1489 */ 1489 */
1490static inline void d_lustre_invalidate(struct dentry *dentry, int nested) 1490static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
1491{ 1491{
1492 CDEBUG(D_DENTRY, "invalidate dentry %.*s (%p) parent %p inode %p " 1492 CDEBUG(D_DENTRY, "invalidate dentry %pd (%p) parent %p inode %p "
1493 "refc %d\n", dentry->d_name.len, dentry->d_name.name, dentry, 1493 "refc %d\n", dentry, dentry,
1494 dentry->d_parent, dentry->d_inode, d_count(dentry)); 1494 dentry->d_parent, dentry->d_inode, d_count(dentry));
1495 1495
1496 spin_lock_nested(&dentry->d_lock, 1496 spin_lock_nested(&dentry->d_lock,
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a8bcc51057f1..7b6b9e2e0102 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -698,10 +698,8 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
698 list_for_each(tmp, &dentry->d_subdirs) 698 list_for_each(tmp, &dentry->d_subdirs)
699 subdirs++; 699 subdirs++;
700 700
701 CERROR("dentry %p dump: name=%.*s parent=%.*s (%p), inode=%p, count=%u," 701 CERROR("dentry %p dump: name=%pd parent=%p, inode=%p, count=%u,"
702 " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, 702 " flags=0x%x, fsdata=%p, %d subdirs\n", dentry, dentry,
703 dentry->d_name.len, dentry->d_name.name,
704 dentry->d_parent->d_name.len, dentry->d_parent->d_name.name,
705 dentry->d_parent, dentry->d_inode, d_count(dentry), 703 dentry->d_parent, dentry->d_inode, d_count(dentry),
706 dentry->d_flags, dentry->d_fsdata, subdirs); 704 dentry->d_flags, dentry->d_fsdata, subdirs);
707 if (dentry->d_inode != NULL) 705 if (dentry->d_inode != NULL)
@@ -711,7 +709,7 @@ void lustre_dump_dentry(struct dentry *dentry, int recur)
711 return; 709 return;
712 710
713 list_for_each(tmp, &dentry->d_subdirs) { 711 list_for_each(tmp, &dentry->d_subdirs) {
714 struct dentry *d = list_entry(tmp, struct dentry, d_u.d_child); 712 struct dentry *d = list_entry(tmp, struct dentry, d_child);
715 lustre_dump_dentry(d, recur - 1); 713 lustre_dump_dentry(d, recur - 1);
716 } 714 }
717} 715}
diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c
index ae605a6d9dc2..ba1c047ae927 100644
--- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
+++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
@@ -100,7 +100,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,
100 unsigned long *ra_flags) 100 unsigned long *ra_flags)
101{ 101{
102 struct file *file = vma->vm_file; 102 struct file *file = vma->vm_file;
103 struct inode *inode = file->f_dentry->d_inode; 103 struct inode *inode = file_inode(file);
104 struct cl_io *io; 104 struct cl_io *io;
105 struct cl_fault_io *fio; 105 struct cl_fault_io *fio;
106 struct lu_env *env; 106 struct lu_env *env;
@@ -213,7 +213,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,
213 cfs_restore_sigs(set); 213 cfs_restore_sigs(set);
214 214
215 if (result == 0) { 215 if (result == 0) {
216 struct inode *inode = vma->vm_file->f_dentry->d_inode; 216 struct inode *inode = file_inode(vma->vm_file);
217 struct ll_inode_info *lli = ll_i2info(inode); 217 struct ll_inode_info *lli = ll_i2info(inode);
218 218
219 lock_page(vmpage); 219 lock_page(vmpage);
@@ -396,7 +396,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
396 CWARN("app(%s): the page %lu of file %lu is under heavy" 396 CWARN("app(%s): the page %lu of file %lu is under heavy"
397 " contention.\n", 397 " contention.\n",
398 current->comm, vmf->pgoff, 398 current->comm, vmf->pgoff,
399 vma->vm_file->f_dentry->d_inode->i_ino); 399 file_inode(vma->vm_file)->i_ino);
400 printed = true; 400 printed = true;
401 } 401 }
402 } while (retry); 402 } while (retry);
@@ -430,7 +430,7 @@ static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
430 */ 430 */
431static void ll_vm_open(struct vm_area_struct *vma) 431static void ll_vm_open(struct vm_area_struct *vma)
432{ 432{
433 struct inode *inode = vma->vm_file->f_dentry->d_inode; 433 struct inode *inode = file_inode(vma->vm_file);
434 struct ccc_object *vob = cl_inode2ccc(inode); 434 struct ccc_object *vob = cl_inode2ccc(inode);
435 435
436 LASSERT(vma->vm_file); 436 LASSERT(vma->vm_file);
@@ -443,7 +443,7 @@ static void ll_vm_open(struct vm_area_struct *vma)
443 */ 443 */
444static void ll_vm_close(struct vm_area_struct *vma) 444static void ll_vm_close(struct vm_area_struct *vma)
445{ 445{
446 struct inode *inode = vma->vm_file->f_dentry->d_inode; 446 struct inode *inode = file_inode(vma->vm_file);
447 struct ccc_object *vob = cl_inode2ccc(inode); 447 struct ccc_object *vob = cl_inode2ccc(inode);
448 448
449 LASSERT(vma->vm_file); 449 LASSERT(vma->vm_file);
@@ -476,7 +476,7 @@ static const struct vm_operations_struct ll_file_vm_ops = {
476 476
477int ll_file_mmap(struct file *file, struct vm_area_struct *vma) 477int ll_file_mmap(struct file *file, struct vm_area_struct *vma)
478{ 478{
479 struct inode *inode = file->f_dentry->d_inode; 479 struct inode *inode = file_inode(file);
480 int rc; 480 int rc;
481 481
482 if (ll_file_nolock(file)) 482 if (ll_file_nolock(file))
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c
index ae3a12ab7fa1..243a7840457f 100644
--- a/drivers/staging/lustre/lustre/llite/llite_nfs.c
+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c
@@ -207,13 +207,15 @@ static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen,
207 return LUSTRE_NFS_FID; 207 return LUSTRE_NFS_FID;
208} 208}
209 209
210static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen, 210static int ll_nfs_get_name_filldir(struct dir_context *ctx, const char *name,
211 loff_t hash, u64 ino, unsigned type) 211 int namelen, loff_t hash, u64 ino,
212 unsigned type)
212{ 213{
213 /* It is hack to access lde_fid for comparison with lgd_fid. 214 /* It is hack to access lde_fid for comparison with lgd_fid.
214 * So the input 'name' must be part of the 'lu_dirent'. */ 215 * So the input 'name' must be part of the 'lu_dirent'. */
215 struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name); 216 struct lu_dirent *lde = container_of0(name, struct lu_dirent, lde_name);
216 struct ll_getname_data *lgd = cookie; 217 struct ll_getname_data *lgd =
218 container_of(ctx, struct ll_getname_data, ctx);
217 struct lu_fid fid; 219 struct lu_fid fid;
218 220
219 fid_le_to_cpu(&fid, &lde->lde_fid); 221 fid_le_to_cpu(&fid, &lde->lde_fid);
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c
index 264e5ec3fed6..9e31b789b790 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -187,7 +187,7 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)
187{ 187{
188 const struct lu_env *env = lo->lo_env; 188 const struct lu_env *env = lo->lo_env;
189 struct cl_io *io = &lo->lo_io; 189 struct cl_io *io = &lo->lo_io;
190 struct inode *inode = lo->lo_backing_file->f_dentry->d_inode; 190 struct inode *inode = file_inode(lo->lo_backing_file);
191 struct cl_object *obj = ll_i2info(inode)->lli_clob; 191 struct cl_object *obj = ll_i2info(inode)->lli_clob;
192 pgoff_t offset; 192 pgoff_t offset;
193 int ret; 193 int ret;
@@ -626,7 +626,7 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
626 break; 626 break;
627 } 627 }
628 if (inode == NULL) 628 if (inode == NULL)
629 inode = lo->lo_backing_file->f_dentry->d_inode; 629 inode = file_inode(lo->lo_backing_file);
630 if (lo->lo_state == LLOOP_BOUND) 630 if (lo->lo_state == LLOOP_BOUND)
631 fid = ll_i2info(inode)->lli_fid; 631 fid = ll_i2info(inode)->lli_fid;
632 else 632 else
@@ -692,8 +692,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,
692 lo_free = lo; 692 lo_free = lo;
693 continue; 693 continue;
694 } 694 }
695 if (lo->lo_backing_file->f_dentry->d_inode == 695 if (file_inode(lo->lo_backing_file) == file_inode(file))
696 file->f_dentry->d_inode)
697 break; 696 break;
698 } 697 }
699 if (lo || !lo_free) { 698 if (lo || !lo_free) {
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 7a68c1e027e0..8e926b385a60 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -54,27 +54,6 @@
54static int ll_create_it(struct inode *, struct dentry *, 54static int ll_create_it(struct inode *, struct dentry *,
55 int, struct lookup_intent *); 55 int, struct lookup_intent *);
56 56
57/*
58 * Check if we have something mounted at the named dchild.
59 * In such a case there would always be dentry present.
60 */
61static int ll_d_mountpoint(struct dentry *dparent, struct dentry *dchild,
62 struct qstr *name)
63{
64 int mounted = 0;
65
66 if (unlikely(dchild)) {
67 mounted = d_mountpoint(dchild);
68 } else if (dparent) {
69 dchild = d_lookup(dparent, name);
70 if (dchild) {
71 mounted = d_mountpoint(dchild);
72 dput(dchild);
73 }
74 }
75 return mounted;
76}
77
78/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */ 57/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */
79static int ll_test_inode(struct inode *inode, void *opaque) 58static int ll_test_inode(struct inode *inode, void *opaque)
80{ 59{
@@ -167,14 +146,14 @@ static void ll_invalidate_negative_children(struct inode *dir)
167 struct ll_d_hlist_node *p; 146 struct ll_d_hlist_node *p;
168 147
169 ll_lock_dcache(dir); 148 ll_lock_dcache(dir);
170 ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_alias) { 149 ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) {
171 spin_lock(&dentry->d_lock); 150 spin_lock(&dentry->d_lock);
172 if (!list_empty(&dentry->d_subdirs)) { 151 if (!list_empty(&dentry->d_subdirs)) {
173 struct dentry *child; 152 struct dentry *child;
174 153
175 list_for_each_entry_safe(child, tmp_subdir, 154 list_for_each_entry_safe(child, tmp_subdir,
176 &dentry->d_subdirs, 155 &dentry->d_subdirs,
177 d_u.d_child) { 156 d_child) {
178 if (child->d_inode == NULL) 157 if (child->d_inode == NULL)
179 d_lustre_invalidate(child, 1); 158 d_lustre_invalidate(child, 1);
180 } 159 }
@@ -285,7 +264,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
285 264
286 if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) && 265 if ((bits & (MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM)) &&
287 inode->i_sb->s_root != NULL && 266 inode->i_sb->s_root != NULL &&
288 inode != inode->i_sb->s_root->d_inode) 267 is_root_inode(inode))
289 ll_invalidate_aliases(inode); 268 ll_invalidate_aliases(inode);
290 269
291 iput(inode); 270 iput(inode);
@@ -362,7 +341,7 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
362 discon_alias = invalid_alias = NULL; 341 discon_alias = invalid_alias = NULL;
363 342
364 ll_lock_dcache(inode); 343 ll_lock_dcache(inode);
365 ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_alias) { 344 ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) {
366 LASSERT(alias != dentry); 345 LASSERT(alias != dentry);
367 346
368 spin_lock(&alias->d_lock); 347 spin_lock(&alias->d_lock);
@@ -509,8 +488,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
509 if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) 488 if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen)
510 return ERR_PTR(-ENAMETOOLONG); 489 return ERR_PTR(-ENAMETOOLONG);
511 490
512 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n", 491 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n",
513 dentry->d_name.len, dentry->d_name.name, parent->i_ino, 492 dentry, parent->i_ino,
514 parent->i_generation, parent, LL_IT2STR(it)); 493 parent->i_generation, parent, LL_IT2STR(it));
515 494
516 if (d_mountpoint(dentry)) 495 if (d_mountpoint(dentry))
@@ -563,7 +542,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
563 if ((it->it_op & IT_OPEN) && dentry->d_inode && 542 if ((it->it_op & IT_OPEN) && dentry->d_inode &&
564 !S_ISREG(dentry->d_inode->i_mode) && 543 !S_ISREG(dentry->d_inode->i_mode) &&
565 !S_ISDIR(dentry->d_inode->i_mode)) { 544 !S_ISDIR(dentry->d_inode->i_mode)) {
566 ll_release_openhandle(dentry, it); 545 ll_release_openhandle(dentry->d_inode, it);
567 } 546 }
568 ll_lookup_finish_locks(it, dentry); 547 ll_lookup_finish_locks(it, dentry);
569 548
@@ -586,8 +565,8 @@ static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
586 struct lookup_intent *itp, it = { .it_op = IT_GETATTR }; 565 struct lookup_intent *itp, it = { .it_op = IT_GETATTR };
587 struct dentry *de; 566 struct dentry *de;
588 567
589 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),flags=%u\n", 568 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),flags=%u\n",
590 dentry->d_name.len, dentry->d_name.name, parent->i_ino, 569 dentry, parent->i_ino,
591 parent->i_generation, parent, flags); 570 parent->i_generation, parent, flags);
592 571
593 /* Optimize away (CREATE && !OPEN). Let .create handle the race. */ 572 /* Optimize away (CREATE && !OPEN). Let .create handle the race. */
@@ -619,9 +598,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry,
619 long long lookup_flags = LOOKUP_OPEN; 598 long long lookup_flags = LOOKUP_OPEN;
620 int rc = 0; 599 int rc = 0;
621 600
622 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),file %p," 601 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),file %p,"
623 "open_flags %x,mode %x opened %d\n", 602 "open_flags %x,mode %x opened %d\n",
624 dentry->d_name.len, dentry->d_name.name, dir->i_ino, 603 dentry, dir->i_ino,
625 dir->i_generation, dir, file, open_flags, mode, *opened); 604 dir->i_generation, dir, file, open_flags, mode, *opened);
626 605
627 it = kzalloc(sizeof(*it), GFP_NOFS); 606 it = kzalloc(sizeof(*it), GFP_NOFS);
@@ -741,8 +720,8 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, int mode,
741 struct inode *inode; 720 struct inode *inode;
742 int rc = 0; 721 int rc = 0;
743 722
744 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n", 723 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),intent=%s\n",
745 dentry->d_name.len, dentry->d_name.name, dir->i_ino, 724 dentry, dir->i_ino,
746 dir->i_generation, dir, LL_IT2STR(it)); 725 dir->i_generation, dir, LL_IT2STR(it));
747 726
748 rc = it_open_error(DISP_OPEN_CREATE, it); 727 rc = it_open_error(DISP_OPEN_CREATE, it);
@@ -775,9 +754,9 @@ static void ll_update_times(struct ptlrpc_request *request,
775 LTIME_S(inode->i_ctime) = body->ctime; 754 LTIME_S(inode->i_ctime) = body->ctime;
776} 755}
777 756
778static int ll_new_node(struct inode *dir, struct qstr *name, 757static int ll_new_node(struct inode *dir, struct dentry *dentry,
779 const char *tgt, int mode, int rdev, 758 const char *tgt, int mode, int rdev,
780 struct dentry *dchild, __u32 opc) 759 __u32 opc)
781{ 760{
782 struct ptlrpc_request *request = NULL; 761 struct ptlrpc_request *request = NULL;
783 struct md_op_data *op_data; 762 struct md_op_data *op_data;
@@ -789,8 +768,10 @@ static int ll_new_node(struct inode *dir, struct qstr *name,
789 if (unlikely(tgt != NULL)) 768 if (unlikely(tgt != NULL))
790 tgt_len = strlen(tgt) + 1; 769 tgt_len = strlen(tgt) + 1;
791 770
792 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, 771 op_data = ll_prep_md_op_data(NULL, dir, NULL,
793 name->len, 0, opc, NULL); 772 dentry->d_name.name,
773 dentry->d_name.len,
774 0, opc, NULL);
794 if (IS_ERR(op_data)) { 775 if (IS_ERR(op_data)) {
795 err = PTR_ERR(op_data); 776 err = PTR_ERR(op_data);
796 goto err_exit; 777 goto err_exit;
@@ -806,27 +787,25 @@ static int ll_new_node(struct inode *dir, struct qstr *name,
806 787
807 ll_update_times(request, dir); 788 ll_update_times(request, dir);
808 789
809 if (dchild) { 790 err = ll_prep_inode(&inode, request, dir->i_sb, NULL);
810 err = ll_prep_inode(&inode, request, dchild->d_sb, NULL); 791 if (err)
811 if (err) 792 goto err_exit;
812 goto err_exit;
813 793
814 d_instantiate(dchild, inode); 794 d_instantiate(dentry, inode);
815 }
816err_exit: 795err_exit:
817 ptlrpc_req_finished(request); 796 ptlrpc_req_finished(request);
818 797
819 return err; 798 return err;
820} 799}
821 800
822static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode, 801static int ll_mknod(struct inode *dir, struct dentry *dchild,
823 unsigned rdev, struct dentry *dchild) 802 umode_t mode, dev_t rdev)
824{ 803{
825 int err; 804 int err;
826 805
827 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p) mode %o dev %x\n", 806 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p) mode %o dev %x\n",
828 name->len, name->name, dir->i_ino, dir->i_generation, dir, 807 dchild, dir->i_ino, dir->i_generation, dir,
829 mode, rdev); 808 mode, old_encode_dev(rdev));
830 809
831 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir))) 810 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
832 mode &= ~current_umask(); 811 mode &= ~current_umask();
@@ -839,7 +818,8 @@ static int ll_mknod_generic(struct inode *dir, struct qstr *name, int mode,
839 case S_IFBLK: 818 case S_IFBLK:
840 case S_IFIFO: 819 case S_IFIFO:
841 case S_IFSOCK: 820 case S_IFSOCK:
842 err = ll_new_node(dir, name, NULL, mode, rdev, dchild, 821 err = ll_new_node(dir, dchild, NULL, mode,
822 old_encode_dev(rdev),
843 LUSTRE_OPC_MKNOD); 823 LUSTRE_OPC_MKNOD);
844 break; 824 break;
845 case S_IFDIR: 825 case S_IFDIR:
@@ -863,134 +843,25 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry,
863{ 843{
864 int rc; 844 int rc;
865 845
866 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)," 846 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),"
867 "flags=%u, excl=%d\n", 847 "flags=%u, excl=%d\n",
868 dentry->d_name.len, dentry->d_name.name, dir->i_ino, 848 dentry, dir->i_ino,
869 dir->i_generation, dir, mode, want_excl); 849 dir->i_generation, dir, mode, want_excl);
870 850
871 rc = ll_mknod_generic(dir, &dentry->d_name, mode, 0, dentry); 851 rc = ll_mknod(dir, dentry, mode, 0);
872 852
873 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1); 853 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, 1);
874 854
875 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s, unhashed %d\n", 855 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd, unhashed %d\n",
876 dentry->d_name.len, dentry->d_name.name, d_unhashed(dentry)); 856 dentry, d_unhashed(dentry));
877 857
878 return rc; 858 return rc;
879} 859}
880 860
881static int ll_symlink_generic(struct inode *dir, struct qstr *name, 861static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid)
882 const char *tgt, struct dentry *dchild)
883{ 862{
884 int err; 863 if (child->d_inode)
885 864 *fid = *ll_inode2fid(child->d_inode);
886 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),target=%.*s\n",
887 name->len, name->name, dir->i_ino, dir->i_generation,
888 dir, 3000, tgt);
889
890 err = ll_new_node(dir, name, (char *)tgt, S_IFLNK | S_IRWXUGO,
891 0, dchild, LUSTRE_OPC_SYMLINK);
892
893 if (!err)
894 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1);
895
896 return err;
897}
898
899static int ll_link_generic(struct inode *src, struct inode *dir,
900 struct qstr *name, struct dentry *dchild)
901{
902 struct ll_sb_info *sbi = ll_i2sbi(dir);
903 struct ptlrpc_request *request = NULL;
904 struct md_op_data *op_data;
905 int err;
906
907 CDEBUG(D_VFSTRACE,
908 "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%.*s\n",
909 src->i_ino, src->i_generation, src, dir->i_ino,
910 dir->i_generation, dir, name->len, name->name);
911
912 op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len,
913 0, LUSTRE_OPC_ANY, NULL);
914 if (IS_ERR(op_data))
915 return PTR_ERR(op_data);
916
917 err = md_link(sbi->ll_md_exp, op_data, &request);
918 ll_finish_md_op_data(op_data);
919 if (err)
920 goto out;
921
922 ll_update_times(request, dir);
923 ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
924out:
925 ptlrpc_req_finished(request);
926 return err;
927}
928
929static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
930 int mode, struct dentry *dchild)
931
932{
933 int err;
934
935 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
936 name->len, name->name, dir->i_ino, dir->i_generation, dir);
937
938 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
939 mode &= ~current_umask();
940 mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR;
941 err = ll_new_node(dir, name, NULL, mode, 0, dchild, LUSTRE_OPC_MKDIR);
942
943 if (!err)
944 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1);
945
946 return err;
947}
948
949/* Try to find the child dentry by its name.
950 If found, put the result fid into @fid. */
951static void ll_get_child_fid(struct inode * dir, struct qstr *name,
952 struct lu_fid *fid)
953{
954 struct dentry *parent, *child;
955
956 parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_alias);
957 child = d_lookup(parent, name);
958 if (child) {
959 if (child->d_inode)
960 *fid = *ll_inode2fid(child->d_inode);
961 dput(child);
962 }
963}
964
965static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent,
966 struct dentry *dchild, struct qstr *name)
967{
968 struct ptlrpc_request *request = NULL;
969 struct md_op_data *op_data;
970 int rc;
971
972 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n",
973 name->len, name->name, dir->i_ino, dir->i_generation, dir);
974
975 if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
976 return -EBUSY;
977
978 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len,
979 S_IFDIR, LUSTRE_OPC_ANY, NULL);
980 if (IS_ERR(op_data))
981 return PTR_ERR(op_data);
982
983 ll_get_child_fid(dir, name, &op_data->op_fid3);
984 op_data->op_fid2 = op_data->op_fid3;
985 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
986 ll_finish_md_op_data(op_data);
987 if (rc == 0) {
988 ll_update_times(request, dir);
989 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1);
990 }
991
992 ptlrpc_req_finished(request);
993 return rc;
994} 865}
995 866
996/** 867/**
@@ -1099,32 +970,26 @@ out:
1099 return rc; 970 return rc;
1100} 971}
1101 972
1102/* ll_unlink_generic() doesn't update the inode with the new link count. 973/* ll_unlink() doesn't update the inode with the new link count.
1103 * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there 974 * Instead, ll_ddelete() and ll_d_iput() will update it based upon if there
1104 * is any lock existing. They will recycle dentries and inodes based upon locks 975 * is any lock existing. They will recycle dentries and inodes based upon locks
1105 * too. b=20433 */ 976 * too. b=20433 */
1106static int ll_unlink_generic(struct inode *dir, struct dentry *dparent, 977static int ll_unlink(struct inode * dir, struct dentry *dentry)
1107 struct dentry *dchild, struct qstr *name)
1108{ 978{
1109 struct ptlrpc_request *request = NULL; 979 struct ptlrpc_request *request = NULL;
1110 struct md_op_data *op_data; 980 struct md_op_data *op_data;
1111 int rc; 981 int rc;
1112 CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p)\n", 982 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
1113 name->len, name->name, dir->i_ino, dir->i_generation, dir); 983 dentry, dir->i_ino, dir->i_generation, dir);
1114
1115 /*
1116 * XXX: unlink bind mountpoint maybe call to here,
1117 * just check it as vfs_unlink does.
1118 */
1119 if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
1120 return -EBUSY;
1121 984
1122 op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, 985 op_data = ll_prep_md_op_data(NULL, dir, NULL,
1123 name->len, 0, LUSTRE_OPC_ANY, NULL); 986 dentry->d_name.name,
987 dentry->d_name.len,
988 0, LUSTRE_OPC_ANY, NULL);
1124 if (IS_ERR(op_data)) 989 if (IS_ERR(op_data))
1125 return PTR_ERR(op_data); 990 return PTR_ERR(op_data);
1126 991
1127 ll_get_child_fid(dir, name, &op_data->op_fid3); 992 ll_get_child_fid(dentry, &op_data->op_fid3);
1128 op_data->op_fid2 = op_data->op_fid3; 993 op_data->op_fid2 = op_data->op_fid3;
1129 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request); 994 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1130 ll_finish_md_op_data(op_data); 995 ll_finish_md_op_data(op_data);
@@ -1140,95 +1005,140 @@ static int ll_unlink_generic(struct inode *dir, struct dentry *dparent,
1140 return rc; 1005 return rc;
1141} 1006}
1142 1007
1143static int ll_rename_generic(struct inode *src, struct dentry *src_dparent, 1008static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode)
1144 struct dentry *src_dchild, struct qstr *src_name,
1145 struct inode *tgt, struct dentry *tgt_dparent,
1146 struct dentry *tgt_dchild, struct qstr *tgt_name)
1147{ 1009{
1148 struct ptlrpc_request *request = NULL;
1149 struct ll_sb_info *sbi = ll_i2sbi(src);
1150 struct md_op_data *op_data;
1151 int err; 1010 int err;
1152 1011
1153 CDEBUG(D_VFSTRACE, 1012 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
1154 "VFS Op:oldname=%.*s,src_dir=%lu/%u(%p),newname=%.*s," 1013 dentry, dir->i_ino, dir->i_generation, dir);
1155 "tgt_dir=%lu/%u(%p)\n", src_name->len, src_name->name,
1156 src->i_ino, src->i_generation, src, tgt_name->len,
1157 tgt_name->name, tgt->i_ino, tgt->i_generation, tgt);
1158 1014
1159 if (unlikely(ll_d_mountpoint(src_dparent, src_dchild, src_name) || 1015 if (!IS_POSIXACL(dir) || !exp_connect_umask(ll_i2mdexp(dir)))
1160 ll_d_mountpoint(tgt_dparent, tgt_dchild, tgt_name))) 1016 mode &= ~current_umask();
1161 return -EBUSY; 1017 mode = (mode & (S_IRWXUGO|S_ISVTX)) | S_IFDIR;
1018 err = ll_new_node(dir, dentry, NULL, mode, 0, LUSTRE_OPC_MKDIR);
1162 1019
1163 op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0, 1020 if (!err)
1164 LUSTRE_OPC_ANY, NULL); 1021 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1);
1022
1023 return err;
1024}
1025
1026static int ll_rmdir(struct inode *dir, struct dentry *dentry)
1027{
1028 struct ptlrpc_request *request = NULL;
1029 struct md_op_data *op_data;
1030 int rc;
1031
1032 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
1033 dentry, dir->i_ino, dir->i_generation, dir);
1034
1035 op_data = ll_prep_md_op_data(NULL, dir, NULL,
1036 dentry->d_name.name,
1037 dentry->d_name.len,
1038 S_IFDIR, LUSTRE_OPC_ANY, NULL);
1165 if (IS_ERR(op_data)) 1039 if (IS_ERR(op_data))
1166 return PTR_ERR(op_data); 1040 return PTR_ERR(op_data);
1167 1041
1168 ll_get_child_fid(src, src_name, &op_data->op_fid3); 1042 ll_get_child_fid(dentry, &op_data->op_fid3);
1169 ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4); 1043 op_data->op_fid2 = op_data->op_fid3;
1170 err = md_rename(sbi->ll_md_exp, op_data, 1044 rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
1171 src_name->name, src_name->len,
1172 tgt_name->name, tgt_name->len, &request);
1173 ll_finish_md_op_data(op_data); 1045 ll_finish_md_op_data(op_data);
1174 if (!err) { 1046 if (rc == 0) {
1175 ll_update_times(request, src); 1047 ll_update_times(request, dir);
1176 ll_update_times(request, tgt); 1048 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_RMDIR, 1);
1177 ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1);
1178 err = ll_objects_destroy(request, src);
1179 } 1049 }
1180 1050
1181 ptlrpc_req_finished(request); 1051 ptlrpc_req_finished(request);
1182 1052 return rc;
1183 return err;
1184} 1053}
1185 1054
1186static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode, 1055static int ll_symlink(struct inode *dir, struct dentry *dentry,
1187 dev_t rdev) 1056 const char *oldname)
1188{ 1057{
1189 return ll_mknod_generic(dir, &dchild->d_name, mode, 1058 int err;
1190 old_encode_dev(rdev), dchild);
1191}
1192 1059
1193static int ll_unlink(struct inode * dir, struct dentry *dentry) 1060 CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p),target=%.*s\n",
1194{ 1061 dentry, dir->i_ino, dir->i_generation,
1195 return ll_unlink_generic(dir, NULL, dentry, &dentry->d_name); 1062 dir, 3000, oldname);
1196}
1197 1063
1198static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode) 1064 err = ll_new_node(dir, dentry, oldname, S_IFLNK | S_IRWXUGO,
1199{ 1065 0, LUSTRE_OPC_SYMLINK);
1200 return ll_mkdir_generic(dir, &dentry->d_name, mode, dentry);
1201}
1202 1066
1203static int ll_rmdir(struct inode *dir, struct dentry *dentry) 1067 if (!err)
1204{ 1068 ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1);
1205 return ll_rmdir_generic(dir, NULL, dentry, &dentry->d_name);
1206}
1207 1069
1208static int ll_symlink(struct inode *dir, struct dentry *dentry, 1070 return err;
1209 const char *oldname)
1210{
1211 return ll_symlink_generic(dir, &dentry->d_name, oldname, dentry);
1212} 1071}
1213 1072
1214static int ll_link(struct dentry *old_dentry, struct inode *dir, 1073static int ll_link(struct dentry *old_dentry, struct inode *dir,
1215 struct dentry *new_dentry) 1074 struct dentry *new_dentry)
1216{ 1075{
1217 return ll_link_generic(old_dentry->d_inode, dir, &new_dentry->d_name, 1076 struct inode *src = old_dentry->d_inode;
1218 new_dentry); 1077 struct ll_sb_info *sbi = ll_i2sbi(dir);
1078 struct ptlrpc_request *request = NULL;
1079 struct md_op_data *op_data;
1080 int err;
1081
1082 CDEBUG(D_VFSTRACE,
1083 "VFS Op: inode=%lu/%u(%p), dir=%lu/%u(%p), target=%pd\n",
1084 src->i_ino, src->i_generation, src, dir->i_ino,
1085 dir->i_generation, dir, new_dentry);
1086
1087 op_data = ll_prep_md_op_data(NULL, src, dir, new_dentry->d_name.name,
1088 new_dentry->d_name.len,
1089 0, LUSTRE_OPC_ANY, NULL);
1090 if (IS_ERR(op_data))
1091 return PTR_ERR(op_data);
1092
1093 err = md_link(sbi->ll_md_exp, op_data, &request);
1094 ll_finish_md_op_data(op_data);
1095 if (err)
1096 goto out;
1097
1098 ll_update_times(request, dir);
1099 ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
1100out:
1101 ptlrpc_req_finished(request);
1102 return err;
1219} 1103}
1220 1104
1221static int ll_rename(struct inode *old_dir, struct dentry *old_dentry, 1105static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,
1222 struct inode *new_dir, struct dentry *new_dentry) 1106 struct inode *new_dir, struct dentry *new_dentry)
1223{ 1107{
1108 struct ptlrpc_request *request = NULL;
1109 struct ll_sb_info *sbi = ll_i2sbi(old_dir);
1110 struct md_op_data *op_data;
1224 int err; 1111 int err;
1225 err = ll_rename_generic(old_dir, NULL, 1112
1226 old_dentry, &old_dentry->d_name, 1113 CDEBUG(D_VFSTRACE,
1227 new_dir, NULL, new_dentry, 1114 "VFS Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,"
1228 &new_dentry->d_name); 1115 "tgt_dir=%lu/%u(%p)\n", old_dentry,
1116 old_dir->i_ino, old_dir->i_generation, old_dir, new_dentry,
1117 new_dir->i_ino, new_dir->i_generation, new_dir);
1118
1119 op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0,
1120 LUSTRE_OPC_ANY, NULL);
1121 if (IS_ERR(op_data))
1122 return PTR_ERR(op_data);
1123
1124 ll_get_child_fid(old_dentry, &op_data->op_fid3);
1125 ll_get_child_fid(new_dentry, &op_data->op_fid4);
1126 err = md_rename(sbi->ll_md_exp, op_data,
1127 old_dentry->d_name.name,
1128 old_dentry->d_name.len,
1129 new_dentry->d_name.name,
1130 new_dentry->d_name.len, &request);
1131 ll_finish_md_op_data(op_data);
1229 if (!err) { 1132 if (!err) {
1230 d_move(old_dentry, new_dentry); 1133 ll_update_times(request, old_dir);
1134 ll_update_times(request, new_dir);
1135 ll_stats_ops_tally(sbi, LPROC_LL_RENAME, 1);
1136 err = ll_objects_destroy(request, old_dir);
1231 } 1137 }
1138
1139 ptlrpc_req_finished(request);
1140 if (!err)
1141 d_move(old_dentry, new_dentry);
1232 return err; 1142 return err;
1233} 1143}
1234 1144
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 06b71bcf97a7..09d965e76842 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -969,8 +969,8 @@ static int ll_agl_thread(void *arg)
969 struct l_wait_info lwi = { 0 }; 969 struct l_wait_info lwi = { 0 };
970 970
971 thread->t_pid = current_pid(); 971 thread->t_pid = current_pid();
972 CDEBUG(D_READA, "agl thread started: sai %p, parent %.*s\n", 972 CDEBUG(D_READA, "agl thread started: sai %p, parent %pd\n",
973 sai, parent->d_name.len, parent->d_name.name); 973 sai, parent);
974 974
975 atomic_inc(&sbi->ll_agl_total); 975 atomic_inc(&sbi->ll_agl_total);
976 spin_lock(&plli->lli_agl_lock); 976 spin_lock(&plli->lli_agl_lock);
@@ -1019,8 +1019,8 @@ static int ll_agl_thread(void *arg)
1019 spin_unlock(&plli->lli_agl_lock); 1019 spin_unlock(&plli->lli_agl_lock);
1020 wake_up(&thread->t_ctl_waitq); 1020 wake_up(&thread->t_ctl_waitq);
1021 ll_sai_put(sai); 1021 ll_sai_put(sai);
1022 CDEBUG(D_READA, "agl thread stopped: sai %p, parent %.*s\n", 1022 CDEBUG(D_READA, "agl thread stopped: sai %p, parent %pd\n",
1023 sai, parent->d_name.len, parent->d_name.name); 1023 sai, parent);
1024 return 0; 1024 return 0;
1025} 1025}
1026 1026
@@ -1031,8 +1031,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
1031 struct ll_inode_info *plli; 1031 struct ll_inode_info *plli;
1032 struct task_struct *task; 1032 struct task_struct *task;
1033 1033
1034 CDEBUG(D_READA, "start agl thread: sai %p, parent %.*s\n", 1034 CDEBUG(D_READA, "start agl thread: sai %p, parent %pd\n",
1035 sai, parent->d_name.len, parent->d_name.name); 1035 sai, parent);
1036 1036
1037 plli = ll_i2info(parent->d_inode); 1037 plli = ll_i2info(parent->d_inode);
1038 task = kthread_run(ll_agl_thread, parent, 1038 task = kthread_run(ll_agl_thread, parent,
@@ -1066,8 +1066,8 @@ static int ll_statahead_thread(void *arg)
1066 struct l_wait_info lwi = { 0 }; 1066 struct l_wait_info lwi = { 0 };
1067 1067
1068 thread->t_pid = current_pid(); 1068 thread->t_pid = current_pid();
1069 CDEBUG(D_READA, "statahead thread starting: sai %p, parent %.*s\n", 1069 CDEBUG(D_READA, "statahead thread starting: sai %p, parent %pd\n",
1070 sai, parent->d_name.len, parent->d_name.name); 1070 sai, parent);
1071 1071
1072 if (sbi->ll_flags & LL_SBI_AGL_ENABLED) 1072 if (sbi->ll_flags & LL_SBI_AGL_ENABLED)
1073 ll_start_agl(parent, sai); 1073 ll_start_agl(parent, sai);
@@ -1288,8 +1288,8 @@ out:
1288 wake_up(&thread->t_ctl_waitq); 1288 wake_up(&thread->t_ctl_waitq);
1289 ll_sai_put(sai); 1289 ll_sai_put(sai);
1290 dput(parent); 1290 dput(parent);
1291 CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %.*s\n", 1291 CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %pd\n",
1292 sai, parent->d_name.len, parent->d_name.name); 1292 sai, parent);
1293 return rc; 1293 return rc;
1294} 1294}
1295 1295
@@ -1612,10 +1612,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
1612 } else if ((*dentryp)->d_inode != inode) { 1612 } else if ((*dentryp)->d_inode != inode) {
1613 /* revalidate, but inode is recreated */ 1613 /* revalidate, but inode is recreated */
1614 CDEBUG(D_READA, 1614 CDEBUG(D_READA,
1615 "stale dentry %.*s inode %lu/%u, " 1615 "stale dentry %pd inode %lu/%u, "
1616 "statahead inode %lu/%u\n", 1616 "statahead inode %lu/%u\n",
1617 (*dentryp)->d_name.len, 1617 *dentryp,
1618 (*dentryp)->d_name.name,
1619 (*dentryp)->d_inode->i_ino, 1618 (*dentryp)->d_inode->i_ino,
1620 (*dentryp)->d_inode->i_generation, 1619 (*dentryp)->d_inode->i_generation,
1621 inode->i_ino, 1620 inode->i_ino,
@@ -1666,9 +1665,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
1666 if (unlikely(sai->sai_inode != parent->d_inode)) { 1665 if (unlikely(sai->sai_inode != parent->d_inode)) {
1667 struct ll_inode_info *nlli = ll_i2info(parent->d_inode); 1666 struct ll_inode_info *nlli = ll_i2info(parent->d_inode);
1668 1667
1669 CWARN("Race condition, someone changed %.*s just now: " 1668 CWARN("Race condition, someone changed %pd just now: "
1670 "old parent "DFID", new parent "DFID"\n", 1669 "old parent "DFID", new parent "DFID"\n",
1671 (*dentryp)->d_name.len, (*dentryp)->d_name.name, 1670 *dentryp,
1672 PFID(&lli->lli_fid), PFID(&nlli->lli_fid)); 1671 PFID(&lli->lli_fid), PFID(&nlli->lli_fid));
1673 dput(parent); 1672 dput(parent);
1674 iput(sai->sai_inode); 1673 iput(sai->sai_inode);
@@ -1676,8 +1675,8 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
1676 goto out; 1675 goto out;
1677 } 1676 }
1678 1677
1679 CDEBUG(D_READA, "start statahead thread: sai %p, parent %.*s\n", 1678 CDEBUG(D_READA, "start statahead thread: sai %p, parent %pd\n",
1680 sai, parent->d_name.len, parent->d_name.name); 1679 sai, parent);
1681 1680
1682 /* The sai buffer already has one reference taken at allocation time, 1681 /* The sai buffer already has one reference taken at allocation time,
1683 * but as soon as we expose the sai by attaching it to the lli that 1682 * but as soon as we expose the sai by attaching it to the lli that
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c
index d3f967a78138..e540a6d286f8 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -108,7 +108,7 @@ static int vvp_io_fault_iter_init(const struct lu_env *env,
108 struct inode *inode = ccc_object_inode(ios->cis_obj); 108 struct inode *inode = ccc_object_inode(ios->cis_obj);
109 109
110 LASSERT(inode == 110 LASSERT(inode ==
111 cl2ccc_io(env, ios)->cui_fd->fd_file->f_dentry->d_inode); 111 file_inode(cl2ccc_io(env, ios)->cui_fd->fd_file));
112 vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime); 112 vio->u.fault.ft_mtime = LTIME_S(inode->i_mtime);
113 return 0; 113 return 0;
114} 114}
@@ -239,7 +239,7 @@ static int vvp_mmap_locks(const struct lu_env *env,
239 239
240 down_read(&mm->mmap_sem); 240 down_read(&mm->mmap_sem);
241 while ((vma = our_vma(mm, addr, count)) != NULL) { 241 while ((vma = our_vma(mm, addr, count)) != NULL) {
242 struct inode *inode = vma->vm_file->f_dentry->d_inode; 242 struct inode *inode = file_inode(vma->vm_file);
243 int flags = CEF_MUST; 243 int flags = CEF_MUST;
244 244
245 if (ll_file_nolock(vma->vm_file)) { 245 if (ll_file_nolock(vma->vm_file)) {
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 252a6194ed9b..3151baf5585c 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -241,14 +241,11 @@ int ll_setxattr(struct dentry *dentry, const char *name,
241 lump->lmm_stripe_offset = -1; 241 lump->lmm_stripe_offset = -1;
242 242
243 if (lump != NULL && S_ISREG(inode->i_mode)) { 243 if (lump != NULL && S_ISREG(inode->i_mode)) {
244 struct file f;
245 int flags = FMODE_WRITE; 244 int flags = FMODE_WRITE;
246 int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ? 245 int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
247 sizeof(*lump) : sizeof(struct lov_user_md_v3); 246 sizeof(*lump) : sizeof(struct lov_user_md_v3);
248 247
249 memset(&f, 0, sizeof(f)); /* f.f_flags is used below */ 248 rc = ll_lov_setstripe_ea_info(inode, dentry, flags, lump,
250 f.f_dentry = dentry;
251 rc = ll_lov_setstripe_ea_info(inode, &f, flags, lump,
252 lum_size); 249 lum_size);
253 /* b10667: rc always be 0 here for now */ 250 /* b10667: rc always be 0 here for now */
254 rc = 0; 251 rc = 0;
@@ -519,8 +516,8 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name,
519 } 516 }
520 517
521 if (size < lmmsize) { 518 if (size < lmmsize) {
522 CERROR("server bug: replied size %d > %d for %s (%s)\n", 519 CERROR("server bug: replied size %d > %d for %pd (%s)\n",
523 lmmsize, (int)size, dentry->d_name.name, name); 520 lmmsize, (int)size, dentry, name);
524 rc = -ERANGE; 521 rc = -ERANGE;
525 goto out; 522 goto out;
526 } 523 }