From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/6] libgfs2: Remove lgfs2_gfs_createi()
Date: Mon, 30 Jan 2023 15:21:42 +0000 [thread overview]
Message-ID: <20230130152146.633484-3-anprice@redhat.com> (raw)
In-Reply-To: <20230130152146.633484-1-anprice@redhat.com>
The one caller sets sdp->gfs1 and modifies the mode itself so we can use
sdp->gfs1 in __createi() and update the caller to use lgfs2_createi()
instead.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/fsck/lost_n_found.c | 6 +-----
gfs2/libgfs2/fs_ops.c | 19 ++++++-------------
gfs2/libgfs2/libgfs2.h | 3 ---
3 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index ca5ab89e..97fc16b0 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -109,11 +109,7 @@ void make_sure_lf_exists(struct fsck_cx *cx, struct lgfs2_inode *ip)
if (sdp->gfs1)
sdp->md.next_inum = find_free_blk(sdp);
mode = (sdp->gfs1 ? DT2IF(GFS_FILE_DIR) : S_IFDIR) | 0700;
- if (sdp->gfs1)
- lf_dip = lgfs2_gfs_createi(sdp->md.rooti, "lost+found", mode, 0);
- else
- lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found",
- S_IFDIR | 0700, 0);
+ lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found", mode, 0);
if (lf_dip == NULL) {
log_crit(_("Error creating lost+found: %s\n"),
strerror(errno));
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index e72871ed..5003c1ae 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1497,9 +1497,8 @@ int lgfs2_write_filemeta(struct lgfs2_inode *ip)
return 0;
}
-static struct lgfs2_inode *__createi(struct lgfs2_inode *dip,
- const char *filename, unsigned int mode,
- uint32_t flags, int if_gfs1)
+static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, const char *filename,
+ unsigned int mode, uint32_t flags)
{
struct lgfs2_sbd *sdp = dip->i_sbd;
uint64_t bn;
@@ -1517,7 +1516,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip,
if (err != 0)
return NULL;
- if (if_gfs1)
+ if (sdp->gfs1)
inum.in_formal_ino = bn;
else
inum.in_formal_ino = sdp->md.next_inum++;
@@ -1527,7 +1526,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip,
if (err)
return NULL;
- if (if_gfs1)
+ if (sdp->gfs1)
is_dir = (IF2DT(mode) == GFS_FILE_DIR);
else
is_dir = S_ISDIR(mode);
@@ -1536,7 +1535,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip,
dip->i_nlink++;
}
- err = __init_dinode(sdp, &bh, &inum, mode, flags, &parent, if_gfs1);
+ err = __init_dinode(sdp, &bh, &inum, mode, flags, &parent, sdp->gfs1);
if (err != 0)
return NULL;
@@ -1552,13 +1551,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip,
struct lgfs2_inode *lgfs2_createi(struct lgfs2_inode *dip, const char *filename,
unsigned int mode, uint32_t flags)
{
- return __createi(dip, filename, mode, flags, 0);
-}
-
-struct lgfs2_inode *lgfs2_gfs_createi(struct lgfs2_inode *dip, const char *filename,
- unsigned int mode, uint32_t flags)
-{
- return __createi(dip, filename, mode, flags, 1);
+ return __createi(dip, filename, mode, flags);
}
/**
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index bcbc5e47..69a7552f 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -515,9 +515,6 @@ extern int lgfs2_init_dinode(struct lgfs2_sbd *sdp, struct lgfs2_buffer_head **b
unsigned int mode, uint32_t flags, struct lgfs2_inum *parent);
extern struct lgfs2_inode *lgfs2_createi(struct lgfs2_inode *dip, const char *filename,
unsigned int mode, uint32_t flags);
-extern struct lgfs2_inode *lgfs2_gfs_createi(struct lgfs2_inode *dip,
- const char *filename, unsigned int mode,
- uint32_t flags);
extern void lgfs2_dirent2_del(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
struct gfs2_dirent *prev, struct gfs2_dirent *cur);
extern int lgfs2_dir_search(struct lgfs2_inode *dip, const char *filename, int len,
--
2.39.0
next prev parent reply other threads:[~2023-01-30 15:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 15:21 [Cluster-devel] [PATCH 0/6] gfs2-utils: Cleanups and fsck.gfs2 fixes Andrew Price
2023-01-30 15:21 ` [Cluster-devel] [PATCH 1/6] libgfs2: Return the inode from lgfs2_lookupi() Andrew Price
2023-01-30 15:21 ` Andrew Price [this message]
2023-01-30 15:21 ` [Cluster-devel] [PATCH 3/6] libgfs2: Reorganise lgfs2_createi() Andrew Price
2023-01-30 15:21 ` [Cluster-devel] [PATCH 4/6] fsck.gfs2: Remove de variable from dirref_find() Andrew Price
2023-01-30 15:21 ` [Cluster-devel] [PATCH 5/6] fsck.gfs2: Fix wrong entry used in dentry comparison Andrew Price
2023-01-30 15:21 ` [Cluster-devel] [PATCH 6/6] fsck.gfs2: fix_hashtable: Decrement i_blocks when freeing leaf blocks Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230130152146.633484-3-anprice@redhat.com \
--to=anprice@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).