lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210316075542.z33ekalae7hgpfjc@spock.localdomain>
Date:   Tue, 16 Mar 2021 08:55:42 +0100
From:   Oleksandr Natalenko <oleksandr@...alenko.name>
To:     Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
Cc:     linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk,
        linux-kernel@...r.kernel.org, pali@...nel.org, dsterba@...e.cz,
        aaptel@...e.com, willy@...radead.org, rdunlap@...radead.org,
        joe@...ches.com, mark@...mstone.com, nborisov@...e.com,
        linux-ntfs-dev@...ts.sourceforge.net, anton@...era.com,
        dan.carpenter@...cle.com, hch@....de, ebiggers@...nel.org,
        andy.lavr@...il.com
Subject: Re: [PATCH v23 02/10] fs/ntfs3: Add initialization of super block

Hi.

On Mon, Mar 15, 2021 at 05:44:06PM +0300, Konstantin Komarov wrote:
> This adds initialization of super block
>
> ...SNIP...
> 
> +
> +/*
> + * Helper for ntfs_loadlog_and_replay
> + * fill on-disk logfile range by (-1)
> + * this means empty logfile
> + */
> +int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run)
> +{
> +	int err = 0;
> +	struct super_block *sb = sbi->sb;
> +	struct block_device *bdev = sb->s_bdev;
> +	u8 cluster_bits = sbi->cluster_bits;
> +	struct bio *new, *bio = NULL;
> +	CLST lcn, clen;
> +	u64 lbo, len;
> +	size_t run_idx;
> +	struct page *fill;
> +	void *kaddr;
> +	struct blk_plug plug;
> +
> +	fill = alloc_page(GFP_KERNEL);
> +	if (!fill)
> +		return -ENOMEM;
> +
> +	kaddr = kmap_atomic(fill);
> +	memset(kaddr, -1, PAGE_SIZE);
> +	kunmap_atomic(kaddr);
> +	flush_dcache_page(fill);
> +	lock_page(fill);
> +
> +	if (!run_lookup_entry(run, 0, &lcn, &clen, &run_idx)) {
> +		err = -ENOENT;
> +		goto out;
> +	}
> +
> +	/*
> +	 * TODO: try blkdev_issue_write_same
> +	 */
> +	blk_start_plug(&plug);
> +	do {
> +		lbo = (u64)lcn << cluster_bits;
> +		len = (u64)clen << cluster_bits;
> +new_bio:
> +		new = ntfs_alloc_bio(BIO_MAX_PAGES);
                             ^^^^^^^^^^^^^
this was renamed to BIO_MAX_VECS recently.

> +		if (!new) {
> +			err = -ENOMEM;
> +			break;
> +		}
> +		if (bio) {
> +			bio_chain(bio, new);
> +			submit_bio(bio);
> +		}
> +		bio = new;
> +		bio_set_dev(bio, bdev);
> +		bio->bi_opf = REQ_OP_WRITE;
> +		bio->bi_iter.bi_sector = lbo >> 9;
> +
> +		for (;;) {
> +			u32 add = len > PAGE_SIZE ? PAGE_SIZE : len;
> +
> +			if (bio_add_page(bio, fill, add, 0) < add)
> +				goto new_bio;
> +
> +			lbo += add;
> +			if (len <= add)
> +				break;
> +			len -= add;
> +		}
> +	} while (run_get_entry(run, ++run_idx, NULL, &lcn, &clen));
> +
> +	if (bio) {
> +		if (!err)
> +			err = submit_bio_wait(bio);
> +		bio_put(bio);
> +	}
> +	blk_finish_plug(&plug);
> +out:
> +	unlock_page(fill);
> +	put_page(fill);
> +
> +	return err;
> +}
>
> ...SNIP...
>

-- 
  Oleksandr Natalenko (post-factum)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ