what does the code belowing do static uint
bmap(struct inode *ip, uint bn)
{
  uint addr, *a;
  struct buf *bp;

  if(bn &lt; NDIRECT){
    if((addr = ip-&gt;addrs[bn]) == 0)
      ip-&gt;addrs[bn] = addr = balloc(ip-&gt;dev);
    return addr;
  }
  bn -= NDIRECT;

  if(bn &lt; NINDIRECT){
    // Load indirect block, allocating if necessary.
    if((addr = ip-&gt;addrs[NDIRECT]) == 0)
      ip-&gt;addrs[NDIRECT] = addr = balloc(ip-&gt;dev);
    bp = bread(ip-&gt;dev, addr);
    a = (uint*)bp-&gt;data;
    if((addr = a[bn]) == 0){
      a[bn] = addr = balloc(ip-&gt;dev);
      log_write(bp);
    }
    brelse(bp);
    return addr;
  }