code: func (ms *FileMsgStore) enforceLimits(reportHitLimit, lockFile bool) error {
  	// Check if we need to remove any (but leave at least the last added).
  	// Note that we may have to remove more than one msg if we are here
  	// after a restart with smaller limits than originally set, or if
  	// message is quite big, etc...
  	maxMsgs := ms.limits.MaxMsgs
  	maxBytes := ms.limits.MaxBytes
  	for ms.totalCount > 1 &&
  		((maxMsgs > 0 && ms.totalCount > maxMsgs) ||
  			(maxBytes > 0 && ms.totalBytes > uint64(maxBytes))) {
  
  		// Remove first message from first slice, potentially removing
  		// the slice, etc...
  		if err := ms.removeFirstMsg(nil, lockFile); err != nil {
  			// We are not going to fail the publish, just report
  			// the error removing the first message.
  			// TODO: Is this the right thing to do?
  			ms.log.Errorf("Unable to remove first message: %v", err)
  			return nil
  		}
  		if reportHitLimit && !ms.hitLimit {
  			ms.hitLimit = true
  			ms.log.Warnf(droppingMsgsFmt, ms.subject, ms.totalCount, ms.limits.MaxMsgs,
  				util.FriendlyBytes(int64(ms.totalBytes)), util.FriendlyBytes(ms.limits.MaxBytes))
  		}
  	}
  	return nil
  }
docs: // enforceLimits checks total counts with current msg store's limits,
  // removing a file slice and/or updating slices' count as necessary.