Motr  M0
io.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_STOB_IO_H__
26 #define __MOTR_STOB_IO_H__
27 
28 #include "lib/vec.h" /* m0_bufvec */
29 #include "lib/chan.h" /* m0_chan */
30 #include "lib/mutex.h" /* m0_mutex */
31 #include "xcode/xcode.h" /* M0_XCA_ENUM */
32 
218 struct m0_stob;
219 struct m0_stob_domain;
220 struct m0_be_tx_credit;
221 
233 };
234 
240  SIS_ZERO = 0,
256 };
257 
274  SIF_PREFIX = (1 << 0),
279  SIF_NOHOLE = (1 << 1),
280 };
281 
285 struct m0_stob_io {
318  struct m0_chan si_wait;
321  /* The fields below are modified only by an adieu implementation. */
322 
326  struct m0_stob *si_obj;
328  const struct m0_stob_io_op *si_op;
334  int32_t si_rc;
351  struct m0_dtx *si_tx;
355  struct m0_io_scope *si_scope;
388  uint32_t si_stob_magic;
406  uint64_t si_id;
407 
408  /* This checksum should be for stob IO,
409  * During Write will be populated checksum in this from request FOP
410  * During Read stob IO code will populate this
411  */
412  struct m0_buf si_cksum;
413  /* Size of a Data Unit for which checksum is computed */
415  /* Size of single unit of checksum e.g md5 checksum with digest has 128 byte size */
417  /* Size of checksum actually put into buffer*/
419 };
420 
430  void (*sio_fini)(struct m0_stob_io *io);
448 };
449 
453 M0_INTERNAL void m0_stob_io_init(struct m0_stob_io *io);
454 
458 M0_INTERNAL void m0_stob_io_fini(struct m0_stob_io *io);
459 
468 M0_INTERNAL void m0_stob_io_credit(const struct m0_stob_io *io,
469  const struct m0_stob_domain *dom,
470  struct m0_be_tx_credit *accum);
471 
487 M0_INTERNAL int m0_stob_io_launch(struct m0_stob_io *io, struct m0_stob *obj,
488  struct m0_dtx *tx, struct m0_io_scope *scope);
489 
501 M0_INTERNAL int m0_stob_io_prepare(struct m0_stob_io *io,
502  struct m0_stob *obj,
503  struct m0_dtx *tx,
504  struct m0_io_scope *scope);
505 
509 M0_INTERNAL int m0_stob_io_prepare_and_launch(struct m0_stob_io *io,
510  struct m0_stob *obj,
511  struct m0_dtx *tx,
512  struct m0_io_scope *scope);
513 
517 M0_INTERNAL bool m0_stob_io_user_is_valid(const struct m0_bufvec *user);
518 
522 M0_INTERNAL bool m0_stob_io_stob_is_valid(const struct m0_indexvec *stob);
523 
531 M0_INTERNAL int m0_stob_io_bufvec_launch(struct m0_stob *stob,
532  struct m0_bufvec *bufvec,
533  int op_code,
535 
536 
542 M0_INTERNAL void *m0_stob_addr_pack(const void *buf, uint32_t shift);
543 
549 M0_INTERNAL void *m0_stob_addr_open(const void *buf, uint32_t shift);
550 
556 M0_INTERNAL void m0_stob_iovec_sort(struct m0_stob_io *stob);
557 
562 M0_INTERNAL int m0_stob_io_private_setup(struct m0_stob_io *io,
563  struct m0_stob *obj);
565 #endif /* __MOTR_STOB_IO_H__ */
566 
567 /*
568  * Local variables:
569  * c-indentation-style: "K&R"
570  * c-basic-offset: 8
571  * tab-width: 8
572  * fill-column: 80
573  * scroll-step: 1
574  * End:
575  */
576 /*
577  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
578  */
Definition: dtm.h:554
enum m0_stob_io_flags si_flags
Definition: io.h:290
M0_INTERNAL int m0_stob_io_bufvec_launch(struct m0_stob *stob, struct m0_bufvec *bufvec, int op_code, m0_bindex_t offset)
Definition: io.c:248
M0_INTERNAL bool m0_stob_io_user_is_valid(const struct m0_bufvec *user)
Definition: io.c:230
M0_INTERNAL void m0_stob_io_fini(struct m0_stob_io *io)
Definition: io.c:122
m0_bindex_t si_unit_sz
Definition: io.h:414
Definition: io.h:230
M0_INTERNAL void m0_stob_io_credit(const struct m0_stob_io *io, const struct m0_stob_domain *dom, struct m0_be_tx_credit *accum)
Definition: io.c:130
uint64_t m0_time_t
Definition: time.h:37
Definition: io.h:274
const struct m0_stob_io_op * si_op
Definition: io.h:328
uint64_t m0_bindex_t
Definition: types.h:80
struct m0_chan si_wait
Definition: io.h:318
uint64_t m0_bcount_t
Definition: types.h:77
int(* sio_launch)(struct m0_stob_io *io)
Definition: io.h:439
static struct foo * obj
Definition: tlist.c:302
void(* sio_fini)(struct m0_stob_io *io)
Definition: io.h:430
Definition: sock.c:887
struct m0_bufvec si_user
Definition: io.h:300
Definition: buf.h:37
struct m0_dtx * si_tx
Definition: io.h:351
Definition: io.h:232
M0_INTERNAL int m0_stob_io_prepare_and_launch(struct m0_stob_io *io, struct m0_stob *obj, struct m0_dtx *tx, struct m0_io_scope *scope)
Definition: io.c:219
struct m0_buf si_cksum
Definition: io.h:412
Definition: stob.h:163
struct m0_indexvec si_stob
Definition: io.h:311
int32_t si_rc
Definition: io.h:334
static struct m0_stob * stob
Definition: storage.c:39
m0_stob_io_opcode
Definition: io.h:227
int(* sio_prepare)(struct m0_stob_io *io)
Definition: io.h:447
m0_time_t si_start
Definition: io.h:405
static struct m0_stob_domain * dom
Definition: storage.c:38
Definition: io.h:244
M0_INTERNAL void * m0_stob_addr_pack(const void *buf, uint32_t shift)
Definition: io.c:293
M0_INTERNAL int m0_stob_io_private_setup(struct m0_stob_io *io, struct m0_stob *obj)
Definition: io.c:49
uint32_t si_stob_magic
Definition: io.h:388
struct m0_fol_frag * si_fol_frag
Definition: io.h:390
uint64_t si_id
Definition: io.h:406
enum m0_stob_io_state si_state
Definition: io.h:345
Definition: io.h:255
Definition: chan.h:229
static m0_bindex_t offset
Definition: dump.c:173
Definition: io.h:285
m0_bcount_t si_cksum_sz
Definition: io.h:416
static struct m0_stob_io io
Definition: ad.c:59
m0_bcount_t si_count
Definition: io.h:340
struct m0_stob * si_obj
Definition: io.h:326
struct m0_mutex si_mutex
Definition: io.h:319
Definition: io.h:279
void * si_stob_private
Definition: io.h:367
M0_INTERNAL void * m0_stob_addr_open(const void *buf, uint32_t shift)
Definition: io.c:302
M0_INTERNAL void m0_stob_iovec_sort(struct m0_stob_io *stob)
Definition: io.c:311
m0_stob_io_flags
Definition: io.h:261
struct m0_bufvec si_battr
Definition: io.h:403
m0_stob_io_state
Definition: io.h:238
M0_INTERNAL void m0_stob_io_init(struct m0_stob_io *io)
Definition: io.c:111
m0_bcount_t si_cksum_nob_read
Definition: io.h:418
M0_INTERNAL int m0_stob_io_launch(struct m0_stob_io *io, struct m0_stob *obj, struct m0_dtx *tx, struct m0_io_scope *scope)
Definition: io.c:192
Definition: io.h:229
M0_INTERNAL int m0_stob_io_prepare(struct m0_stob_io *io, struct m0_stob *obj, struct m0_dtx *tx, struct m0_io_scope *scope)
Definition: io.c:155
Definition: mutex.h:47
struct m0_io_scope * si_scope
Definition: io.h:355
M0_INTERNAL bool m0_stob_io_stob_is_valid(const struct m0_indexvec *stob)
Definition: io.c:235
Definition: vec.h:145
Definition: io.h:240
enum m0_stob_io_opcode si_opcode
Definition: io.h:286