Whamcloud - gitweb
LU-6142 lustre: convert IFTODT to S_DT 41/40641/3
authorMr NeilBrown <neilb@suse.de>
Thu, 12 Nov 2020 23:01:06 +0000 (10:01 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 6 Apr 2021 03:01:59 +0000 (03:01 +0000)
In Linux v5.1-rc1~141^2~1 introduced include/linux/fs_types.h which
adds macros for manipulating file types, including S_DT() which
does what the userpsace IFTODT() macro does.

So change kernel code to use S_DT() instead of IFTODT(), and provide
definitions for kernels which don't yet have this file.

fs_types.h is included by fs.h, so we don't need to explicitly include
it anywhere.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: If001f7e7a97992af690222b7524770c5e4b7003d
Reviewed-on: https://review.whamcloud.com/40641
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/scripts/libcfs_cleanup.sed
libcfs/include/libcfs/linux/linux-fs.h
lustre/llite/dir.c
lustre/osd-zfs/osd_index.c
lustre/osd-zfs/osd_object.c
lustre/osd-zfs/osd_oi.c

index 0d605b8..fb6e160 100644 (file)
@@ -254,9 +254,6 @@ s/\b[cfs_]*flock_set_start(\([^,]*\), \([^)]*\))\b/\1->fl_start = \2/g
 s/\b[cfs_]*flock_end(\([^)]*\))\b/\1->fl_end/g
 s/\b[cfs_]*flock_set_end(\([^,]*\), \([^)]*\))\b/\1->fl_end = \2/g
 s/\bcfs_user_write\b/user_write/g
 s/\b[cfs_]*flock_end(\([^)]*\))\b/\1->fl_end/g
 s/\b[cfs_]*flock_set_end(\([^,]*\), \([^)]*\))\b/\1->fl_end = \2/g
 s/\bcfs_user_write\b/user_write/g
-s/\bCFS_IFSHIFT\b/IFSHIFT/g
-s/\bCFS_IFTODT\b/IFTODT/g
-s/\bCFS_DTTOIF\b/DTTOIF/g
 
 ################################################################################
 # memory operations
 
 ################################################################################
 # memory operations
index 13c2e50..a5beff2 100644 (file)
@@ -49,15 +49,15 @@ static inline struct dentry *file_dentry(const struct file *file)
 }
 #endif
 
 }
 #endif
 
-#ifndef IFSHIFT
-#define IFSHIFT                        12
+#ifndef S_DT_SHIFT
+#define S_DT_SHIFT             12
 #endif
 
 #endif
 
-#ifndef IFTODT
-#define IFTODT(type)           (((type) & S_IFMT) >> IFSHIFT)
+#ifndef S_DT
+#define S_DT(type)             (((type) & S_IFMT) >> S_DT_SHIFT)
 #endif
 #ifndef DTTOIF
 #endif
 #ifndef DTTOIF
-#define DTTOIF(dirtype)                ((dirtype) << IFSHIFT)
+#define DTTOIF(dirtype)                ((dirtype) << S_DT_SHIFT)
 #endif
 
 #endif
 #endif
 
 #endif
index 2d631d9..73444a7 100644 (file)
@@ -233,7 +233,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                                lhash = hash;
                        fid_le_to_cpu(&fid, &ent->lde_fid);
                        ino = cl_fid_build_ino(&fid, is_api32);
                                lhash = hash;
                        fid_le_to_cpu(&fid, &ent->lde_fid);
                        ino = cl_fid_build_ino(&fid, is_api32);
-                       type = IFTODT(lu_dirent_type_get(ent));
+                       type = S_DT(lu_dirent_type_get(ent));
                        /* For ll_nfs_get_name_filldir(), it will try to access
                         * 'ent' through 'lde_name', so the parameter 'name'
                         * for 'filldir()' must be part of the 'ent'. */
                        /* For ll_nfs_get_name_filldir(), it will try to access
                         * 'ent' through 'lde_name', so the parameter 'name'
                         * for 'filldir()' must be part of the 'ent'. */
index 75cbec8..9116cba 100644 (file)
@@ -815,7 +815,7 @@ int osd_add_to_remote_parent(const struct lu_env *env,
 
        osd_fid2str(name, fid, sizeof(info->oti_str));
        zde->lzd_reg.zde_dnode = obj->oo_dn->dn_object;
 
        osd_fid2str(name, fid, sizeof(info->oti_str));
        zde->lzd_reg.zde_dnode = obj->oo_dn->dn_object;
-       zde->lzd_reg.zde_type = IFTODT(S_IFDIR);
+       zde->lzd_reg.zde_type = S_DT(S_IFDIR);
        zde->lzd_fid = *fid;
 
        rc = osd_zap_add(osd, osd->od_remote_parent_dir, NULL,
        zde->lzd_fid = *fid;
 
        rc = osd_zap_add(osd, osd->od_remote_parent_dir, NULL,
@@ -1042,7 +1042,7 @@ static int osd_dir_insert(const struct lu_env *env, struct dt_object *dt,
        BUILD_BUG_ON(sizeof(*zde) % 8 != 0);
 
        memset(&zde->lzd_reg, 0, sizeof(zde->lzd_reg));
        BUILD_BUG_ON(sizeof(*zde) % 8 != 0);
 
        memset(&zde->lzd_reg, 0, sizeof(zde->lzd_reg));
-       zde->lzd_reg.zde_type = IFTODT(rec1->rec_type & S_IFMT);
+       zde->lzd_reg.zde_type = S_DT(rec1->rec_type & S_IFMT);
        zde->lzd_fid = *fid;
 
        if (idc->oic_remote) {
        zde->lzd_fid = *fid;
 
        if (idc->oic_remote) {
@@ -1502,7 +1502,7 @@ static int osd_dir_it_rec(const struct lu_env *env, const struct dt_it *di,
                              lu_object_fid(&it->ozi_obj->oo_dt.do_lu));
                lde->lde_attrs = LUDA_FID;
                /* append lustre attributes */
                              lu_object_fid(&it->ozi_obj->oo_dt.do_lu));
                lde->lde_attrs = LUDA_FID;
                /* append lustre attributes */
-               osd_it_append_attrs(lde, attr, 1, IFTODT(S_IFDIR));
+               osd_it_append_attrs(lde, attr, 1, S_DT(S_IFDIR));
                lde->lde_reclen = cpu_to_le16(lu_dirent_calc_size(1, attr));
                it->ozi_pos = OZI_POS_DOT;
                RETURN(0);
                lde->lde_reclen = cpu_to_le16(lu_dirent_calc_size(1, attr));
                it->ozi_pos = OZI_POS_DOT;
                RETURN(0);
@@ -1521,7 +1521,7 @@ static int osd_dir_it_rec(const struct lu_env *env, const struct dt_it *di,
                }
 
                /* append lustre attributes */
                }
 
                /* append lustre attributes */
-               osd_it_append_attrs(lde, attr, 2, IFTODT(S_IFDIR));
+               osd_it_append_attrs(lde, attr, 2, S_DT(S_IFDIR));
                lde->lde_reclen = cpu_to_le16(lu_dirent_calc_size(2, attr));
                RETURN(0);
        }
                lde->lde_reclen = cpu_to_le16(lu_dirent_calc_size(2, attr));
                RETURN(0);
        }
index 7df429e..9817cc5 100644 (file)
@@ -1972,7 +1972,7 @@ static int osd_create(const struct lu_env *env, struct dt_object *dt,
 
        zde->zde_pad = 0;
        zde->zde_dnode = dn->dn_object;
 
        zde->zde_pad = 0;
        zde->zde_dnode = dn->dn_object;
-       zde->zde_type = IFTODT(attr->la_mode & S_IFMT);
+       zde->zde_type = S_DT(attr->la_mode & S_IFMT);
 
        zapid = osd_get_name_n_idx(env, osd, fid, buf,
                                   sizeof(info->oti_str), &zdn);
 
        zapid = osd_get_name_n_idx(env, osd, fid, buf,
                                   sizeof(info->oti_str), &zdn);
index 5a21b3f..af618f0 100644 (file)
@@ -211,7 +211,7 @@ static int osd_obj_create(const struct lu_env *env, struct osd_device *o,
 
        zde->zde_dnode = oid;
        zde->zde_pad = 0;
 
        zde->zde_dnode = oid;
        zde->zde_pad = 0;
-       zde->zde_type = IFTODT(isdir ? S_IFDIR : S_IFREG);
+       zde->zde_type = S_DT(isdir ? S_IFDIR : S_IFREG);
        rc = -zap_add(o->od_os, parent, name, 8, 1, (void *)zde, tx);
 
        GOTO(commit, rc);
        rc = -zap_add(o->od_os, parent, name, 8, 1, (void *)zde, tx);
 
        GOTO(commit, rc);