[LU-8176] Add file_dentry and file_inode wrappers Created: 20/May/16  Updated: 05/Jul/16  Resolved: 28/Jun/16

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.9.0

Type: Improvement Priority: Minor
Reporter: Oleg Drokin Assignee: Yang Sheng
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Related
is related to LU-8352 Mellanox/OFED build breakage due to f... Resolved
Rank (Obsolete): 9223372036854775807

 Description   

When upstream kernel moved to file->f_path.dentry and friends, a couple of very convenient wrappers were added:
file_dentry(file) would return a dentry of the file
file_inode(file) would return inode of the file.

Using those instead of the huge monstrosity we have now is probably better, just need to create compat wrappers for code that does not have it yet.

static inline struct inode *file_inode(const struct file *f)
{       
        return f->f_inode;
}

static inline struct dentry *file_dentry(const struct file *file)
{       
        struct dentry *dentry = file->f_path.dentry;
        
        if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
                return dentry->d_op->d_real(dentry, file_inode(file));
        else    
                return dentry;
}


 Comments   
Comment by Joseph Gmitter (Inactive) [ 24/May/16 ]

Hi Yang Sheng,

Would you be able to look into this one?

Thanks.
Joe

Comment by Gerrit Updater [ 02/Jun/16 ]

Yang Sheng (yang.sheng@intel.com) uploaded a new patch: http://review.whamcloud.com/20576
Subject: LU-8176 libcfs: Add file_dentry&file_inode wrapper
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a9dbdfc2c350666cf0109dc8b537d086920612a5

Comment by Gerrit Updater [ 27/Jun/16 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/20576/
Subject: LU-8176 libcfs: Add file_dentry() & file_inode() wrapper
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b384b414d88de3cfa4966e731b46e85f62c8e438

Comment by Yang Sheng [ 28/Jun/16 ]

Patch landed, Close ticket.

Comment by Chris Horn [ 05/Jul/16 ]

This causes a build regression for us on SLES 11 SP3 against OFED 3.12-1 and OFED 3.18:

[  177s] In file included from /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/linux/libcfs.h:92,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/libcfs.h:43,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/lnet/klnds/gnilnd/gnilnd.h:67,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/lnet/klnds/gnilnd/gnilnd.c:25:
[  177s] /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/linux/linux-fs.h:66: error: conflicting types for 'backport_file_inode'
[  177s] /usr/src/kernel-modules-ofed/x86_64/cray_ari_s/include/linux/compat-3.12.h:16: error: previous definition of 'backport_file_inode' was here
[  177s] In file included from /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/linux/libcfs.h:92,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/libcfs.h:43,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/lnet/include/lnet/lib-lnet.h:48,
[  177s]                  from /usr/src/packages/BUILD/cray-lustre/lnet/lnet/api-ni.c:39:
[  177s] /usr/src/packages/BUILD/cray-lustre/libcfs/include/libcfs/linux/linux-fs.h:66: error: conflicting types for 'backport_file_inode'
[  177s] /usr/src/kernel-modules-ofed/x86_64/cray_ari_s/include/linux/compat-3.12.h:16: error: previous definition of 'backport_file_inode' was here
Comment by James A Simmons [ 05/Jul/16 ]

Chris their is a fix for this under ticket LU-8352.

Generated at Sat Feb 10 02:15:18 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.