X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=inline;f=lustre%2Fobdclass%2Fllog_cat.c;h=86a20472cc6b914177777788c3d2c585136fb684;hb=4724b52bba54ccdb0f81d0c63010b69e87e7f65c;hp=1e0c1fd64cc6c0d0aae84f985a3b4b0f4d421d7e;hpb=96509385abe2d03bd9212edef26e4aabe0ebf8bd;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 1e0c1fd..86a2047 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -175,6 +171,25 @@ static int llog_cat_new_log(const struct lu_env *env, POSTID(&cathandle->lgh_id.lgl_oi)); loghandle->lgh_hdr->llh_cat_idx = rec->lid_hdr.lrh_index; + + /* limit max size of plain llog so that space can be + * released sooner, especially on small filesystems */ + /* 2MB for the cases when free space hasn't been learned yet */ + loghandle->lgh_max_size = 2 << 20; + dt = lu2dt_dev(cathandle->lgh_obj->do_lu.lo_dev); + rc = dt_statfs(env, dt, &lgi->lgi_statfs); + if (rc == 0 && lgi->lgi_statfs.os_bfree > 0) { + __u64 freespace = (lgi->lgi_statfs.os_bfree * + lgi->lgi_statfs.os_bsize) >> 6; + if (freespace < loghandle->lgh_max_size) + loghandle->lgh_max_size = freespace; + /* shouldn't be > 128MB in any case? + * it's 256K records of 512 bytes each */ + if (freespace > (128 << 20)) + loghandle->lgh_max_size = 128 << 20; + } + rc = 0; + out: if (handle != NULL) { handle->th_result = rc >= 0 ? 0 : rc; @@ -911,7 +926,7 @@ static int llog_cat_size_cb(const struct lu_env *env, size = llog_size(env, llh); *cum_size += size; - CDEBUG(D_INFO, "Add llog entry "DOSTID" size "LPU64"\n", + CDEBUG(D_INFO, "Add llog entry "DOSTID" size %llu\n", POSTID(&llh->lgh_id.lgl_oi), size); llog_handle_put(llh);