X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosd-zfs%2Fosd_object.c;h=ab0a288848765858d8fd2a9d9fcb7ee5337b5df0;hp=ad6752fb8ef1bd3d7069e9b749f9b524ebafde17;hb=bc9eae65f0880e5ae781d373f843d2c76f263714;hpb=ddae357087fee63da36483c8432e178c3cacf903 diff --git a/lustre/osd-zfs/osd_object.c b/lustre/osd-zfs/osd_object.c index ad6752f..ab0a288 100644 --- a/lustre/osd-zfs/osd_object.c +++ b/lustre/osd-zfs/osd_object.c @@ -758,7 +758,8 @@ static int osd_attr_get(const struct lu_env *env, attr->la_size = 512 * blocks; /* Block size may be not set; suggest maximal I/O transfers. */ if (blksize == 0) - blksize = 1ULL << SPA_MAXBLOCKSHIFT; + blksize = osd_spa_maxblocksize( + dmu_objset_spa(osd_obj2dev(obj)->od_os)); attr->la_blksize = blksize; attr->la_blocks = blocks; @@ -1329,13 +1330,15 @@ static dmu_buf_t *osd_mkreg(const struct lu_env *env, struct osd_object *obj, return ERR_PTR(rc); /* - * XXX: a hack, OST to use bigger blocksize. we need - * a method in OSD API to control this from OFD/MDD + * XXX: This heuristic is non-optimal. It would be better to + * increase the blocksize up to osd->od_max_blksz during the write. + * This is exactly how the ZPL behaves and it ensures that the right + * blocksize is selected based on the file size rather than the + * making broad assumptions based on the osd type. */ if (!lu_device_is_md(osd2lu_dev(osd))) { - rc = -dmu_object_set_blocksize(osd->od_os, - db->db_object, - 128 << 10, 0, oh->ot_tx); + rc = -dmu_object_set_blocksize(osd->od_os, db->db_object, + osd->od_max_blksz, 0, oh->ot_tx); if (unlikely(rc)) { CERROR("%s: can't change blocksize: %d\n", osd->od_svname, rc);