1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00

vfs_ceph_new: use low-level APIs for lseek

Implement lseek operation using libcephfs' low-level APIs. Requires
open ceph Fh* associated with fsp (extension).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15686

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
(cherry picked from commit 30c1a613fe)
This commit is contained in:
Shachar Sharon 2024-06-20 12:23:03 +03:00 committed by Stefan Metzmacher
parent ddb5fcb2fa
commit f429baca5c

View File

@ -907,6 +907,14 @@ static int vfs_ceph_ll_write(const struct vfs_handle_struct *handle,
return ceph_ll_write(cmount_of(handle), cfh->fh, off, len, data);
}
static off_t vfs_ceph_ll_lseek(const struct vfs_handle_struct *handle,
const struct vfs_ceph_fh *cfh,
off_t offset,
int whence)
{
return ceph_ll_lseek(cmount_of(handle), cfh->fh, offset, whence);
}
/* Ceph Inode-refernce get/put wrappers */
static int vfs_ceph_iget(const struct vfs_handle_struct *handle,
uint64_t ino,
@ -1475,13 +1483,17 @@ static off_t vfs_ceph_lseek(struct vfs_handle_struct *handle,
off_t offset,
int whence)
{
off_t result = 0;
struct vfs_ceph_fh *cfh = NULL;
intmax_t result = 0;
DBG_DEBUG("[CEPH] vfs_ceph_lseek\n");
result = ceph_lseek(cmount_of(handle),
fsp_get_io_fd(fsp),
offset,
whence);
result = vfs_ceph_fetch_io_fh(handle, fsp, &cfh);
if (result != 0) {
goto out;
}
result = vfs_ceph_ll_lseek(handle, cfh, offset, whence);
out:
return lstatus_code(result);
}