Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-19002

osp_precreate_fids has strange unused variable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • Lustre 2.17.0
    • Lustre 2.17.0
    • 3
    • 9223372036854775807

    Description

      smatch highlights that osp_precreate_fids() has a variable i initialized to 0 that's never actually assigned anything else, but is used in a debug print in a way that implies it should be used.

      I checked and it was introduced like this from the very beginning in http://review.whamcloud.com/4789

               int i = 0;
      ... if statement that always exists so not relevant here ...
              spin_lock(&osp->opd_pre_lock);
              *fid = osp->opd_pre_last_created_fid;
              end = fid->f_oid;
              end = min((end + *grow), min(OBIF_MAX_OID, seq_width));
              *grow = end - fid->f_oid;
              fid->f_oid += end - fid->f_oid;
              spin_unlock(&osp->opd_pre_lock);
              CDEBUG(D_INFO, "Expect %d, actual %d ["DFID" -- "DFID"]\n",
                     *grow, i, PFID(fid), PFID(&osp->opd_pre_last_created_fid));
      

      So I am not entirely sure what that actaul is supopsed to be that's always printed as zero and I imagine if nothing broke too much since 2013, it's not a big deal, but would be great to get an idea what was supposed to be going on here or if we should just drop that i variable altogether.

      Attachments

        Activity

          People

            wc-triage WC Triage
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: