Skip to content

Commit 062fb90

Browse files
author
Andreas Gruenbacher
committed
gfs2: Rename gfs2_lookup_{ simple => meta }
Function gfs2_lookup_simple() is used for looking up inodes in the metadata directory tree, so rename it to gfs2_lookup_meta() to closer match its purpose. Clean the function up a little on the way. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent be7f6a6 commit 062fb90

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

fs/gfs2/inode.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,18 @@ struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
265265
}
266266

267267

268-
struct inode *gfs2_lookup_simple(struct inode *dip, const char *name)
268+
/**
269+
* gfs2_lookup_meta - Look up an inode in a metadata directory
270+
* @dip: The directory
271+
* @name: The name of the inode
272+
*/
273+
struct inode *gfs2_lookup_meta(struct inode *dip, const char *name)
269274
{
270275
struct qstr qstr;
271276
struct inode *inode;
277+
272278
gfs2_str2qstr(&qstr, name);
273279
inode = gfs2_lookupi(dip, &qstr, 1);
274-
/* gfs2_lookupi has inconsistent callers: vfs
275-
* related routines expect NULL for no entry found,
276-
* gfs2_lookup_simple callers expect ENOENT
277-
* and do not check for NULL.
278-
*/
279280
if (IS_ERR_OR_NULL(inode))
280281
return inode ? inode : ERR_PTR(-ENOENT);
281282

fs/gfs2/inode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
9999
int is_root);
100100
extern int gfs2_permission(struct mnt_idmap *idmap,
101101
struct inode *inode, int mask);
102-
extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
102+
extern struct inode *gfs2_lookup_meta(struct inode *dip, const char *name);
103103
extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
104104
extern int gfs2_open_common(struct inode *inode, struct file *file);
105105
extern loff_t gfs2_seek_data(struct file *file, loff_t offset);

fs/gfs2/ops_fstype.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
647647
struct gfs2_jdesc *jd;
648648
struct gfs2_inode *ip;
649649

650-
sdp->sd_statfs_inode = gfs2_lookup_simple(master, "statfs");
650+
sdp->sd_statfs_inode = gfs2_lookup_meta(master, "statfs");
651651
if (IS_ERR(sdp->sd_statfs_inode)) {
652652
error = PTR_ERR(sdp->sd_statfs_inode);
653653
fs_err(sdp, "can't read in statfs inode: %d\n", error);
@@ -656,7 +656,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
656656
if (sdp->sd_args.ar_spectator)
657657
goto out;
658658

659-
pn = gfs2_lookup_simple(master, "per_node");
659+
pn = gfs2_lookup_meta(master, "per_node");
660660
if (IS_ERR(pn)) {
661661
error = PTR_ERR(pn);
662662
fs_err(sdp, "can't find per_node directory: %d\n", error);
@@ -673,7 +673,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
673673
goto free_local;
674674
}
675675
sprintf(buf, "statfs_change%u", jd->jd_jid);
676-
lsi->si_sc_inode = gfs2_lookup_simple(pn, buf);
676+
lsi->si_sc_inode = gfs2_lookup_meta(pn, buf);
677677
if (IS_ERR(lsi->si_sc_inode)) {
678678
error = PTR_ERR(lsi->si_sc_inode);
679679
fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
@@ -738,7 +738,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
738738
if (undo)
739739
goto fail_statfs;
740740

741-
sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
741+
sdp->sd_jindex = gfs2_lookup_meta(master, "jindex");
742742
if (IS_ERR(sdp->sd_jindex)) {
743743
fs_err(sdp, "can't lookup journal index: %d\n", error);
744744
return PTR_ERR(sdp->sd_jindex);
@@ -887,7 +887,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
887887
goto fail;
888888

889889
/* Read in the resource index inode */
890-
sdp->sd_rindex = gfs2_lookup_simple(master, "rindex");
890+
sdp->sd_rindex = gfs2_lookup_meta(master, "rindex");
891891
if (IS_ERR(sdp->sd_rindex)) {
892892
error = PTR_ERR(sdp->sd_rindex);
893893
fs_err(sdp, "can't get resource index inode: %d\n", error);
@@ -896,7 +896,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
896896
sdp->sd_rindex_uptodate = 0;
897897

898898
/* Read in the quota inode */
899-
sdp->sd_quota_inode = gfs2_lookup_simple(master, "quota");
899+
sdp->sd_quota_inode = gfs2_lookup_meta(master, "quota");
900900
if (IS_ERR(sdp->sd_quota_inode)) {
901901
error = PTR_ERR(sdp->sd_quota_inode);
902902
fs_err(sdp, "can't get quota file inode: %d\n", error);
@@ -940,15 +940,15 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
940940
if (undo)
941941
goto fail_qc_gh;
942942

943-
pn = gfs2_lookup_simple(master, "per_node");
943+
pn = gfs2_lookup_meta(master, "per_node");
944944
if (IS_ERR(pn)) {
945945
error = PTR_ERR(pn);
946946
fs_err(sdp, "can't find per_node directory: %d\n", error);
947947
return error;
948948
}
949949

950950
sprintf(buf, "quota_change%u", sdp->sd_jdesc->jd_jid);
951-
sdp->sd_qc_inode = gfs2_lookup_simple(pn, buf);
951+
sdp->sd_qc_inode = gfs2_lookup_meta(pn, buf);
952952
if (IS_ERR(sdp->sd_qc_inode)) {
953953
error = PTR_ERR(sdp->sd_qc_inode);
954954
fs_err(sdp, "can't find local \"qc\" file: %d\n", error);

0 commit comments

Comments
 (0)