8 Star 0 Fork 5

src-anolis-os/glusterfs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0522-lcov-improve-line-coverage.patch 21.05 KB
一键复制 编辑 原始数据 按行查看 历史
renbo02 提交于 2021-12-27 14:44 . update to glusterfs-6.0-56.4.el8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
From 46e2bbd52d4427c1348fa38dcb5d2b5f125555f1 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <[email protected]>
Date: Thu, 30 May 2019 15:25:01 +0530
Subject: [PATCH 522/526] lcov: improve line coverage
upcall: remove extra variable assignment and use just one
initialization.
open-behind: reduce the overall number of lines, in functions
not frequently called
selinux: reduce some lines in init failure cases
Upstream patch:
> Upstream-patch-link: https://review.gluster.org/#/c/glusterfs/+/22789
> updates: bz#1693692
> Change-Id: I7c1de94f2ec76a5bfe1f48a9632879b18e5fbb95
> Signed-off-by: Amar Tumballi <[email protected]>
BUG: 1830713
Change-Id: I7c1de94f2ec76a5bfe1f48a9632879b18e5fbb95
Signed-off-by: Amar Tumballi <[email protected]>
Reviewed-on: https://code.engineering.redhat.com/gerrit/224486
Tested-by: RHGS Build Bot <[email protected]>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <[email protected]>
---
xlators/features/selinux/src/selinux.c | 6 +-
xlators/features/upcall/src/upcall.c | 108 +++++++---------------
xlators/performance/open-behind/src/open-behind.c | 58 ++++--------
3 files changed, 55 insertions(+), 117 deletions(-)
diff --git a/xlators/features/selinux/src/selinux.c b/xlators/features/selinux/src/selinux.c
index 58b4c5d..e8e16cd 100644
--- a/xlators/features/selinux/src/selinux.c
+++ b/xlators/features/selinux/src/selinux.c
@@ -234,7 +234,6 @@ init(xlator_t *this)
priv = GF_CALLOC(1, sizeof(*priv), gf_selinux_mt_selinux_priv_t);
if (!priv) {
gf_log(this->name, GF_LOG_ERROR, "out of memory");
- ret = ENOMEM;
goto out;
}
@@ -242,7 +241,6 @@ init(xlator_t *this)
this->local_pool = mem_pool_new(selinux_priv_t, 64);
if (!this->local_pool) {
- ret = -1;
gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SL_MSG_ENOMEM,
"Failed to create local_t's memory pool");
goto out;
@@ -252,9 +250,7 @@ init(xlator_t *this)
ret = 0;
out:
if (ret) {
- if (priv) {
- GF_FREE(priv);
- }
+ GF_FREE(priv);
mem_pool_destroy(this->local_pool);
}
return ret;
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index 2583c50..0795f58 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -57,14 +57,13 @@ static int32_t
up_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -111,14 +110,13 @@ up_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
int count, off_t off, uint32_t flags, struct iobref *iobref,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -167,14 +165,13 @@ static int32_t
up_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, uint32_t flags, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -220,14 +217,13 @@ static int32_t
up_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
struct gf_flock *flock, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -274,14 +270,13 @@ static int32_t
up_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -343,14 +338,13 @@ static int32_t
up_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf,
int32_t valid, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -410,14 +404,13 @@ static int32_t
up_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, newloc, NULL, oldloc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -472,14 +465,13 @@ static int32_t
up_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -531,14 +523,13 @@ static int32_t
up_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, newloc, NULL, oldloc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -592,14 +583,13 @@ static int32_t
up_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -653,14 +643,13 @@ static int32_t
up_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
mode_t umask, dict_t *params)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -717,15 +706,13 @@ static int32_t
up_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
mode_t mode, mode_t umask, fd_t *fd, dict_t *params)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
-
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -774,14 +761,13 @@ out:
static int32_t
up_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -826,14 +812,13 @@ out:
static int32_t
up_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -852,14 +837,13 @@ err:
static int32_t
up_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -879,14 +863,13 @@ static int32_t
up_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -932,14 +915,13 @@ static int32_t
up_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -986,14 +968,13 @@ static int32_t
up_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1047,14 +1028,13 @@ static int32_t
up_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dev_t rdev, mode_t umask, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1110,14 +1090,13 @@ static int32_t
up_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
loc_t *loc, mode_t umask, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1164,14 +1143,13 @@ static int32_t
up_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1216,14 +1194,13 @@ out:
static int32_t
up_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1270,14 +1247,13 @@ static int32_t
up_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t off, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1334,14 +1310,13 @@ static int32_t
up_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t off, dict_t *dict)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1361,14 +1336,13 @@ static int32_t
up_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
int32_t valid, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1415,14 +1389,13 @@ static int32_t
up_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
off_t offset, size_t len, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1470,14 +1443,13 @@ static int32_t
up_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
size_t len, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1524,14 +1496,13 @@ static int
up_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
off_t len, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1577,14 +1548,13 @@ static int32_t
up_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
gf_seek_what_t what, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1652,14 +1622,13 @@ static int32_t
up_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
int32_t flags, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, loc, NULL, loc->inode, dict);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1727,14 +1696,13 @@ static int32_t
up_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
int32_t flags, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, fd, fd->inode, dict);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1800,7 +1768,7 @@ static int32_t
up_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
dict_t *xattr = NULL;
@@ -1808,13 +1776,11 @@ up_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
xattr = dict_for_key_value(name, "", 1, _gf_true);
if (!xattr) {
- op_errno = ENOMEM;
goto err;
}
local = upcall_local_init(frame, this, NULL, fd, fd->inode, xattr);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1885,7 +1851,7 @@ static int32_t
up_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
dict_t *xattr = NULL;
@@ -1893,13 +1859,11 @@ up_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
xattr = dict_for_key_value(name, "", 1, _gf_true);
if (!xattr) {
- op_errno = ENOMEM;
goto err;
}
local = upcall_local_init(frame, this, loc, NULL, loc->inode, xattr);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -1950,14 +1914,13 @@ static int32_t
up_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
@@ -2000,14 +1963,13 @@ static int32_t
up_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
dict_t *xdata)
{
- int32_t op_errno = -1;
+ int32_t op_errno = ENOMEM;
upcall_local_t *local = NULL;
EXIT_IF_UPCALL_OFF(this, out);
local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
if (!local) {
- op_errno = ENOMEM;
goto err;
}
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
index dd2f2fd..cbe89ec 100644
--- a/xlators/performance/open-behind/src/open-behind.c
+++ b/xlators/performance/open-behind/src/open-behind.c
@@ -581,7 +581,7 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
{
fd_t *old_fd = NULL;
int ret = -1;
- int op_errno = 0;
+ int op_errno = ENOMEM;
call_stub_t *stub = NULL;
old_fd = fd_lookup(fd->inode, 0);
@@ -589,7 +589,6 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
/* open-behind only when this is the first FD */
stub = fop_open_stub(frame, default_open_resume, loc, flags, fd, xdata);
if (!stub) {
- op_errno = ENOMEM;
fd_unref(old_fd);
goto err;
}
@@ -603,7 +602,6 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
ret = ob_open_behind(frame, this, loc, flags, fd, xdata);
if (ret) {
- op_errno = ENOMEM;
goto err;
}
@@ -900,18 +898,12 @@ int
ob_finodelk(call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd,
int cmd, struct gf_flock *flock, dict_t *xdata)
{
- call_stub_t *stub = NULL;
-
- stub = fop_finodelk_stub(frame, default_finodelk_resume, volume, fd, cmd,
- flock, xdata);
- if (!stub)
- goto err;
-
- open_and_resume(this, fd, stub);
-
- return 0;
-err:
- STACK_UNWIND_STRICT(finodelk, frame, -1, ENOMEM, 0);
+ call_stub_t *stub = fop_finodelk_stub(frame, default_finodelk_resume,
+ volume, fd, cmd, flock, xdata);
+ if (stub)
+ open_and_resume(this, fd, stub);
+ else
+ STACK_UNWIND_STRICT(finodelk, frame, -1, ENOMEM, 0);
return 0;
}
@@ -921,18 +913,12 @@ ob_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd,
const char *basename, entrylk_cmd cmd, entrylk_type type,
dict_t *xdata)
{
- call_stub_t *stub = NULL;
-
- stub = fop_fentrylk_stub(frame, default_fentrylk_resume, volume, fd,
- basename, cmd, type, xdata);
- if (!stub)
- goto err;
-
- open_and_resume(this, fd, stub);
-
- return 0;
-err:
- STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOMEM, 0);
+ call_stub_t *stub = fop_fentrylk_stub(
+ frame, default_fentrylk_resume, volume, fd, basename, cmd, type, xdata);
+ if (stub)
+ open_and_resume(this, fd, stub);
+ else
+ STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOMEM, 0);
return 0;
}
@@ -941,18 +927,12 @@ int
ob_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
{
- call_stub_t *stub = NULL;
-
- stub = fop_fxattrop_stub(frame, default_fxattrop_resume, fd, optype, xattr,
- xdata);
- if (!stub)
- goto err;
-
- open_and_resume(this, fd, stub);
-
- return 0;
-err:
- STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOMEM, 0, 0);
+ call_stub_t *stub = fop_fxattrop_stub(frame, default_fxattrop_resume, fd,
+ optype, xattr, xdata);
+ if (stub)
+ open_and_resume(this, fd, stub);
+ else
+ STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOMEM, 0, 0);
return 0;
}
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/glusterfs.git
[email protected]:src-anolis-os/glusterfs.git
src-anolis-os
glusterfs
glusterfs
a8

搜索帮助