From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Mikhail Pershin <mpershin@whamcloud.com>,
Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 03/15] lustre: mdt: implement fallocate in MDC/MDT
Date: Sun, 22 Aug 2021 22:27:34 -0400 [thread overview]
Message-ID: <1629685666-4533-4-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1629685666-4533-1-git-send-email-jsimmons@infradead.org>
From: Mikhail Pershin <mpershin@whamcloud.com>
- add CLIO fallocate() handling in MDC
- implement FALLOCATE RPC handling at MDT side
- update test group 150 in sanity to work with
sanity-dom.sh test
WC-bug-id: https://jira.whamcloud.com/browse/LU-14382
Lustre-commit: 163870abfb7c3fe3 ("LU-14382 mdt: implement fallocate in MDC/MDT")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41418
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/include/lustre_osc.h | 4 ++++
fs/lustre/mdc/mdc_dev.c | 29 ++++++++++++++++++++---------
fs/lustre/osc/osc_io.c | 5 +++--
fs/lustre/osc/osc_request.c | 3 ++-
4 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/fs/lustre/include/lustre_osc.h b/fs/lustre/include/lustre_osc.h
index 8a62eb2..09868ea 100644
--- a/fs/lustre/include/lustre_osc.h
+++ b/fs/lustre/include/lustre_osc.h
@@ -678,6 +678,8 @@ int osc_reconnect(const struct lu_env *env, struct obd_export *exp,
int osc_disconnect(struct obd_export *exp);
int osc_punch_send(struct obd_export *exp, struct obdo *oa,
obd_enqueue_update_f upcall, void *cookie);
+int osc_fallocate_base(struct obd_export *exp, struct obdo *oa,
+ obd_enqueue_update_f upcall, void *cookie, int mode);
/* osc_io.c */
int osc_io_submit(const struct lu_env *env, const struct cl_io_slice *ios,
@@ -712,6 +714,8 @@ void osc_io_lseek_end(const struct lu_env *env,
const struct cl_io_slice *slice);
int osc_io_lru_reserve(const struct lu_env *env, const struct cl_io_slice *ios,
loff_t pos, size_t count);
+int osc_punch_start(const struct lu_env *env, struct cl_io *io,
+ struct cl_object *obj);
/* osc_lock.c */
void osc_lock_to_lockless(const struct lu_env *env, struct osc_lock *ols,
diff --git a/fs/lustre/mdc/mdc_dev.c b/fs/lustre/mdc/mdc_dev.c
index ce4148d..4777b47 100644
--- a/fs/lustre/mdc/mdc_dev.c
+++ b/fs/lustre/mdc/mdc_dev.c
@@ -35,6 +35,7 @@
#include <obd_class.h>
#include <lustre_osc.h>
+#include <linux/falloc.h>
#include <uapi/linux/lustre/lustre_param.h>
#include "mdc_internal.h"
@@ -1035,11 +1036,13 @@ static int mdc_io_setattr_start(const struct lu_env *env,
&oio->oi_trunc);
if (rc < 0)
return rc;
+ } else if (cl_io_is_fallocate(io) &&
+ io->u.ci_setattr.sa_falloc_mode & FALLOC_FL_PUNCH_HOLE) {
+ rc = osc_punch_start(env, io, obj);
+ if (rc < 0)
+ return rc;
}
- if (cl_io_is_fallocate(io))
- return -EOPNOTSUPP;
-
if (oio->oi_lockless == 0) {
cl_object_attr_lock(obj);
rc = cl_object_attr_get(env, obj, attr);
@@ -1070,7 +1073,7 @@ static int mdc_io_setattr_start(const struct lu_env *env,
return rc;
}
- if (!(ia_valid & ATTR_SIZE))
+ if (!(ia_valid & ATTR_SIZE) && !cl_io_is_fallocate(io))
return 0;
memset(oa, 0, sizeof(*oa));
@@ -1078,12 +1081,10 @@ static int mdc_io_setattr_start(const struct lu_env *env,
oa->o_mtime = attr->cat_mtime;
oa->o_atime = attr->cat_atime;
oa->o_ctime = attr->cat_ctime;
-
- oa->o_size = size;
- oa->o_blocks = OBD_OBJECT_EOF;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
OBD_MD_FLCTIME | OBD_MD_FLMTIME | OBD_MD_FLSIZE |
OBD_MD_FLBLOCKS;
+
if (oio->oi_lockless) {
oa->o_flags = OBD_FL_SRVLOCK;
oa->o_valid |= OBD_MD_FLFLAGS;
@@ -1095,9 +1096,19 @@ static int mdc_io_setattr_start(const struct lu_env *env,
}
init_completion(&cbargs->opc_sync);
+ if (cl_io_is_fallocate(io)) {
+ int falloc_mode = io->u.ci_setattr.sa_falloc_mode;
- rc = osc_punch_send(osc_export(cl2osc(obj)), oa,
- mdc_async_upcall, cbargs);
+ oa->o_size = io->u.ci_setattr.sa_falloc_offset;
+ oa->o_blocks = io->u.ci_setattr.sa_falloc_end;
+ rc = osc_fallocate_base(osc_export(cl2osc(obj)), oa,
+ mdc_async_upcall, cbargs, falloc_mode);
+ } else {
+ oa->o_size = size;
+ oa->o_blocks = OBD_OBJECT_EOF;
+ rc = osc_punch_send(osc_export(cl2osc(obj)), oa,
+ mdc_async_upcall, cbargs);
+ }
cbargs->opc_rpc_sent = rc == 0;
return rc;
}
diff --git a/fs/lustre/osc/osc_io.c b/fs/lustre/osc/osc_io.c
index 047ae00..d828ae0 100644
--- a/fs/lustre/osc/osc_io.c
+++ b/fs/lustre/osc/osc_io.c
@@ -548,8 +548,8 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
* if server doesn't support fallocate punch, we also need these data to be
* flushed first to prevent re-ordering with the punch
*/
-static int osc_punch_start(const struct lu_env *env, struct cl_io *io,
- struct cl_object *obj)
+int osc_punch_start(const struct lu_env *env, struct cl_io *io,
+ struct cl_object *obj)
{
struct osc_object *osc = cl2osc(obj);
pgoff_t pg_start = cl_index(obj, io->u.ci_setattr.sa_falloc_offset);
@@ -564,6 +564,7 @@ static int osc_punch_start(const struct lu_env *env, struct cl_io *io,
osc);
return 0;
}
+EXPORT_SYMBOL(osc_punch_start);
static int osc_io_setattr_start(const struct lu_env *env,
const struct cl_io_slice *slice)
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index 2b2ee83..2ac0300 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -472,7 +472,7 @@ int osc_fallocate_base(struct obd_export *exp, struct obdo *oa,
ptlrpc_request_set_replen(req);
- req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_setattr_interpret;
+ req->rq_interpret_reply = osc_setattr_interpret;
BUILD_BUG_ON(sizeof(*sa) > sizeof(req->rq_async_args));
sa = ptlrpc_req_async_args(sa, req);
sa->sa_oa = oa;
@@ -482,6 +482,7 @@ int osc_fallocate_base(struct obd_export *exp, struct obdo *oa,
ptlrpcd_add_req(req);
return 0;
}
+EXPORT_SYMBOL(osc_fallocate_base);
static int osc_sync_interpret(const struct lu_env *env,
struct ptlrpc_request *req,
--
1.8.3.1
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev parent reply other threads:[~2021-08-23 2:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 2:27 [lustre-devel] [PATCH 00/15] lustre: sync to OpenSFS as of Aug 22, 2021 James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 01/15] lustre: uapi: support fixed directory layout James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 02/15] lustre: pcc: add LCM_FL_PCC_RDONLY layout flag James Simmons
2021-08-23 2:27 ` James Simmons [this message]
2021-08-23 2:27 ` [lustre-devel] [PATCH 04/15] lnet: Reflect ni_fatal in NI status James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 05/15] lustre: obdclass: reintroduce lu_ref James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 06/15] lnet: keep in insync to change due to GPU Direct Support James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 07/15] lustre: osc: Support RDMA only pages James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 08/15] lustre: mgc: rework mgc_apply_recover_logs() for gcc10 James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 09/15] lnet: socklnd: allow dynamic setting of conns_per_peer James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 10/15] lnet: Provide kernel API for adding peers James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 11/15] lustre: obdclass: Add peer/peer NI when processing llog James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 12/15] lnet: peer state to lock primary nid James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 13/15] lustre: llite: Proved an abstraction for AS_EXITING James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 14/15] lnet: socklnd: set conns_per_peer based on link speed James Simmons
2021-08-23 2:27 ` [lustre-devel] [PATCH 15/15] lustre: update version to 2.14.54 James Simmons
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=1629685666-4533-4-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=adilger@whamcloud.com \
--cc=green@whamcloud.com \
--cc=lustre-devel@lists.lustre.org \
--cc=mpershin@whamcloud.com \
--cc=neilb@suse.de \
/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).