Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D6A6C25B76 for ; Wed, 5 Jun 2024 03:52:26 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=hqKBHwPG; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VvD7D27rwz3brC for ; Wed, 5 Jun 2024 13:52:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=hqKBHwPG; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.132; helo=out30-132.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=lists.ozlabs.org) Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VvD6z5qdlz3bNs for ; Wed, 5 Jun 2024 13:52:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1717559528; h=Message-ID:Date:MIME-Version:From:Subject:To:Content-Type; bh=aKh6tcs1VR+5wsa2AsuwIEaTmxuzZ4Zy7RwNJRVDVmI=; b=hqKBHwPGa9RsXFTI2hzcWIWvrNw03+UmGixt9cxN0UnAReQw/MQ747PGk45lqVbpkiBnA4iXZmXgVFrL7U3XdAK2V1a8E2nVW1n53mqIlEmEYuei6rOT/187bZk16iOd5gVjJwWTumCcjPvCVMLx5WvWo75CEIln5uxDks3CozA= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R941e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067109;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=2;SR=0;TI=SMTPD_---0W7shQXM_1717559525; Received: from 30.97.48.174(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0W7shQXM_1717559525) by smtp.aliyun-inc.com; Wed, 05 Jun 2024 11:52:06 +0800 Message-ID: Date: Wed, 5 Jun 2024 11:52:05 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Gao Xiang Subject: Re: [PATCH v2] erofs-utils: introduce the I/O manager To: Hongzhen Luo , linux-erofs mailing list References: <20240604121029.4030290-1-hongzhen@linux.alibaba.com> <66602c0c-975b-4dd2-8244-576cada26102@linux.alibaba.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" (+ Cc linux-erofs) On 2024/6/5 11:32, Hongzhen Luo wrote: > > 在 2024/6/5 10:55, Gao Xiang 写道: >> >> >> On 2024/6/4 20:10, Hongzhen Luo wrote: >>> Introduce the I/O manager to provide a more flexible way to specify >>> the virtual storage. >>> >>> Signed-off-by: Hongzhen Luo >>> --- >>> v2: Updated the handling of `.dev_close` being unimplemented in `erofs_dev_close` and so on. >>> v1: https://lore.kernel.org/all/20240604093556.3883585-1-hongzhen@linux.alibaba.com/ >> >> I'm unable to apply this patch. >> > Sorry about that, I overlooked developing based on the latest branch. I will send a v3 soon. >>> --- >> >> ... >> >>>   +struct erofs_io_manager { >>> +    int (*dev_open)(struct erofs_sb_info *sbi, const char *devname); >> >>     int (*open)(...); >> >>> +    int (*dev_open_ro)(struct erofs_sb_info *sbi, const char *dev); >> >>     int (*open_ro)(...); >> >>> +    int (*blob_open_ro)(struct erofs_sb_info *sbi, const char *dev); >> >> >>     int (*blob_open_ro)(...); >> >>> +    int (*dev_read)(struct erofs_sb_info *sbi, int device_id, >>> +        void *buf, u64 offset, size_t len); >> >>     int (*read)(...); >> >>> +    int (*dev_write)(struct erofs_sb_info *sbi, const void *buf, >>> +        u64 offset, size_t len); >> >>     int (*write)(...); >> >>> +    int (*dev_fillzero)(struct erofs_sb_info *sbi, u64 offset, >>> +        size_t len, bool padding); >>     int (*fillzero)(...); >> >>> +    int (*dev_fsync)(struct erofs_sb_info *sbi); >> >>     int (*fsync)(...); >> >>> +    int (*dev_resize)(struct erofs_sb_info *sbi, erofs_blk_t nblocks); >> >>     int (*resize)(...); >> >>> +    void (*dev_close)(struct erofs_sb_info *sbi); >> >>     int (*close)(...); >> >>> +    void (*blob_closeall)(struct erofs_sb_info *sbi); >> >>     int (*blob_closeall)(...); >> >>> +    void *private_data; >> >> What does this mean? >> > Interface implementers can use it to store the data they wish to save. For example, in C++, this pointer can be used to store an object pointer, thereby accessing the data associated with the object. > > Another option is to remove this pointer and let the implementer wrap the I/O manager into another object. Which strategy to adopt needs to be discussed. I don't see how private_data is used in this patch and it's unrelated to C++. If it's unused, please remove it entirely. Thanks, Gao Xiang