Skip to content

Commit 12e50a8

Browse files
Shweta Sodanigd
authored andcommitted
vfs_ceph_new: cleanup to async path
Signed-off-by: Shweta Sodani <ssodani@redhat.com> Reviewed-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Shachar Sharon <ssharon@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Thu Jul 17 23:13:36 UTC 2025 on atb-devel-224
1 parent 09c4460 commit 12e50a8

File tree

1 file changed

+48
-53
lines changed

1 file changed

+48
-53
lines changed

source3/modules/vfs_ceph_new.c

Lines changed: 48 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,17 +2459,16 @@ struct vfs_ceph_aio_state {
24592459
struct vfs_ceph_fh *cfh;
24602460
#if HAVE_CEPH_ASYNCIO
24612461
struct tevent_req *req;
2462-
bool orphaned;
24632462
struct tevent_immediate *im;
24642463
void *data;
2465-
size_t len;
2466-
off_t off;
2467-
bool write;
2468-
bool fsync;
2469-
24702464
struct ceph_ll_io_info io_info;
24712465
struct iovec iov;
2466+
bool orphaned;
2467+
bool write;
2468+
bool fsync;
24722469
#endif
2470+
size_t len;
2471+
off_t off;
24732472
struct timespec start_time;
24742473
struct timespec finish_time;
24752474
ssize_t result;
@@ -2628,32 +2627,6 @@ static void vfs_ceph_aio_done(struct tevent_context *ev,
26282627
tevent_req_done(req);
26292628
}
26302629

2631-
static ssize_t vfs_ceph_aio_recv(struct tevent_req *req,
2632-
struct vfs_aio_state *vfs_aio_state)
2633-
{
2634-
struct vfs_ceph_aio_state *state = tevent_req_data(
2635-
req, struct vfs_ceph_aio_state);
2636-
ssize_t res = -1;
2637-
2638-
DBG_DEBUG("[CEPH] aio_recv: ino=%" PRIu64
2639-
" fd=%d off=%jd len=%ju result=%ld\n",
2640-
state->cfh->iref.ino,
2641-
state->cfh->fd,
2642-
state->off,
2643-
state->len,
2644-
state->result);
2645-
2646-
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
2647-
goto out;
2648-
}
2649-
2650-
*vfs_aio_state = state->vfs_aio_state;
2651-
res = state->result;
2652-
out:
2653-
tevent_req_received(req);
2654-
return res;
2655-
}
2656-
26572630
#endif /* HAVE_CEPH_ASYNCIO */
26582631

26592632
static void vfs_ceph_aio_prepare(struct vfs_handle_struct *handle,
@@ -2761,21 +2734,29 @@ static ssize_t vfs_ceph_pread_recv(struct tevent_req *req,
27612734
{
27622735
struct vfs_ceph_aio_state *state = tevent_req_data(
27632736
req, struct vfs_ceph_aio_state);
2737+
ssize_t res = -1;
27642738

2765-
DBG_DEBUG("[CEPH] pread_recv: bytes_read=%zd\n", state->result);
2739+
DBG_DEBUG("[CEPH] pread_recv: bytes_read=%zd"
2740+
" ino=%" PRIu64
2741+
" fd=%d off=%jd len=%ju\n",
2742+
state->result,
2743+
state->cfh->iref.ino,
2744+
state->cfh->fd,
2745+
state->off,
2746+
state->len);
27662747

27672748
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
27682749
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes_x);
27692750

2770-
#if HAVE_CEPH_ASYNCIO
2771-
return vfs_ceph_aio_recv(req, vfs_aio_state);
2772-
#endif
27732751
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
2774-
return -1;
2752+
goto out;
27752753
}
27762754

27772755
*vfs_aio_state = state->vfs_aio_state;
2778-
return state->result;
2756+
res = state->result;
2757+
out:
2758+
tevent_req_received(req);
2759+
return res;
27792760
}
27802761

27812762
static ssize_t vfs_ceph_pwrite(struct vfs_handle_struct *handle,
@@ -2869,22 +2850,29 @@ static ssize_t vfs_ceph_pwrite_recv(struct tevent_req *req,
28692850
{
28702851
struct vfs_ceph_aio_state *state = tevent_req_data(
28712852
req, struct vfs_ceph_aio_state);
2853+
ssize_t res = -1;
28722854

2873-
DBG_DEBUG("[CEPH] pwrite_recv: bytes_written=%zd\n", state->result);
2855+
DBG_DEBUG("[CEPH] pwrite_recv: bytes_written=%zd"
2856+
" ino=%" PRIu64
2857+
" fd=%d off=%jd len=%ju\n",
2858+
state->result,
2859+
state->cfh->iref.ino,
2860+
state->cfh->fd,
2861+
state->off,
2862+
state->len);
28742863

28752864
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
28762865
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes_x);
28772866

2878-
#if HAVE_CEPH_ASYNCIO
2879-
return vfs_ceph_aio_recv(req, vfs_aio_state);
2880-
#endif
2881-
28822867
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
2883-
return -1;
2868+
goto out;
28842869
}
28852870

28862871
*vfs_aio_state = state->vfs_aio_state;
2887-
return state->result;
2872+
res = state->result;
2873+
out:
2874+
tevent_req_received(req);
2875+
return res;
28882876
}
28892877

28902878
static off_t vfs_ceph_lseek(struct vfs_handle_struct *handle,
@@ -3063,24 +3051,31 @@ static int vfs_ceph_fsync_recv(struct tevent_req *req,
30633051
{
30643052
struct vfs_ceph_aio_state *state = tevent_req_data(
30653053
req, struct vfs_ceph_aio_state);
3054+
ssize_t res = -1;
30663055

3067-
DBG_DEBUG("[CEPH] fsync_recv: error=%d duration=%" PRIu64 "\n",
3056+
DBG_DEBUG("[CEPH] fsync_recv: error=%d duration=%" PRIu64
3057+
" ino=%" PRIu64
3058+
" fd=%d off=%jd len=%ju result=%ld\n",
30683059
state->vfs_aio_state.error,
3069-
state->vfs_aio_state.duration);
3060+
state->vfs_aio_state.duration,
3061+
state->cfh->iref.ino,
3062+
state->cfh->fd,
3063+
state->off,
3064+
state->len,
3065+
state->result);
30703066

30713067
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
30723068
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes_x);
30733069

3074-
#if HAVE_CEPH_ASYNCIO
3075-
return vfs_ceph_aio_recv(req, vfs_aio_state);
3076-
#endif
3077-
30783070
if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
3079-
return -1;
3071+
goto out;
30803072
}
30813073

30823074
*vfs_aio_state = state->vfs_aio_state;
3083-
return 0;
3075+
res = state->result;
3076+
out:
3077+
tevent_req_received(req);
3078+
return res;
30843079
}
30853080

30863081
static int vfs_ceph_stat(struct vfs_handle_struct *handle,

0 commit comments

Comments
 (0)