all: new MARS_HAS naming conventions

This commit is contained in:
Thomas Schoebel-Theuer 2019-08-06 08:53:28 +02:00 committed by Thomas Schoebel-Theuer
parent ccd0063da6
commit 39eaa78c58
4 changed files with 38 additions and 38 deletions

View File

@ -67,27 +67,27 @@ extern int _compat_unlink(
*/
#ifdef __bvec_iter_bvec
#define HAS_BVEC_ITER
#define MARS_HAS_BVEC_ITER
#endif
/* adaptation to 4246a0b63bd8f56a1469b12eafeb875b1041a451 and 8ae126660fddbeebb9251a174e6fa45b6ad8f932 */
#ifndef bio_io_error
#define HAS_BI_ERROR
#define MARS_HAS_BI_ERROR
#else
#define HAS_MERGE_BVEC
#define MARS_HAS_MERGE_BVEC
#endif
/* adapt to 4e1b2d52a80d79296a5d899d73249748dea71a53 and many others */
#ifdef bio_op
#define HAS_NEW_BIO_OP
#define MARS_HAS_NEW_BIO_OP
#endif
#ifdef bio_end_sector
#define HAS_VOID_RELEASE
#define MARS_HAS_VOID_RELEASE
#endif
#ifdef __bvec_iter_bvec
#define HAS_BVEC_ITER
#define MARS_HAS_BVEC_ITER
#endif
/* 54efd50bfd873e2dbf784e0b21a8027ba4299a3e and 8ae126660fddbeebb9251a174e6fa45b6ad8f932,
@ -99,7 +99,7 @@ extern int _compat_unlink(
/* adapt to 4e1b2d52a80d79296a5d899d73249748dea71a53 and many others */
#ifdef bio_op
#define HAS_NEW_BIO_OP
#define MARS_HAS_NEW_BIO_OP
#endif
/* for networking */
@ -119,7 +119,7 @@ extern int _compat_unlink(
/* 896545098777564212b9e91af4c973f094649aa7 */
#ifndef crt_hash
#define HAS_NEW_CRYPTO
#define MARS_HAS_NEW_CRYPTO
#endif
#endif /* _MARS_COMPAT */

View File

@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(bio_io_threshold);
/* This is called from the kernel bio layer.
*/
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
static
void bio_callback(struct bio *bio)
@ -102,7 +102,7 @@ void bio_callback(struct bio *bio, int code)
CHECK_PTR(brick, err);
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
mref_a->status_code = bio->bi_error;
// remove_this
@ -236,7 +236,7 @@ int make_bio(struct bio_brick *brick, void *data, int len, loff_t pos, struct bi
bio->bi_vcnt = i;
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
bio->bi_iter.bi_idx = 0;
bio->bi_iter.bi_size = result_len;
@ -251,7 +251,7 @@ int make_bio(struct bio_brick *brick, void *data, int len, loff_t pos, struct bi
bio->bi_bdev = bdev;
bio->bi_private = private;
bio->bi_end_io = bio_callback;
#ifndef HAS_NEW_BIO_OP
#ifndef MARS_HAS_NEW_BIO_OP
bio->bi_rw = 0; // must be filled in later
#endif
status = result_len;
@ -464,7 +464,7 @@ void _bio_ref_io(struct bio_output *output, struct mref_object *mref, bool cork)
#ifdef FAKE_IO
bio->bi_end_io(bio, 0);
#else
#ifdef HAS_NEW_BIO_OP
#ifdef MARS_HAS_NEW_BIO_OP
if (rw & 1) {
bio_set_op_attrs(bio, REQ_OP_WRITE,
mref->ref_skip_sync ? 0 : WRITE_SYNC);

View File

@ -126,7 +126,7 @@ EXPORT_SYMBOL_GPL(mars_timespec_meta);
// crypto stuff
#ifdef HAS_NEW_CRYPTO
#ifdef MARS_HAS_NEW_CRYPTO
/* Nor now, use shash.
* Later, asynchronous support should be added for full exploitation
@ -161,7 +161,7 @@ void mars_digest(unsigned char *digest, void *data, int len)
brick_mem_free(sdesc);
}
#else /* HAS_NEW_CRYPTO */
#else /* MARS_HAS_NEW_CRYPTO */
/* Old implementation, to disappear.
* Was a quick'n dirty lab prototype with unnecessary
@ -197,7 +197,7 @@ void mars_digest(unsigned char *digest, void *data, int len)
up(&tfm_sem[i]);
}
#endif /* HAS_NEW_CRYPTO */
#endif /* MARS_HAS_NEW_CRYPTO */
void mref_checksum(struct mref_object *mref)
{
@ -376,7 +376,7 @@ int __init init_mars(void)
}
#endif
#ifdef HAS_NEW_CRYPTO
#ifdef MARS_HAS_NEW_CRYPTO
mars_tfm = crypto_alloc_shash("md5", 0, 0);
if (unlikely(!mars_tfm) || IS_ERR(mars_tfm)) {
MARS_ERR("cannot alloc crypto hash, status=%ld\n",
@ -384,7 +384,7 @@ int __init init_mars(void)
return -ELIBACC;
}
mars_digest_size = crypto_shash_digestsize(mars_tfm);
#else /* HAS_NEW_CRYPTO */
#else /* MARS_HAS_NEW_CRYPTO */
{
int i;
@ -408,7 +408,7 @@ int __init init_mars(void)
}
#endif
mars_digest_size = crypto_hash_digestsize(mars_tfm[0]);
#endif /* HAS_NEW_CRYPTO */
#endif /* MARS_HAS_NEW_CRYPTO */
MARS_INF("digest_size = %d\n", mars_digest_size);
return 0;
@ -420,18 +420,18 @@ void exit_mars(void)
put_fake();
#ifdef HAS_NEW_CRYPTO
#ifdef MARS_HAS_NEW_CRYPTO
if (mars_tfm) {
crypto_free_shash(mars_tfm);
}
#else /* HAS_NEW_CRYPTO */
#else /* MARS_HAS_NEW_CRYPTO */
if (mars_tfm[0]) {
int i;
for (i = 0; i < OBSOLETE_TFM_MAX; i++)
crypto_free_hash(mars_tfm[i]);
}
#endif /* HAS_NEW_CRYPTO */
#endif /* MARS_HAS_NEW_CRYPTO */
#ifdef MARS_TRACING
if (mars_log_file) {

View File

@ -113,7 +113,7 @@ void _if_start_io_acct(struct if_input *input, struct bio_wrapper *biow)
part_round_stats(cpu, &input->disk->part0);
part_stat_inc(cpu, &input->disk->part0, ios[rw]);
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
part_stat_add(cpu, &input->disk->part0, sectors[rw], bio->bi_iter.bi_size >> 9);
// remove_this
@ -191,7 +191,7 @@ void if_endio(struct generic_callback *cb)
error = CALLBACK_ERROR(mref_a->object);
if (unlikely(error < 0)) {
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
int bi_size = bio->bi_iter.bi_size;
// remove_this
@ -203,7 +203,7 @@ void if_endio(struct generic_callback *cb)
} else { // bio conventions are slightly different...
error = 0;
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
bio->bi_iter.bi_size = 0;
// remove_this
@ -214,7 +214,7 @@ void if_endio(struct generic_callback *cb)
}
MARS_IO("calling end_io() rw = %d error = %d\n", rw, error);
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
bio->bi_error = error;
bio_endio(bio);
@ -382,7 +382,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
const bool meta = _flagged(REQ_META);
const bool discard = _flagged(REQ_DISCARD);
const bool noidle = _flagged(REQ_THROTTLED);
#elif defined(HAS_NEW_BIO_OP)
#elif defined(MARS_HAS_NEW_BIO_OP)
// end_remove_this
#define _flagged(x) (bio->bi_opf & (x))
const bool ahead = _flagged(REQ_RAHEAD) && rw == READ;
@ -414,7 +414,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
struct mref_object *mref = NULL;
struct if_mref_aspect *mref_a;
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
struct bio_vec bvec;
struct bvec_iter i;
@ -474,7 +474,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
* something here. For now, we do just nothing.
*/
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
error = 0;
bio->bi_error = error;
@ -498,7 +498,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
if (ahead) {
atomic_inc(&input->total_reada_count);
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
bio->bi_error = -EWOULDBLOCK;
bio_endio(bio);
@ -516,7 +516,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
if (unlikely(discard)) { // NYI
error = 0;
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
bio->bi_error = error;
bio_endio(bio);
@ -551,7 +551,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
bio_for_each_segment(bvec, bio, i) {
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
struct page *page = bvec.bv_page;
int bv_len = bvec.bv_len;
@ -714,7 +714,7 @@ void if_make_request(struct request_queue *q, struct bio *bio)
*/
mref->ref_skip_sync = true;
// remove_this
#ifdef HAS_BVEC_ITER
#ifdef MARS_HAS_BVEC_ITER
// end_remove_this
if (!do_skip_sync && i.bi_idx + 1 >= bio->bi_iter.bi_idx) {
mref->ref_skip_sync = false;
@ -768,7 +768,7 @@ err:
MARS_ERR("cannot submit request from bio, status=%d\n", error);
if (!assigned) {
// remove_this
#ifdef HAS_BI_ERROR
#ifdef MARS_HAS_BI_ERROR
// end_remove_this
bio->bi_error = error;
bio_endio(bio);
@ -885,7 +885,7 @@ int mars_congested(void *data, int bdi_bits)
}
// remove_this
#ifdef HAS_MERGE_BVEC
#ifdef MARS_HAS_MERGE_BVEC
static
int mars_merge_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *bvec)
{
@ -1068,7 +1068,7 @@ static int if_switch(struct if_brick *brick)
q->backing_dev_info.congested_data = input;
#endif
// remove_this
#ifdef HAS_MERGE_BVEC
#ifdef MARS_HAS_MERGE_BVEC
MARS_DBG("blk_queue_merge_bvec()\n");
blk_queue_merge_bvec(q, mars_merge_bvec);
#endif
@ -1198,7 +1198,7 @@ void wait_io_done(struct if_brick *brick)
static
// remove_this
#ifdef HAS_VOID_RELEASE
#ifdef MARS_HAS_VOID_RELEASE
// end_remove_this
void
// remove_this
@ -1226,7 +1226,7 @@ if_release(struct gendisk *gd, fmode_t mode)
mars_remote_trigger();
}
// remove_this
#ifndef HAS_VOID_RELEASE
#ifndef MARS_HAS_VOID_RELEASE
return 0;
#endif
// end_remove_this